Skip to content

Commit 7980fa5

Browse files
committed
fix: pin postgres image version; fix default db host in lando's compose.yml
The former fixes some issues when postgres 18 is used AFAICT; 17 is what is used in prod: https://github.com/mozilla-services/cloudops-infra/blob/master/projects/lando/tf/modules/postgres/variables.tf#L10-L12 Errors I was seeing were: ``` ~/repos/lando main ?1 ❯ make test х INT /usr/bin/docker compose run --rm lando lando tests WARN[0000] The "UID" variable is not set. Defaulting to a blank string. WARN[0000] The "GID" variable is not set. Defaulting to a blank string. [+] Creating 1/1 ✔ Container lando-redis-1 Running 0.0s [+] Running 1/1 ✔ Container lando-db-1 Started 0.2s dependency failed to start: container lando-db-1 exited (1) make: *** [Makefile:35: test] Error 1 ~/repos/lando main ?1 ❯ docker logs lando-db-1 Error: in 18+, these Docker images are configured to store database data in a format which is compatible with "pg_ctlcluster" (specifically, using major-version-specific directory names). This better reflects how PostgreSQL itself works, and how upgrades are to be performed. See also docker-library/postgres#1259 Counter to that, there appears to be PostgreSQL data in: /var/lib/postgresql/data (unused mount/volume) This is usually the result of upgrading the Docker image without upgrading the underlying database using "pg_upgrade" (which requires both versions). The suggested container configuration for 18+ is to place a single mount at /var/lib/postgresql which will then place PostgreSQL data in a subdirectory, allowing usage of "pg_upgrade --link" without mount point boundary issues. See docker-library/postgres#37 for a (long) discussion around this process, and suggestions for how to do so. ``` The latter fixes a bug that I presume nobody else is hitting because they've overriden the db hostname in `.env`. Setting it in Lando's compose.yml seems to have no downsides.
1 parent 56ede20 commit 7980fa5

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

compose.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
db:
3-
image: postgres
3+
image: postgres:17
44
environment:
55
POSTGRES_USER: postgres
66
POSTGRES_PASSWORD: postgres
@@ -29,6 +29,8 @@ services:
2929
- media:/files/
3030
env_file:
3131
- .env
32+
environment:
33+
DEFAULT_DB_HOST: db
3234
depends_on:
3335
db:
3436
condition: service_healthy

0 commit comments

Comments
 (0)