mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-10-26 10:42:52 +01:00
- Enable docker replication sets using command - Initialize replication set using heartbeat and then use replication set status as heartbeat. - Prevent client from starting until mongo is in a state stable for connections.
54 lines
1.2 KiB
YAML
54 lines
1.2 KiB
YAML
services:
|
|
client:
|
|
build:
|
|
context: .
|
|
dockerfile: ./Dockerfile-Dev
|
|
command: ["npm", "run", "client:dev"]
|
|
depends_on:
|
|
- server
|
|
environment:
|
|
- BASE_URL=http://server:3000
|
|
networks:
|
|
- habitica
|
|
ports:
|
|
- "8080:8080"
|
|
volumes:
|
|
- .:/usr/src/habitica
|
|
- /usr/src/habitica/node_modules
|
|
- /usr/src/habitica/website/client/node_modules
|
|
server:
|
|
build:
|
|
context: .
|
|
dockerfile: ./Dockerfile-Dev
|
|
command: ["npm", "start"]
|
|
depends_on:
|
|
mongo:
|
|
condition: service_healthy
|
|
environment:
|
|
- NODE_DB_URI=mongodb://mongo/habitrpg
|
|
networks:
|
|
- habitica
|
|
ports:
|
|
- "3000:3000"
|
|
volumes:
|
|
- .:/usr/src/habitica
|
|
- /usr/src/habitica/node_modules
|
|
mongo:
|
|
image: mongo:5.0.23
|
|
restart: unless-stopped
|
|
command: ["--replSet", "rs", "--bind_ip_all", "--port", "27017"]
|
|
healthcheck:
|
|
test: echo "try { rs.status() } catch (err) { rs.initiate() }" | mongosh --port 27017 --quiet
|
|
interval: 10s
|
|
timeout: 30s
|
|
start_period: 0s
|
|
start_interval: 1s
|
|
retries: 30
|
|
networks:
|
|
- habitica
|
|
ports:
|
|
- "27017:27017"
|
|
networks:
|
|
habitica:
|
|
driver: bridge
|