# For development only # Set MONGODB_URL=mongodb://localhost:27017 in .env.local to use this container services: mongo: image: mongo:8 hostname: mongodb ports: - ${LOCAL_MONGO_PORT:-27017}:27017 command: --replSet rs0 --bind_ip_all #--setParameter notablescan=1 mem_limit: "5g" mem_reservation: "3g" healthcheck: # need to specify the hostname here because the default is the container name, and we run the app outside of docker test: test $$(mongosh --quiet --eval 'try {rs.status().ok} catch(e) {rs.initiate({_id:"rs0",members:[{_id:0,host:"127.0.0.1:${LOCAL_MONGO_PORT:-27017}"}]}).ok}') -eq 1 interval: 5s volumes: - mongodb-data:/data/db restart: always volumes: mongodb-data: