From 2b2052e2035bf30805db35a8baf61ae6a5583c91 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 28 Jun 2017 12:10:19 +0200 Subject: [PATCH] add some sample data and a script to save / restore it --- .gitlab-ci.yml | 1 + README.md | 5 +++-- VILLAS.archive | Bin 0 -> 1326 bytes docker-compose.yml | 2 ++ sample-data.sh | 25 +++++++++++++++++++++++++ 5 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 VILLAS.archive create mode 100755 sample-data.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 179e421..bc32ecc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,7 @@ image: docker:17 variables: GIT_SUBMODULE_STRATEGY: normal DOCKER_COMPOSE_VERSION: 1.13.0 + DOCKER_DRIVER: overlay services: - docker:dind diff --git a/README.md b/README.md index dceeb9e..793013d 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,13 @@ $ git clone --recursive git@git.rwth-aachen.de:VILLASframework/VILLASweb.git $ npm install $ npm build $ docker-compose up +$ ./sample-data.sh import ``` -To start the website locally run `npm start`. This will open a local webserver serving the _frontend_. To make the website work, you still need to start at least the VILLASweb-backend (See repository for information). - The default user and password are configured in the `config.js` file of the _backend_. By default they are: __admin__ / __admin__. +For development you can use `npm start` to spawn a local webserver. + ## Copyright 2017, Institute for Automation of Complex Power Systems, EONERC diff --git a/VILLAS.archive b/VILLAS.archive new file mode 100644 index 0000000000000000000000000000000000000000..0167f76ca8f8e1eca2bbe7fc582e8f9d130bf0ac GIT binary patch literal 1326 zcmV+}1=0E+iwFP!32ul0|FoA|Xk1kn$NzIO>GZ~z`D{=`l;IfgWthyFOnMm*8hg{y zn@Nb)qT|k--I?8-%Xls`xe#q1tO!N=VnNVKDIx_Q1by-S%4?X~upzkP6q0!UYEtKvHjwY+l0HVj(vm~FX80#F*% zahYw2hkQwUopO791AviSF*gduvuz_-PXTb`3tZ-g^l7m+^}?Y;V-rw9N7xF$ zWu|Ws=~pqSM|9#5oB*((+I6w6mKGMXDzkJtOI@{eVnJ=Fr9xJnp>t|!K`k>~EoqBc z)gmTUOZ>U4W>vmVl}>XJC+gy>i%7d{o(BNHmDLdk05q8E6NAm)NBP?NQpWvsg5Fyl zl&8aYsT1YvY zq5ab8+P8#tWXA&V%70QuwsT){K3W}c6M(v7pQ05niudyR;rlOXRYH{KC_|~ts|@@~5m)%Mc~HPd@ILNa4)bf#@q~ZGbE$)UeW40uIv@)+m26T#W+sP`bvjp zDUy>5;h}l`=hM6zf0Bo0Qx6eUT3P6A9Z9a<_ppiC~~yJ=2;EN*L0nTh^dZORw9^@wrTJ%qzQW&6wOnl#ht|?+R} zX-b7mu^LKtoYBE{v4j^hsXx)y-!r%r|MBfB-z`4%+0(+tvk&_tq?_{Vf%1trfBo{u zaSZ(M#s8J|Zv(NJ=q9tE)QRghZAS<9H&h@)`O%>%->lb081b~jlerxuW0Tt(M|b9& z;L-VbdviMv7R-a*V!Z literal 0 HcmV?d00001 diff --git a/docker-compose.yml b/docker-compose.yml index 9bc0d4a..d89820c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -38,6 +38,8 @@ services: user: mongodb volumes: - database:/data/db + expose: + - "27017" restart: always user: mongodb networks: diff --git a/sample-data.sh b/sample-data.sh new file mode 100755 index 0000000..b0e4aec --- /dev/null +++ b/sample-data.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +DIR=$(basename $(pwd)) + +ACTION=${1:-import} +CONTAINER=${2:-${DIR}_database_1} +NETWORK=${4:-${DIR}_villas} +DATABASE=${3:-VILLAS} + +DOCKEROPTS="--interactive --tty --rm --network ${NETWORK} --volume $(pwd):/tmp" + +case ${ACTION} in + import) + docker run ${DOCKEROPTS} mongo:latest bash -c 'mongorestore --verbose --host '${CONTAINER}' --gzip --archive=/tmp/'${DATABASE}'.archive' + ;; + + save) + docker run ${DOCKEROPTS} mongo:latest bash -c 'mongodump --verbose --host '${CONTAINER}' --db '${DATABASE}' --gzip --archive=/tmp/'${DATABASE}'.archive' + ;; + + *) + echo "Usage: $0 (import|save) [MONGODB_CONTAINER [DATABASE [NETWORK]]]" + ;; +esac +