Add compose.yml for local dev/test Postgres

0f5a3d2 · gmorell · 2026-06-23 20:48

1 files +35 -0
Message
{commit_body(@commit)}

Files changed

added compose.yml
+35 −0
@@ -0,0 +1,35 @@
1 +# Local dev/test Postgres for FeedPug. Matches config/dev.exs + config/test.exs
2 +# (user/pass postgres, database feed_pug_dev; the feed_pug_test DB is created by
3 +# `mix test`). Prod runs StackGres Postgres 16 — see ../argo-01-bos/feedpug/pg.yml.
4 +#
5 +# podman compose up -d # or: docker compose up -d
6 +# mix ecto.setup # create + migrate + seed
7 +#
8 +# 5432 is frequently taken by another project's container on this host. The
9 +# dev/test config reads $DB_PORT (default 5432), so override BOTH together to
10 +# keep Compose and mix on the same port:
11 +#
12 +# DB_PORT=5433 podman compose up -d && DB_PORT=5433 mix test
13 +services:
14 + pg:
15 + # Pinned to 16 to match prod (StackGres pg16). The classic data mount below
16 + # is correct for 16; pg18's image moved PGDATA under /var/lib/postgresql.
17 + image: docker.io/postgres:16-alpine
18 + container_name: feedpug-pg
19 + restart: unless-stopped
20 + environment:
21 + POSTGRES_USER: postgres
22 + POSTGRES_PASSWORD: postgres
23 + POSTGRES_DB: feed_pug_dev
24 + ports:
25 + - "127.0.0.1:${DB_PORT:-5432}:5432"
26 + volumes:
27 + - pgdata:/var/lib/postgresql/data
28 + healthcheck:
29 + test: ["CMD", "pg_isready", "-U", "postgres"]
30 + interval: 5s
31 + timeout: 3s
32 + retries: 5
33 +
34 +volumes:
35 + pgdata:

Parents: c08c3a4