Skip to content

Commit

Permalink
Fix database URI under docker-compose
Browse files Browse the repository at this point in the history
* Make the web service connect to the mongo service, not mLab
* Update readme to remove the "change config" step
* Import NODE_ENV into the web service so the appropriate config is used
  • Loading branch information
rcowsill committed Sep 25, 2020
1 parent 21d5740 commit d1d5657
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ npm run dev

The repo includes the Dockerfile and docker-compose.yml necessary to setup the app and the db instance then connect them together.

* Change the db config in `config/env/development.js` to point to the respective Docker container.
```
db: "mongodb://mongo:27017/nodegoat",
```
* Build the images:
```
docker-compose build
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ version: "3.7"
services:
web:
build: .
environment:
NODE_ENV:
MONGODB_URI: mongodb://mongo:27017/nodegoat
command: sh -c "until nc -z -w 2 mongo 27017 && echo 'mongo is ready for connections' && node artifacts/db-reset.js && npm start; do sleep 2; done"
ports:
- "4000:4000"
Expand Down

0 comments on commit d1d5657

Please sign in to comment.