Skip to content

Commit

Permalink
Issue HabitRPG#14349 - Fixed group creation on Docker by updating to …
Browse files Browse the repository at this point in the history
…Mongo 4.2.8 replica set.
  • Loading branch information
root committed Dec 25, 2022
1 parent 37d48b3 commit fd1bf33
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ services:
- .:/usr/src/habitica
- /usr/src/habitica/node_modules
mongo:
image: mongo:3.6
image: mongo:4.2.8
networks:
- habitica
ports:
- "27017:27017"
command: --replSet rs
volumes:
- ./docker-entrypoint-initdb.d/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
networks:
habitica:
driver: bridge
5 changes: 5 additions & 0 deletions docker-entrypoint-initdb.d/mongo-init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Wait for STARTUP and STARTUP2 state to end
while (rs.status().myState === 0 || rs.status().myState === 5) sleep(1000);

// Run rs.initiate() if not already PRIMARY.
rs.status().myState === 1 || rs.initiate();

0 comments on commit fd1bf33

Please sign in to comment.