From b67686f2b9bb9d24478fc4b673276880d15f499d Mon Sep 17 00:00:00 2001 From: Christopher Small Date: Mon, 4 Dec 2023 16:02:37 +1000 Subject: [PATCH] fix bug with running on custom postgres port The ability to override is important for dev machines which already have postgres running locally/natively on the host machine. An earlier attempt was made to fix this, but failed because the `ports` mapping in the dev overlay file does not change the port the other containers use to access the container, just how the port is exposed to the host system (for utility connection, etc). The fix so that everything internal and external all uses the same port involves setting the `PGPORT` setting, so that the postgres container actually uses this port internally, and the `expose` declaration, which ensures that this port is then exposed to the rest of the network. --- docker-compose.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 4382451795..6cd5f333a6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -72,11 +72,14 @@ services: - POSTGRES_DB=${POSTGRES_DB:?error} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?error} - POSTGRES_USER=${POSTGRES_USER:?error} + - PGPORT=${POSTGRES_PORT:-5432} networks: - "polis-net" volumes: - "backups:/backups" - "postgres:/var/lib/postgresql/data" + expose: + - ${POSTGRES_PORT:-5432} nginx-proxy: image: docker.io/compdem/polis-nginx-proxy:${TAG:-dev}