Skip to content

Commit

Permalink
Merge pull request #10 from ideafast/mongo
Browse files Browse the repository at this point in the history
Added MongoDB to middleware
  • Loading branch information
davidverweij authored Mar 18, 2021
2 parents ddac9b8 + d25daa3 commit 264ab58
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
35 changes: 35 additions & 0 deletions instances/middleware/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## MongoDB Authentication

Authentication is disabled in mongodb by default, and will need to be setup to access the db remotely. To do that:

1. Remove `command: [--auth]` from the `docker-compose.yml`.
2. Run `docker compose up -d` to see the changes.
3. Enter the docker container: `docker exec -it mongo bash`
4. Run `mongo` from the command line and create two users as follows:

```bash
use admin
db.createUser(
{
user: "ADMIN_USER",
pwd: "ROOT_PASSWORD",
roles:["root"]
}
);

use dtransfer
db.createUser(
{
user: "DT_USER",
pwd: "DT_PASSWORD",
roles:[
{
role: "readWrite",
db: "dtransfer"
}
]
}
);
```

**Note**: change `user` and `pwd` with desired secrets.
18 changes: 18 additions & 0 deletions instances/middleware/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ version: '3.8'
networks:
web:
external: true
database:
external: true

services:
consumer_live:
Expand Down Expand Up @@ -30,3 +32,19 @@ services:
- "traefik.http.routers.consumer_dev.rule=Host(`dev.api.wp3.ideafast.eu`)"
- "traefik.http.routers.consumer_dev.entrypoints=websecure"
- "traefik.http.routers.consumer_dev.tls.certresolver=leresolver"

mongodb:
container_name: mongo
image: mongo:4.4.3
command: [--auth]
networks:
- database
ports:
- 27017:27017
volumes:
- mongodb:/data/db
labels:
- "traefik.enable=true"

volumes:
mongodb:

0 comments on commit 264ab58

Please sign in to comment.