habitica
habitica copied to clipboard
Enable Mongo Replication Sets in Docker / Upgrade Mongo to 5.0.23 in Docker
Fixes #14349
Changes
- Enable mongo replication sets using docker compose command
- Initialize replication set using heartbeat and then use replication set status as heartbeat.
- Prevent server from starting until mongo is in a state stable for connections.
server:
build:
context: .
dockerfile: ./Dockerfile-Dev
command: ["npm", "start"]
depends_on:
mongo:
condition: service_healthy
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
UUID: Self-hosted