-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.staging.yml
More file actions
180 lines (174 loc) · 4.54 KB
/
docker-compose.staging.yml
File metadata and controls
180 lines (174 loc) · 4.54 KB
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
services:
app:
build:
context: .
dockerfile: Dockerfile
args:
VERSION: ${DOCKER_IMAGE_TAG:-latest-staging}
image: ${DOCKER_USER:-brandishbot}/${DOCKER_IMAGE_NAME:-brandishbot}:${DOCKER_IMAGE_TAG:-latest-staging}
ports:
- '8081:8081'
env_file:
- .env
environment:
- DB_HOST=db
- ENVIRONMENT=staging
- PORT=8081
volumes:
- ./logs:/app/logs
- ./configs:/app/configs:ro
depends_on:
- db
restart: unless-stopped
networks:
- backend-staging
logging:
driver: 'json-file'
options:
max-size: '10m'
max-file: '3'
healthcheck:
test: ['CMD', 'wget', '--no-verbose', '--tries=1', '-O-', 'http://localhost:8081/healthz']
interval: 30s
timeout: 3s
start_period: 10s
retries: 3
deploy:
resources:
limits:
cpus: '1.0'
memory: 512M
reservations:
cpus: '0.25'
memory: 128M
discord:
build:
context: .
dockerfile: Dockerfile.discord
image: ${DOCKER_USER:-brandishbot}/${DOCKER_IMAGE_NAME:-brandishbot}-discord:${DOCKER_IMAGE_TAG:-latest-staging}
env_file:
- .env
environment:
- API_URL=http://app:8081
- ENVIRONMENT=staging
volumes:
- ./configs:/app/configs:ro
- ./logs/discord:/app/logs
# Mount MapRando presets
- ${MAPRANDO_PRESETS_DIR}:/app/maprando_presets:ro
# Mount media assets
- ./media:/app/media:ro
depends_on:
- app
restart: unless-stopped
networks:
- backend-staging
logging:
driver: 'json-file'
options:
max-size: '10m'
max-file: '3'
deploy:
resources:
limits:
cpus: '0.5'
memory: 256M
reservations:
cpus: '0.1'
memory: 64M
db:
image: postgres:15
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_NAME}
ports:
# Exposed for testing purposes in staging
- '5433:5432'
volumes:
- pgdata-staging:/var/lib/postgresql/data
networks:
- backend-staging
logging:
driver: 'json-file'
options:
max-size: '10m'
max-file: '3'
restart: unless-stopped
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U ${DB_USER} -d ${DB_NAME}']
interval: 10s
timeout: 5s
retries: 5
prometheus:
image: prom/prometheus:latest
ports:
# Staging uses alternate port to avoid conflicts
- '9091:9090'
volumes:
- ./configs/prometheus/prometheus.staging.yml:/etc/prometheus/prometheus.yml:ro
- ./configs/prometheus/alerts:/etc/prometheus/alerts:ro
- prometheus-data-staging:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--storage.tsdb.retention.time=7d'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
- '--web.enable-lifecycle'
depends_on:
- app
restart: unless-stopped
networks:
- backend-staging
logging:
driver: 'json-file'
options:
max-size: '10m'
max-file: '3'
healthcheck:
test:
['CMD', 'wget', '--no-verbose', '--tries=1', '--spider', 'http://localhost:9090/-/healthy']
interval: 30s
timeout: 3s
retries: 3
grafana:
image: grafana/grafana:latest
ports:
# Staging uses alternate port to avoid conflicts
- '3001:3000'
environment:
- GF_SECURITY_ADMIN_USER=${GRAFANA_ADMIN_USER:-admin}
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD:-admin}
- GF_SERVER_ROOT_URL=${GRAFANA_ROOT_URL:-http://localhost:3001}
- GF_INSTALL_PLUGINS=
volumes:
- ./configs/grafana/provisioning:/etc/grafana/provisioning:ro
- ./configs/grafana/dashboards:/etc/grafana/dashboards:ro
- grafana-data-staging:/var/lib/grafana
depends_on:
- prometheus
restart: unless-stopped
networks:
- backend-staging
logging:
driver: 'json-file'
options:
max-size: '10m'
max-file: '3'
healthcheck:
test:
['CMD', 'wget', '--no-verbose', '--tries=1', '--spider', 'http://localhost:3000/api/health']
interval: 30s
timeout: 3s
retries: 3
volumes:
pgdata-staging:
driver: local
prometheus-data-staging:
driver: local
grafana-data-staging:
driver: local
networks:
backend-staging:
driver: bridge