-
Notifications
You must be signed in to change notification settings - Fork 4
/
docker-compose.example.yml
81 lines (78 loc) · 2.54 KB
/
docker-compose.example.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
version: '3.7'
services:
timescale:
image: timescale/timescaledb-ha:pg13.8-ts2.8.1-latest
volumes:
- type: volume
source: timescale-db # the volume name
target: /var/lib/postgresql/data # the location in the container where the data are stored
read_only: false
# Custom postgresql.conf file will be mounted (see command: as well)
- type: bind
source: ./postgresql_custom.conf
target: /postgresql_custom.conf
read_only: false
env_file: .env
environment:
POSTGRES_HOST: timescale
command: ["-c", "config_file=/postgresql_custom.conf"]
ports:
- 0.0.0.0:5432:5432
networks:
traefik-public:
healthcheck:
# Periodically check if PostgreSQL is ready, for Docker status reporting
test: ["ping", "-c", "1", "timescale"]
interval: 60s
timeout: 5s
retries: 5
deploy:
placement:
constraints:
# Since this is for the stateful database,
# only run it on the swarm manager, not on workers
- "node.role==manager"
restart_policy:
condition: on-failure
backup:
# If you're using PostgreSQL 14, choose 14 as the tag instead of 13
image: mccarthysean/timescaledb_backup_s3:13-1.0.10
env_file: .env
environment:
# cron-schedule this backup job to backup and upload to AWS S3 every so often
# * * * * * command(s)
# - - - - -
# | | | | |
# | | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
# | | | ------- Month (1 - 12)
# | | --------- Day of month (1 - 31)
# | ----------- Hour (0 - 23)
# ------------- Minute (0 - 59)
SCHEDULE: '0 7 * * *'
# The AWS S3 bucket to which the backup file should be uploaded
S3_BUCKET: backup-timescaledb
# S3_PREFIX creates a sub-folder in the above AWS S3 bucket
S3_PREFIX: daily-backups
networks:
traefik-public:
healthcheck:
# Periodically check if PostgreSQL is ready in the other container,
# for Docker status reporting. If we can't reach it, we can't back it up.
test: ["ping", "-c", "1", "timescale"]
interval: 60s
timeout: 5s
retries: 5
deploy:
placement:
constraints:
# Since this is for the stateful database,
# only run it on the swarm manager, not on workers
- "node.role==manager"
restart_policy:
condition: on-failure
# Creates a named volume to persist the TimescaleDB data
volumes:
timescale-db:
networks:
traefik-public:
external: true