-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
96 lines (95 loc) · 2.59 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---
version: '3.8'
x-common:
database: &db-environment
POSTGRES_DB: database
POSTGRES_USER: &pg-user postgres
POSTGRES_PASSWORD: DaVinci
TZ: America/Chicago
POSTGRES_LOCATION: &db-location "~/db:/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:/backups"
admin: &admin-environment
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: root
PGADMIN_PORT: &pgadmin-port "3001:80"
#
# ------------------------------------------------------------------------------------------
# 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:
postgres:
container_name: resolve_pgsql
image: postgres:13
restart: always
ports:
- "5432:5432"
environment:
<<: [*db-environment]
volumes:
- *db-location
healthcheck:
test: ["CMD", "pg_isready", "-U", *pg-user]
interval: 10s
timeout: 5s
retries: 5
pgbackups:
container_name: resolve_pgbackup
image: prodrigestivill/postgres-backup-local:13
restart: always
volumes:
- *bk-location
depends_on:
- postgres
environment:
<<: [*db-environment, *backup-environment]
POSTGRES_HOST: postgres
POSTGRES_EXTRA_OPTS: --blobs --format=custom --quote-all-identifiers
BACKUP_SUFFIX: .backup
HEALTHCHECK_PORT: 8080
healthcheck:
interval: 30s
pgadmin:
container_name: resolve_pgadmin
image: dpage/pgadmin4
restart: always
environment:
<<: [*admin-environment]
ports:
- *pgadmin-port
volumes:
- pgadmin-config:/pgadmin4-config
- pgadmin:/var/lib/pgadmin
- *bk-location
entrypoint: "/bin/sh"
command:
- -c
- |
mkdir -p /var/lib/pgadmin/storage/$${PGADMIN_DEFAULT_EMAIL//@/_}/
ln -s /backups /var/lib/pgadmin/storage/$${PGADMIN_DEFAULT_EMAIL//@/_}/
/entrypoint.sh
depends_on:
- postgres
- pgadmin-config
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost/ || exit 1"]
pgadmin-config:
container_name: resolve_pgadmin-config-creator
image: ghcr.io/elliotmatson/pgadmin-config-creator:latest
restart: on-failure
environment:
<<: [*db-environment]
PGADMIN_SERVER_JSON_FILE: /pgadmin4-config/servers.json
volumes:
- pgadmin-config:/config
volumes:
pgadmin-config:
pgadmin: