diff --git a/README.md b/README.md index 61243a3..3b98f80 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,8 @@ What it does: ## Configuration -If you already have postgres installed on your system then you may have conflicting ports, in that case change the `POSTGRES_PORT` to a free port in the `.env`, usually `5433`. Then rebuild by using following command: +If you already have postgres installed on your system then you may have conflicting ports, in that case change +the `POSTGRES_PORT_HOST` to a free port in the `.env`, usually `5433`. (Clarification:`POSTGRES_PORT` env variable is only used within the container environment). Then rebuild by using following command: ``` docker compose up -d --build ``` diff --git a/src/.env.EXAMPLE b/src/.env.EXAMPLE index 328e54f..eeff674 100644 --- a/src/.env.EXAMPLE +++ b/src/.env.EXAMPLE @@ -19,6 +19,7 @@ STREAM_LOGS=True # Database — don't change unless you know what you're doing POSTGRES_HOST=postgres POSTGRES_PORT=5432 +POSTGRES_PORT_HOST=5432 PGUSER=postgres # POSTGRES_USER must match PGUSER — the postgres image uses this to create the superuser POSTGRES_USER=postgres diff --git a/src/db/init.sql b/src/db/init.sql index 33462ab..e07eb6d 100644 --- a/src/db/init.sql +++ b/src/db/init.sql @@ -1,10 +1,3 @@ -DO $$ -BEGIN - IF NOT EXISTS (SELECT FROM pg_database WHERE datname = 'eos') THEN - CREATE DATABASE eos; - END IF; -END $$; - -- Create serversettings table CREATE TABLE IF NOT EXISTS serversettings ( id SERIAL PRIMARY KEY, diff --git a/src/db/migration-entrypoint.sh b/src/db/migration-entrypoint.sh index 2f0bcea..4544723 100755 --- a/src/db/migration-entrypoint.sh +++ b/src/db/migration-entrypoint.sh @@ -2,7 +2,7 @@ set -e -until pg_isready -h "$POSTGRES_HOST" -U "$POSTGRES_USER" -d "$POSTGRES_DATABASE"; do +until pg_isready -h "$POSTGRES_HOST" -U "$POSTGRES_USER" -d "$POSTGRES_DB"; do sleep 1 done diff --git a/src/docker-compose.yml b/src/docker-compose.yml index 19312a3..e2b0212 100644 --- a/src/docker-compose.yml +++ b/src/docker-compose.yml @@ -60,7 +60,7 @@ services: retries: 5 start_period: 20s ports: - - "127.0.0.1:${POSTGRES_PORT}:5432" + - "127.0.0.1:${POSTGRES_PORT_HOST:-5432}:${POSTGRES_PORT}" networks: - eos restart: unless-stopped