forked from kristjan/cjvt-valency
working on db
This commit is contained in:
18
dockerfiles/database/Makefile
Normal file
18
dockerfiles/database/Makefile
Normal file
@@ -0,0 +1,18 @@
|
||||
# db names: nameDB
|
||||
# collection names: lower case, plural
|
||||
# user names?
|
||||
|
||||
# mongo admin -u root -p password --eval "db.getSiblingDB('vlDB').addUser('vluser', 'password')"
|
||||
|
||||
.PHONY: start_db
|
||||
|
||||
all: run_stack create_users
|
||||
|
||||
run_stack:
|
||||
docker stack deploy --compose-file mongo-stack.yml dbstack
|
||||
|
||||
create_users:
|
||||
docker exec -it mongo-container /bin/bash
|
||||
mongo -u root -p example
|
||||
use valDB
|
||||
db.createUser({user: "kristjan", pwd: "password", roles: ["readWrite"]})
|
||||
@@ -1,4 +1,3 @@
|
||||
# Use root/example as user/password credentials
|
||||
version: '3.1'
|
||||
|
||||
services:
|
||||
@@ -7,8 +6,8 @@ services:
|
||||
image: mongo
|
||||
restart: always
|
||||
environment:
|
||||
MONGO_INITDB_ROOT_USERNAME: root
|
||||
MONGO_INITDB_ROOT_PASSWORD: example
|
||||
MONGO_INITDB_ROOT_USERNAME: ${DB_ADM_USER}
|
||||
MONGO_INITDB_ROOT_PASSWORD: ${DB_ADM_PASS}
|
||||
|
||||
mongo-express:
|
||||
image: mongo-express
|
||||
@@ -16,5 +15,5 @@ services:
|
||||
ports:
|
||||
- 8081:8081
|
||||
environment:
|
||||
ME_CONFIG_MONGODB_ADMINUSERNAME: root
|
||||
ME_CONFIG_MONGODB_ADMINPASSWORD: example
|
||||
ME_CONFIG_MONGODB_ADMINUSERNAME: ${DB_ADM_USER}
|
||||
ME_CONFIG_MONGODB_ADMINPASSWORD: ${DB_ADM_PASS}
|
||||
|
||||
Reference in New Issue
Block a user