78 lines
2.1 KiB
YAML
78 lines
2.1 KiB
YAML
---
|
|
version: "3.8"
|
|
|
|
services:
|
|
app:
|
|
image: postgres:18-alpine
|
|
networks:
|
|
- proxy
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
secrets:
|
|
- pg_root_password
|
|
- pg_adm_password
|
|
environment:
|
|
TZ: ${TZ:-UTC}
|
|
POSTGRES_USER: root
|
|
POSTGRES_PASSWORD_FILE: /run/secrets/pg_root_password
|
|
POSTGRES_DB: ${POSTGRES_DB:-postgres}
|
|
ADM_USERNAME: adm
|
|
ADM_PASSWORD_FILE: /run/secrets/pg_adm_password
|
|
PGSSLMODE: ${PGSSLMODE:-require}
|
|
configs:
|
|
- source: postgresql_conf
|
|
target: /etc/postgresql/postgresql.conf
|
|
mode: 0644
|
|
- source: pg_hba_conf
|
|
target: /etc/postgresql/pg_hba.conf
|
|
mode: 0644
|
|
- source: init_adm
|
|
target: /docker-entrypoint-initdb.d/001-init-adm.sh
|
|
mode: 0555
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U root -d ${POSTGRES_DB:-postgres}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
start_period: 30s
|
|
deploy:
|
|
restart_policy:
|
|
condition: on-failure
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.docker.network=proxy"
|
|
- "traefik.tcp.routers.${STACK_NAME}.entrypoints=${PG_TCP_ENTRYPOINT}"
|
|
- "traefik.tcp.routers.${STACK_NAME}.rule=HostSNI(`*`)"
|
|
- "traefik.tcp.routers.${STACK_NAME}.service=${STACK_NAME}"
|
|
- "traefik.tcp.services.${STACK_NAME}.loadbalancer.server.port=${PG_PORT}"
|
|
- "backupbot.backup=true"
|
|
- "backupbot.backup.path=/var/lib/postgresql/data/"
|
|
- "coop-cloud.${STACK_NAME}.app.version=postgres:18-alpine"
|
|
|
|
networks:
|
|
proxy:
|
|
external: true
|
|
|
|
volumes:
|
|
pgdata:
|
|
|
|
secrets:
|
|
pg_root_password:
|
|
external: true
|
|
name: ${STACK_NAME}_pg_root_password_${SECRET_PG_ROOT_PASSWORD_VERSION}
|
|
pg_adm_password:
|
|
external: true
|
|
name: ${STACK_NAME}_pg_adm_password_${SECRET_PG_ADM_PASSWORD_VERSION}
|
|
|
|
configs:
|
|
postgresql_conf:
|
|
name: ${STACK_NAME}_postgresql_conf_${POSTGRESQL_CONF_VERSION:-v1}
|
|
file: postgresql.conf
|
|
pg_hba_conf:
|
|
name: ${STACK_NAME}_pg_hba_conf_${PG_HBA_CONF_VERSION:-v1}
|
|
file: pg_hba.conf
|
|
init_adm:
|
|
name: ${STACK_NAME}_init_adm_${INIT_ADM_VERSION:-v1}
|
|
file: init-adm.sh
|
|
|