Files
templates/blueprints/postgres-pgadmin/docker-compose.yml
T
9c784b723e feat: add postgres-pgadmin template (#1104)
* feat: add postgres-pgadmin template

* feat: expose postgres via second domain

Add postgres_domain variable and second [[config.domains]] for
postgres:5432 alongside pgadmin:80, so both the DB and the web UI
are reachable via Dokploy domains.

* fix(postgres-pgadmin): drop HTTP domain on postgres:5432, pre-register server in pgAdmin, bump pgAdmin to 9.17

- Remove the second [[config.domains]] pointing an HTTP host at postgres:5432 (Traefik returned 502).
- Mount servers.json + pgpass via config.mounts so pgAdmin comes with the bundled PostgreSQL pre-registered and connects without a password prompt (pgpass is copied to the data volume with 0600 for uid 5050).
- Bump dpage/pgadmin4 8.13 -> 9.17.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Mauricio Siu <mauricio@dokploy.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-24 20:34:46 -06:00

48 lines
1.4 KiB
YAML

version: "3.8"
services:
postgres:
image: postgres:18-alpine
restart: unless-stopped
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
volumes:
- postgres-data:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 20s
expose:
- "5432"
pgadmin:
image: dpage/pgadmin4:9.17
restart: unless-stopped
# pgpass must be 0600 and readable by the pgadmin user (uid 5050), so copy the
# mounted file into the data volume before starting pgAdmin.
entrypoint:
- /bin/sh
- -c
- cp /pgadmin4/pgpass /var/lib/pgadmin/pgpass && chmod 600 /var/lib/pgadmin/pgpass && exec /entrypoint.sh
environment:
- PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL}
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD}
- PGADMIN_CONFIG_SERVER_MODE=False
- PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED=False
- PGADMIN_SERVER_JSON_FILE=/pgadmin4/servers.json
volumes:
- pgadmin-data:/var/lib/pgadmin
- ../files/servers.json:/pgadmin4/servers.json:ro
- ../files/pgpass:/pgadmin4/pgpass:ro
depends_on:
postgres:
condition: service_healthy
volumes:
postgres-data:
pgadmin-data: