Skip to content

Commit

Permalink
Wait for mongodb
Browse files Browse the repository at this point in the history
  • Loading branch information
lostlevels committed Sep 5, 2023
1 parent 5ed3ec0 commit 253b804
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,16 @@ go_import_path: github.com/tidepool-org/platform

env:
global:
- MONGODB=5.3.2
- MONGODB=6.0.9

before_install:
- sudo apt-get remove -y mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
- wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-${MONGODB}.tgz -O /tmp/mongodb.tgz
- tar -xf /tmp/mongodb.tgz
- mkdir /tmp/data
- ${PWD}/mongodb-linux-x86_64-ubuntu2004-${MONGODB}/bin/mongod --replSet rs0 --dbpath /tmp/data --bind_ip 127.0.0.1 --logpath ${PWD}/mongod.log &> /dev/null &
# sleep for a few seconds so that mongod actually starts otherwise the mongo shell command we run below won't be able to connect to mongod.
- sleep 2
- ${PWD}/mongodb-linux-x86_64-ubuntu2004-${MONGODB}/bin/mongo --host 127.0.0.1 --port 27017 --eval 'rs.initiate()'
- until nc -z localhost 27017; do echo Waiting for MongoDB; sleep 1; done
- ${PWD}/mongodb-linux-x86_64-ubuntu2004-${MONGODB}/bin/mongo --host 127.0.0.1 --port 27017 --eval 'rs.initiate()'

addons:
artifacts:
Expand Down

0 comments on commit 253b804

Please sign in to comment.