working on db

This commit is contained in:
voje 2019-03-14 19:49:01 +01:00
parent 4e8447d930
commit c5ab988d50
3 changed files with 29 additions and 6 deletions

View File

@ -14,6 +14,9 @@ KRES_SRL_FOLDER = "$(MAKE_ROOT)/data/kres_srl"
OUTPUT = "file" OUTPUT = "file"
OUTDIR = "/home/voje/workdir/test_out" OUTDIR = "/home/voje/workdir/test_out"
DBADDR = "" DBADDR = ""
DB_ADM_USER = testuser
DB_ADM_PASS = testpass
export export
.PHONY: dev-env preflight .PHONY: dev-env preflight
@ -23,7 +26,7 @@ all:
# prereq (environment) # prereq (environment)
dev-env: dev-env:
cd dockerfiles; cd dev-env; $(MAKE) cd dockerfiles/dev-env; $(MAKE)
# run these inside dev-env container # run these inside dev-env container
data/samples: data/samples:
@ -35,3 +38,6 @@ preflight: data/samples
pip3 install -e src/pkg/corpusparser/. pip3 install -e src/pkg/corpusparser/.
python3 src/pkg/corpusparser/corpusparser/main.py --kres-folder $(KRES_FOLDER) \ python3 src/pkg/corpusparser/corpusparser/main.py --kres-folder $(KRES_FOLDER) \
--ssj-file $(SSJ_FILE) --kres-srl-folder $(KRES_SRL_FOLDER) --output $(OUTPUT) --outdir $(OUTDIR) --dbaddr $(DBADDR) --ssj-file $(SSJ_FILE) --kres-srl-folder $(KRES_SRL_FOLDER) --output $(OUTPUT) --outdir $(OUTDIR) --dbaddr $(DBADDR)
database:
cd dockerfiles/database; $(MAKE)

View 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"]})

View File

@ -1,4 +1,3 @@
# Use root/example as user/password credentials
version: '3.1' version: '3.1'
services: services:
@ -7,8 +6,8 @@ services:
image: mongo image: mongo
restart: always restart: always
environment: environment:
MONGO_INITDB_ROOT_USERNAME: root MONGO_INITDB_ROOT_USERNAME: ${DB_ADM_USER}
MONGO_INITDB_ROOT_PASSWORD: example MONGO_INITDB_ROOT_PASSWORD: ${DB_ADM_PASS}
mongo-express: mongo-express:
image: mongo-express image: mongo-express
@ -16,5 +15,5 @@ services:
ports: ports:
- 8081:8081 - 8081:8081
environment: environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: root ME_CONFIG_MONGODB_ADMINUSERNAME: ${DB_ADM_USER}
ME_CONFIG_MONGODB_ADMINPASSWORD: example ME_CONFIG_MONGODB_ADMINPASSWORD: ${DB_ADM_PASS}