Skip to content

Commit be4aae1

Browse files
committed
fix: pin postgres image version; fix default db host
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`.
1 parent 56ede20 commit be4aae1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compose.yaml

Lines changed: 1 addition & 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

src/lando/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
"NAME": os.getenv("DEFAULT_DB_NAME", "postgres"),
140140
"USER": os.getenv("DEFAULT_DB_USER", "postgres"),
141141
"PASSWORD": os.getenv("DEFAULT_DB_PASSWORD", "postgres"),
142-
"HOST": os.getenv("DEFAULT_DB_HOST", "lando.db"),
142+
"HOST": os.getenv("DEFAULT_DB_HOST", "db"),
143143
"PORT": os.getenv("DEFAULT_DB_PORT", "5432"),
144144
}
145145
}

0 commit comments

Comments
 (0)