Repository navigation
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
95 lines (90 loc) · 2.98 KB
/
Copy pathdocker-compose.test.yml
File metadata and controls
95 lines (90 loc) · 2.98 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
name: vizzy-studio-test
services:
mongo:
image: mongo:8-noble
command: ['mongod', '--replSet', 'rs0', '--bind_ip_all', '--port', '27017']
networks:
- vizzy_network
ports:
- '${MONGO_HOST_PORT:-37017}:27017'
volumes:
- mongo_data:/data/db
healthcheck:
test:
[
'CMD-SHELL',
'mongosh --quiet --host localhost:27017 --eval "db.adminCommand({ ping: 1 }).ok" | grep 1'
]
interval: 5s
timeout: 5s
retries: 20
mongo-init:
image: mongo:8-noble
depends_on:
mongo:
condition: service_healthy
restart: 'no'
networks:
- vizzy_network
entrypoint:
- sh
- -lc
- |
set -e
echo "[mongo-init] waiting for mongo..."
until mongosh --quiet --host mongo:27017 --eval "db.adminCommand({ ping: 1 }).ok" | grep 1 >/dev/null; do
sleep 1
done
echo "[mongo-init] ensuring replica set rs0..."
mongosh --quiet --host mongo:27017 --eval '
try {
const status = rs.status();
if (status.ok === 1) {
print("[mongo-init] replica set already initialized");
}
} catch (e) {
rs.initiate({
_id: "rs0",
members: [{ _id: 0, host: "mongo:27017" }]
});
print("[mongo-init] replica set initiated");
}
'
web:
build:
context: .
dockerfile: Dockerfile
depends_on:
mongo:
condition: service_started
mongo-init:
condition: service_completed_successfully
networks:
- vizzy_network
environment:
NODE_ENV: production
PORT: 3000
VITE_BASE_URL: http://localhost:${WEB_HOST_PORT:-3870}
SERVER_DATABASE_URL: mongodb://mongo:27017/vizzy?replicaSet=rs0&directConnection=true
SERVER_AUTH_SECRET: 00000000000000000000000000000000
SERVER_CONFIG_ENCRYPTION_KEY: local-dev-encryption-key
ALLOWED_HOSTS: http://localhost:${WEB_HOST_PORT:-3870}
TRUSTED_ORIGINS: http://localhost:${WEB_HOST_PORT:-3870}
APP_DATA_DIR: /app/data
ports:
- '${WEB_HOST_PORT:-3870}:3000'
volumes:
- app_data:/app/data
healthcheck:
test: ['CMD-SHELL', 'curl -fsS http://localhost:3000/ >/dev/null || exit 1']
interval: 10s
timeout: 5s
retries: 30
networks:
vizzy_network:
driver: bridge
driver_opts:
com.docker.network.driver.mtu: '1450'
volumes:
mongo_data:
app_data: