From 5a46a6accd54618a5a3f57774a70da551de0fe8f Mon Sep 17 00:00:00 2001 From: Kieran Eglin Date: Fri, 16 Feb 2024 09:50:15 -0800 Subject: [PATCH] Updated build tools to remove postgres --- .env.sample | 3 --- .github/workflows/lint_and_test.yml | 3 --- Dockerfile | 2 +- config/dev.exs | 2 +- config/test.exs | 2 +- docker-compose.ci.yml | 7 ------- docker-compose.yml | 10 ---------- docker-run.sh | 9 --------- mix.exs | 1 - 9 files changed, 3 insertions(+), 36 deletions(-) delete mode 100644 .env.sample diff --git a/.env.sample b/.env.sample deleted file mode 100644 index c774b61..0000000 --- a/.env.sample +++ /dev/null @@ -1,3 +0,0 @@ -POSTGRES_HOST=postgres -POSTGRES_USER=postgres -POSTGRES_PASSWORD=postgres diff --git a/.github/workflows/lint_and_test.yml b/.github/workflows/lint_and_test.yml index 09f9595..8983a87 100644 --- a/.github/workflows/lint_and_test.yml +++ b/.github/workflows/lint_and_test.yml @@ -24,9 +24,6 @@ jobs: - name: Create and populate ENV file run: | echo MIX_ENV=test >> .env - echo POSTGRES_HOST=postgres >> .env - echo POSTGRES_USER=postgres >> .env - echo POSTGRES_PASSWORD=postgres >> .env - name: Pull prebuilt images run: docker compose pull diff --git a/Dockerfile b/Dockerfile index e987099..84b1faf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM elixir:latest # Install debian packages RUN apt-get update -qq -RUN apt-get install -y inotify-tools postgresql-client ffmpeg \ +RUN apt-get install -y inotify-tools ffmpeg \ python3 python3-pip python3-setuptools python3-wheel python3-dev # Install nodejs diff --git a/config/dev.exs b/config/dev.exs index 05d92ea..2dda9d9 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -6,7 +6,7 @@ config :pinchflat, # Configure your database config :pinchflat, Pinchflat.Repo, - database: Path.expand("../pinchflat_dev.db", Path.dirname(__ENV__.file)), + database: Path.expand("../priv/repo/pinchflat_dev.db", Path.dirname(__ENV__.file)), show_sensitive_data_on_connection_error: true, pool_size: 5 diff --git a/config/test.exs b/config/test.exs index a4e7629..e51fb69 100644 --- a/config/test.exs +++ b/config/test.exs @@ -14,7 +14,7 @@ config :pinchflat, Oban, testing: :manual # to provide built-in test partitioning in CI environment. # Run `mix help test` for more information. config :pinchflat, Pinchflat.Repo, - database: Path.expand("../pinchflat_test.db", Path.dirname(__ENV__.file)), + database: Path.expand("../priv/repo/pinchflat_test.db", Path.dirname(__ENV__.file)), pool_size: 5, pool: Ecto.Adapters.SQL.Sandbox diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index 432e233..19e7aae 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -1,11 +1,5 @@ version: '3' services: - postgres: - image: 'postgres:16-alpine' - environment: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - phx: build: . volumes: @@ -13,4 +7,3 @@ services: ports: - '4008:4008' command: tail -F /dev/null - env_file: .env diff --git a/docker-compose.yml b/docker-compose.yml index 34d2e2a..2f89a50 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,22 +1,12 @@ version: '3' services: - postgres: - image: 'postgres:16-alpine' - environment: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - phx: build: . volumes: - '.:/app' ports: - '4008:4008' - depends_on: - - postgres command: - ./docker-run.sh stdin_open: true tty: true - env_file: - - .env diff --git a/docker-run.sh b/docker-run.sh index 4496d15..ddae66f 100755 --- a/docker-run.sh +++ b/docker-run.sh @@ -10,15 +10,6 @@ echo "\nInstalling JS..." cd assets && yarn install cd .. -# Wait for Postgres to become available. -export PGPASSWORD=$(echo $POSTGRES_PASSWORD) -until psql -h postgres -U $POSTGRES_USER -c '\q' 2>/dev/null; do - echo >&2 "Postgres is unavailable - sleeping" - sleep 1 -done - -echo "\nPostgres is available: continuing with database setup..." - # Potentially Set up the database mix ecto.create mix ecto.migrate diff --git a/mix.exs b/mix.exs index 5c87df3..13c726a 100644 --- a/mix.exs +++ b/mix.exs @@ -36,7 +36,6 @@ defmodule Pinchflat.MixProject do {:phoenix_ecto, "~> 4.4"}, {:ecto_sql, "~> 3.10"}, {:ecto_sqlite3, ">= 0.0.0"}, - {:postgrex, ">= 0.0.0"}, {:phoenix_html, "~> 3.3"}, {:phoenix_live_reload, "~> 1.2", only: :dev}, {:phoenix_live_view, "~> 0.20.1"},