-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
164 lines (158 loc) · 4.07 KB
/
docker-compose.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
services:
backend:
build:
context: ./backend
dockerfile: Dockerfile
ports:
- "3000:3000"
volumes:
- ./backend:/usr/src/app
- shared-temp:/app/temp
depends_on:
valkey-cluster:
condition: service_healthy
valkey-standalone:
condition: service_healthy
docker-executor:
condition: service_healthy
networks:
valkey-net:
aliases:
- backend-service
env_file:
- ./backend/.env
environment:
- VALKEY_STANDALONE_HOST=valkey-standalone
- VALKEY_STANDALONE_PORT=6379
- VALKEY_CLUSTER_HOST=valkey-cluster
- VALKEY_CLUSTER_PORT=7000
- WDS_SOCKET_PORT=443
- START_SCRIPT=${START_SCRIPT}
- LOGGING_ENABLED=${LOGGING_ENABLED}
- EXECUTOR_SERVICE_URL=http://docker-executor:3001
stop_grace_period: 30s
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 5s
timeout: 3s
retries: 10
start_period: 10s
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
target: ${NODE_ENV:-development}
ports:
- "8080:8080"
volumes:
- ./frontend:/usr/src/app:delegated
- /usr/src/app/node_modules
depends_on:
backend:
condition: service_healthy
networks:
- valkey-net
environment:
- VITE_WS_URL=ws://localhost:3000/appws
- NODE_ENV=${NODE_ENV:-development}
- CHOKIDAR_USEPOLLING=true
command: npm run ${START_SCRIPT:-serve}
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8080"]
interval: 10s
timeout: 5s
retries: 3
start_period: 15s
valkey-standalone:
image: valkey/valkey:8.0.1
container_name: valkey-standalone
ports:
- "6379:6379"
networks:
- valkey-net
volumes:
- valkey-standalone-data:/data
command: ["sh", "-c", "valkey-server --port 6379 --dir /data"]
healthcheck:
test: ["CMD", "valkey-cli", "-p", "6379", "ping"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
privileged: true
valkey-cluster:
image: valkey/valkey:8.0.1
ports:
- "7000-7005:7000-7005"
networks:
valkey-net:
aliases:
- valkey-cluster
volumes:
- ./backend/cluster-setup.sh:/usr/local/bin/cluster-setup.sh:ro
- valkey-cluster-data:/data
command: ["sh", "/usr/local/bin/cluster-setup.sh"]
healthcheck:
test: |
/bin/sh -c '[ "$$(valkey-cli -h valkey-cluster -p 7000 cluster info 2>/dev/null | grep -c "cluster_state:ok")" = "1" ]'
interval: 5s
timeout: 3s
retries: 30
start_period: 30s
privileged: true
cap_add:
- IPC_LOCK
ulimits:
memlock: -1
environment:
- VALKEY_CLUSTER_ANNOUNCE_IP=valkey-cluster
- CLUSTER_ANNOUNCE_IP=valkey-cluster
- INITIAL_PORT=7000
- SKIP_SYSCTL=1
restart: unless-stopped
stop_grace_period: 30s
docker-executor:
build:
context: ./backend/executor
dockerfile: Dockerfile
container_name: docker-executor
volumes:
- shared-temp:/app/temp:rw
- ./backend/executor/src:/usr/src/app/src:ro
- executor-modules:/app/temp/node_modules
ports:
- "3001:3001"
environment:
- PYTHONUNBUFFERED=1
- NODE_ENV=development
- VALKEY_CLUSTER_HOST=valkey-cluster
- VALKEY_CLUSTER_PORT=7000
- VALKEY_STANDALONE_HOST=valkey-standalone
- VALKEY_STANDALONE_PORT=6379
depends_on:
valkey-cluster:
condition: service_healthy
valkey-standalone:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001/health"]
interval: 5s
timeout: 3s
retries: 3
restart: unless-stopped
init: true
networks:
valkey-net:
aliases:
- docker-executor
networks:
valkey-net:
driver: bridge
volumes:
valkey-standalone-data:
valkey-cluster-data:
shared-temp:
driver: local
executor-modules:
driver: local