Skip to content

Commit 674de0a

Browse files
authored
Merge pull request #516 from osvaldoabel/main
add support do MongoDB as a templates
2 parents bc26afe + cd177bc commit 674de0a

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

recipes/mongodb.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
title: "Mongodb"
2+
3+
actions:
4+
- merge: database/mongodb.yml
5+
dst: docker-compose.yml
6+
- merge: scripts/mongodb.yml
7+
dst: kool.yml

recipes/pick-db.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@ actions:
1414
- name: 'PostgreSQL 13.0'
1515
actions:
1616
- recipe: postgresql-13
17+
- name: 'Mongodb'
18+
actions:
19+
- recipe: mongodb
1720
- name: 'None - do not use a database'

templates/database/mongodb.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
services:
2+
mongodb:
3+
image: mongodb/mongodb-community-server:latest
4+
ports:
5+
- "${KOOL_DATABASE_PORT:-27017}:27017"
6+
environment:
7+
MONGODB_INITDB_ROOT_USERNAME: "${DB_USERNAME-root}"
8+
MONGODB_INITDB_ROOT_PASSWORD: "${DB_PASSWORD-root}"
9+
MONGO_INITDB_DATABASE: "${DB_DATABASE-database}"
10+
healthcheck:
11+
test: ["CMD", "mongo", "--eval", "db.adminCommand('ping')"]
12+
13+
volumes:
14+
- database:/data/db:delegated
15+
networks:
16+
- kool_local
17+
- kool_global

templates/scripts/mongodb.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
scripts:
2+
# CLI access to MongoDB
3+
mongodb: kool exec database mongosh --port=27017 --username=root --password=root

0 commit comments

Comments
 (0)