-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.dev.yml
142 lines (135 loc) · 3.47 KB
/
docker-compose.dev.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
version: "0.1"
name: ${PROJECT}
services:
backend:
build:
context: .
dockerfile: Dockerfile
container_name: ${PROJECT}_backend
restart: always
ports:
- "0.0.0.0:8888:8888"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- network
env_file:
- .env.docker
security_opt:
- no-new-privileges:true
postgres: # Will become myapp_postgres
image: postgres:17
container_name: ${PROJECT}_postgres
restart: always
environment:
PGDATA: /var/lib/postgresql/data/pgdata
env_file:
- .env.docker
volumes:
- postgres_data:/var/lib/postgresql/data
# - ./docker/postgres:/docker-entrypoint-initdb.d/
ports:
- "0.0.0.0:5000:5432"
networks:
- network
# command: postgres -c config_file=/etc/postgresql/postgresql.conf
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U ${POSTGRES_USER:-rroot} -d ${POSTGRES_DB:-ruxlog}",
]
interval: 10s
timeout: 5s
retries: 5
security_opt:
- no-new-privileges:true
user: postgres
postgres_backup: # Will become myapp_backup
container_name: ${PROJECT}_postgres_backup
image: prodrigestivill/postgres-backup-local
restart: always
volumes:
- ./backups:/backups
environment:
- SCHEDULE=@daily
- BACKUP_KEEP_DAYS=7
- BACKUP_KEEP_WEEKS=4
- BACKUP_KEEP_MONTHS=6
env_file:
- .env.docker
networks:
- network
redis:
image: redis:7.4.1-alpine
container_name: ${PROJECT}_redis
restart: always
command: >
redis-server
--requirepass "${REDIS_PASSWORD:-red}"
--acl-pubsub-default allchannels
--aclfile /etc/redis/users.acl
volumes:
- redis_data:/data
- ./docker/redis/users.acl:/etc/redis/users.acl:ro # Changed path
networks:
- network
ports:
- "0.0.0.0:5001:6379"
env_file:
- .env.docker
healthcheck:
test:
[
"CMD",
"redis-cli",
"-u",
"redis://${REDIS_USER:-rred}:${REDIS_PASSWORD:-red}@localhost:6379",
"PING",
]
interval: 10s
timeout: 5s
retries: 5
security_opt:
- no-new-privileges:true
redis_backup:
image: offen/docker-volume-backup
container_name: ${PROJECT}_redis_backup
restart: always
user: root # Required to access the volumes
volumes:
# Volume to backup
- redis_data:/backup/redis:ro # Read-only access
# Where to store the backups
- ./backups/redis:/archive # Local backup storage
environment:
# Backup schedule
- BACKUP_CRON_EXPRESSION=0 0 * * * # Daily at midnight
# Backup retention
- BACKUP_RETENTION_DAYS=7 # Keep backups for 7 days
# Backup naming
- BACKUP_PREFIX=${PROJECT}_redis # Prefix for backup files
- BACKUP_SUFFIX=%Y-%m-%d-%H-%M # Date format suffix
# - BACKUP_COMPRESSION=GZIP # Use GZIP compression
# Notification on failure (optional)
- NOTIFICATION_LEVEL=warning
# Stop Redis before backup (optional but recommended)
# - BACKUP_STOP_CONTAINER=${PROJECT}_redis
networks:
- network
depends_on:
- redis
volumes:
postgres_data:
name: ${PROJECT}_postgres_data
driver: local
redis_data:
name: ${PROJECT}_redis_data
driver: local
networks:
network:
name: ${PROJECT}_network
driver: bridge