Add pgadmin, clean up docker-compose

Restructured cocker-compose to be cleaner
This commit is contained in:
Elliot Matson 2022-07-29 14:09:45 -05:00 committed by GitHub
parent 402ecdc573
commit 8e9acfacc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,29 @@
--- ---
version: '3' version: '3.8'
x-common:
database: &db-environment
POSTGRES_DB: database
POSTGRES_USER: postgres
POSTGRES_PASSWORD: DaVinci
TZ: America/Chicago
POSTGRES_LOCATION: &db-location "???:/var/lib/postgresql/data"
backup: &backup-environment
SCHEDULE: "@daily"
BACKUP_KEEP_DAYS: 7
BACKUP_KEEP_WEEKS: 4
BACKUP_KEEP_MONTHS: 6
BACKUP_LOCATION: &bk-location "???:/backups"
admin: &admin-environment
PGADMIN_DEFAULT_EMAIL: admin@admin.com
PGADMIN_DEFAULT_PASSWORD: root
#PGADMIN_CONFIG_DEFAULT_SERVER: postgres
#
# ------------------------------------------------------------------------------------------
# DANGER ZONE BELOW
#
# The remainder of this file likely does not need to be changed. Please only make modifications
# below if you understand what you are doing.
#
services: services:
postgres: postgres:
image: postgres:13 image: postgres:13
@ -7,33 +31,27 @@ services:
ports: ports:
- "5432:5432" - "5432:5432"
environment: environment:
- POSTGRES_DB=database <<: [*db-environment]
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=DaVinci
- TZ=America/Chicago
volumes: volumes:
- "resolve-db:/var/lib/postgresql/data" - *db-location
pgbackups: pgbackups:
image: prodrigestivill/postgres-backup-local:13 image: prodrigestivill/postgres-backup-local:13
restart: always restart: always
volumes: volumes:
- "(location you want backups stored):/backups" - *bk-location
links: links:
- postgres - postgres
depends_on:
- postgres
environment: environment:
- POSTGRES_HOST=postgres <<: [*db-environment, *backup-environment]
- POSTGRES_DB=database POSTGRES_HOST: postgres
- POSTGRES_USER=postgres POSTGRES_EXTRA_OPTS: --blobs --format=custom --quote-all-identifiers
- POSTGRES_PASSWORD=DaVinci BACKUP_SUFFIX: .backup
- POSTGRES_EXTRA_OPTS=--blobs --format=custom --quote-all-identifiers HEALTHCHECK_PORT: 8080
- BACKUP_SUFFIX=.backup pgadmin:
- SCHEDULE=@daily container_name: pgadmin4_container
- BACKUP_KEEP_DAYS=7 image: dpage/pgadmin4
- BACKUP_KEEP_WEEKS=4 restart: always
- BACKUP_KEEP_MONTHS=6 environment:
- HEALTHCHECK_PORT=8080 <<: [*admin-environment]
- TZ=America/Chicago ports:
volumes: - "6969:80"
resolve-db: