-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
137 lines (128 loc) · 3.87 KB
/
Copy pathdocker-compose.yml
File metadata and controls
137 lines (128 loc) · 3.87 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
services:
client:
image: reviewguessr-client
env_file:
- .env
ports:
- "${CLIENT_PORT:-3001}:80"
depends_on:
- server
networks:
- proxy
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:80 || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
deploy:
resources:
limits:
cpus: '0.50'
memory: 512M
labels:
- "traefik.enable=true"
- "traefik.http.routers.client.rule=Host(`yourdomain.com`)"
- "traefik.http.routers.client.entrypoints=websecure"
- "traefik.http.routers.client.tls.certresolver=myresolver"
- "traefik.http.services.client.loadbalancer.server.port=80"
server:
image: reviewguessr-server
env_file:
- .env
networks:
- proxy
depends_on:
- redis
ports:
- "3000:3000" # remove once Traefik is set up
healthcheck:
test: ["CMD-SHELL", "nc -z localhost 3000 || exit 1"]
interval: 30s
timeout: 10s
retries: 3
deploy:
replicas: 1
resources:
limits:
cpus: '0.50'
memory: 512M
labels:
- "traefik.enable=true"
- "traefik.http.routers.server.rule=Host(`api.yourdomain.com`)"
- "traefik.http.routers.server.entrypoints=websecure"
- "traefik.http.routers.server.tls.certresolver=myresolver"
- "traefik.http.services.server.loadbalancer.server.port=3000"
- "traefik.http.services.server.loadbalancer.sticky.cookie=true"
# traefik:
# image: traefik:latest
# command:
# # Enable dashboard
# - "--api.dashboard=true"
# - "--api.insecure=false"
# # Enable Docker provider
# - "--providers.docker=true"
# - "--providers.docker.exposedbydefault=false"
# # Define entrypoints (HTTP and HTTPS)
# - "--entrypoints.web.address=:80"
# - "--entrypoints.websecure.address=:443"
# # Redirect HTTP to HTTPS
# - "--entrypoints.web.http.redirections.entrypoint.to=websecure"
# - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
# # Let's Encrypt resolver (myresolver)
# - "--certificatesresolvers.myresolver.acme.httpchallenge=true"
# - "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
# - "--certificatesresolvers.myresolver.acme.email=you@example.com"
# - "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
# ports:
# - "80:80"
# - "443:443"
# networks:
# - proxy
# volumes:
# - /var/run/docker.sock:/var/run/docker.sock:ro
# - traefik-certificates:/letsencrypt
# deploy:
# placement:
# constraints:
# - node.role == manager
redis:
image: redis:7
ports:
- "6379:6379"
restart: unless-stopped
networks:
- proxy
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
deploy:
resources:
limits:
cpus: '0.50'
memory: 512M
maintenance:
image: nginx:alpine
volumes:
- ./maintenance.html:/usr/share/nginx/html/index.html
networks:
- proxy
# deploy:
# labels:
# - "traefik.enable=true"
# - "traefik.http.routers.client.rule=Host(`yourdomain.com`)"
# - "traefik.http.routers.client.entrypoints=websecure"
# - "traefik.http.routers.client.tls.certresolver=myresolver"
# - "traefik.http.services.client.loadbalancer.server.port=80"
networks:
proxy:
external: true
volumes:
traefik-certificates:
# Note:
# - Use 'docker stack deploy -c docker-compose.yml ReviewGuessr' for Swarm.
# - Traefik must be on the 'proxy' network and route traffic to the 'server' service.
# - Add Traefik labels to 'server' for proper routing and sticky sessions.