Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
160 lines (140 loc) · 4.04 KB
/
Copy pathdocker-compose.yml
File metadata and controls
160 lines (140 loc) · 4.04 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
services:
frontend:
env_file: .env
container_name: frontend
image: ghcr.io/member-counter/frontend:beta
restart: always
networks:
- member-counter
backend:
env_file: .env
container_name: backend
image: ghcr.io/member-counter/backend:beta
restart: always
healthcheck:
test: curl -f http://localhost:8080/health || exit 1
interval: 1m
timeout: 10s
retries: 30
start_period: 20s
networks:
- member-counter
website:
env_file: .env
container_name: website
image: nginx:latest
restart: always
ports:
- "3000:80"
configs:
- source: nginx.conf
target: /etc/nginx/nginx.conf
networks:
- member-counter
bot:
env_file: .env
container_name: bot
image: ghcr.io/member-counter/bot:beta
restart: always
networks:
- member-counter
# Coordinates the Discord REST budget of bot processes sharing one token;
# enable it (replicas: 1) on servers running multiple processes of the same
# bot and set DISCORD_BOT_INSTANCE_REST_PROXY_URL=http://rest-proxy:8765/api
rest-proxy:
env_file: .env
image: ghcr.io/member-counter/rest-proxy:beta
restart: always
deploy:
replicas: 0
networks:
- member-counter
db-utils:
env_file: .env
image: ghcr.io/member-counter/db-utils:beta
restart: always
deploy:
replicas: 0
networks:
- member-counter
mongo:
image: mongo:7
container_name: MongoDB
command: ["--replSet", "rs0", "--bind_ip_all", "--port", "27017"]
healthcheck:
test: echo 'db.runCommand({serverStatus:1}).ok' | mongosh --quiet | grep 1
interval: 5s
timeout: 10s
retries: 30
start_period: 20s
volumes:
- ./storage/db:/data/db
restart: unless-stopped
networks:
- member-counter
setup-mongo-rs:
image: mongo:7
container_name: Setup-MongoDB-ReplicaSet
command: 'mongosh mongodb://mongo:27017/memberCounter --eval=''rs.initiate({ _id: "rs0", members: [{_id: 0, host:"mongo:27017"}] }).ok'' --quiet | grep 1'
depends_on:
mongo:
condition: service_healthy
restart: true
restart: "no"
networks:
- member-counter
redis:
image: redis
command: redis-server
container_name: Redis
restart: unless-stopped
networks:
- member-counter
configs:
nginx.conf:
content: |
worker_processes 1;
events { worker_connections 1024; }
http {
upstream backend-upstream {
server backend:8080;
}
upstream frontend-upstream {
server frontend:80;
}
# Only send "Connection: upgrade" on actual websocket upgrades
map $$http_upgrade $$connection_upgrade {
default upgrade;
'' "";
}
gzip on;
gzip_types application/json;
gzip_proxied any;
gzip_min_length 1000;
gzip_vary on;
server {
listen 80;
server_name _;
location /api/ {
rewrite ^/api/(.*)$$ /$$1 break;
proxy_pass http://backend-upstream;
proxy_http_version 1.1;
proxy_set_header Host $$http_host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $$scheme;
proxy_set_header X-Forwarded-Host $$http_host;
proxy_set_header X-Forwarded-Port $$server_port;
proxy_set_header Upgrade $$http_upgrade;
proxy_set_header Connection $$connection_upgrade;
}
location / {
proxy_pass http://frontend-upstream;
proxy_http_version 1.1;
proxy_set_header Upgrade $$http_upgrade;
proxy_set_header Connection $$connection_upgrade;
}
}
}
networks:
member-counter: