1
0
mirror of https://github.com/spacebarchat/spacebarchat.git synced 2024-09-19 17:01:47 +02:00

Docker: First successfull dockerization

This commit is contained in:
Diego Magdaleno 2021-05-10 10:52:17 -05:00
parent cd844fef2a
commit e4d760ad85
2 changed files with 20 additions and 2 deletions

View File

@ -1 +1 @@
MONGO_URL=mongodb://mongo:27017/fosscord?readPreference=secondaryPreferred
MONGO_URL=mongodb://mongo:27017/fosscord?readPreference=secondaryPreferred?replicaSet=rs0

View File

@ -15,6 +15,9 @@ services:
build: api
ports:
- "3001:3001"
links:
- mongo
env_file: ./.docker/env
mongo:
container_name: mongo
image: mongo
@ -23,4 +26,19 @@ services:
- ./.docker/mongodb/mongod.conf:/etc/mongod.conf
ports:
- "27017:27017"
command: ["-f", "/etc/mongod.conf"]
command: mongod --replSet rs0
mongo-init-replica:
image: mongo
command: >
bash -c
"for i in `seq 1 30`; do
mongo mongo/fosscord --eval \"
rs.initiate({
_id: 'rs0',
members: [ { _id: 0, host: 'localhost:27017' } ]})\" &&
s=$$? && break || s=$$?;
echo \"Tried $$i times. Waiting 5 secs...\";
sleep 5;
done; (exit $$s)"
links:
- mongo