From 36519bdbee321354788fde71e33e74d7f6a353d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iva=CC=81n=20Raskovsky?= Date: Fri, 11 Nov 2022 12:22:21 -0300 Subject: [PATCH 1/2] allow custom db port --- .gitlab-ci.yml | 1 + config/benchmark.exs | 1 + config/docker.exs | 1 + config/test.exs | 1 + docker-entrypoint.sh | 2 +- installation/pleroma-mongooseim.cfg | 2 +- 6 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0fa1f624d..329904bbe 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,6 +5,7 @@ variables: &global_variables POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres DB_HOST: postgres + DB_PORT: 5432 MIX_ENV: test cache: &global_cache_policy diff --git a/config/benchmark.exs b/config/benchmark.exs index 9a7ea5669..870ead150 100644 --- a/config/benchmark.exs +++ b/config/benchmark.exs @@ -40,6 +40,7 @@ password: "postgres", database: "pleroma_benchmark", hostname: System.get_env("DB_HOST") || "localhost", + port: System.get_env("DB_PORT") || "5432", pool_size: 10 # Reduce hash rounds for testing diff --git a/config/docker.exs b/config/docker.exs index f9f27d141..5db222485 100644 --- a/config/docker.exs +++ b/config/docker.exs @@ -18,6 +18,7 @@ password: System.fetch_env!("DB_PASS"), database: System.get_env("DB_NAME", "pleroma"), hostname: System.get_env("DB_HOST", "db"), + port: System.get_env("DB_PORT", "5432"), pool_size: 10 # Configure web push notifications diff --git a/config/test.exs b/config/test.exs index f5eb6e5c2..f7c130d40 100644 --- a/config/test.exs +++ b/config/test.exs @@ -47,6 +47,7 @@ password: "postgres", database: "pleroma_test", hostname: System.get_env("DB_HOST") || "localhost", + port: System.get_env("DB_HOST") || "5432", pool: Ecto.Adapters.SQL.Sandbox, pool_size: 50 diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index f56f8c50a..4691f68bb 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -3,7 +3,7 @@ set -e echo "-- Waiting for database..." -while ! pg_isready -U ${DB_USER:-pleroma} -d postgres://${DB_HOST:-db}:5432/${DB_NAME:-pleroma} -t 1; do +while ! pg_isready -U ${DB_USER:-pleroma} -d postgres://${DB_HOST:-db}:${DB_PORT:-5432}/${DB_NAME:-pleroma} -t 1; do sleep 1s done diff --git a/installation/pleroma-mongooseim.cfg b/installation/pleroma-mongooseim.cfg index 576f83541..3ecba5641 100755 --- a/installation/pleroma-mongooseim.cfg +++ b/installation/pleroma-mongooseim.cfg @@ -466,7 +466,7 @@ %% == PostgreSQL == %% {rdbms, global, default, [{workers, 10}], -%% [{server, {pgsql, "server", 5432, "database", "username", "password"}}]}, +%% [{server, {pgsql, "server", "port", "database", "username", "password"}}]}, %% == ODBC (MSSQL) == %% {rdbms, global, default, [{workers, 10}], From e7c40c250998bd7d90b7a8be39a8d8e85686153d Mon Sep 17 00:00:00 2001 From: lain Date: Fri, 11 Nov 2022 15:40:32 +0000 Subject: [PATCH 2/2] fix envvar --- config/test.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/test.exs b/config/test.exs index f7c130d40..ea6f61393 100644 --- a/config/test.exs +++ b/config/test.exs @@ -47,7 +47,7 @@ password: "postgres", database: "pleroma_test", hostname: System.get_env("DB_HOST") || "localhost", - port: System.get_env("DB_HOST") || "5432", + port: System.get_env("DB_PORT") || "5432", pool: Ecto.Adapters.SQL.Sandbox, pool_size: 50