diff --git a/docker-tools/run.sh b/docker-tools/run.sh index 667efcb..963c0d8 100755 --- a/docker-tools/run.sh +++ b/docker-tools/run.sh @@ -6,7 +6,10 @@ fi cmd="$1" -if [ "${cmd}" = "--dump" ] ; then +if [ "${cmd}" = "--shell" ] ; then + echo "INFO: opening shell..." + mongo --host mongo eventman +elif [ "${cmd}" = "--dump" ] ; then echo "INFO: dumping..." mongodump --host mongo --out /tmp/ --db eventman || (echo "ERROR: unable to dump the database" ; exit 10) cd /tmp diff --git a/docker-tools/shell.sh b/docker-tools/shell.sh new file mode 100755 index 0000000..ba8cd67 --- /dev/null +++ b/docker-tools/shell.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +docker build -t eventman-dump-and-restore . +docker run -it --name eventman-shell --rm --network="eventman_default" -v `pwd`:/data --link=eventman_eventman-mongo_1:eventman-mongo eventman-dump-and-restore --shell diff --git a/docs/DOCKER.md b/docs/DOCKER.md index 777bcad..18a825e 100644 --- a/docs/DOCKER.md +++ b/docs/DOCKER.md @@ -8,6 +8,7 @@ The data is stored in the *eventman_data* volume: do not cancel it. In the *docker-tools* directory there is a set of tools to build and run another container to dump and restore the database; you need the docker-compose running, to execute them. From that directory you can: -* **dump.sh**: dump the current database in a file like *eventman-dump-2017-11-28T21:57:43.tgz* -* **restore.sh** *eventman-dump-2017-11-28T21:57:43.tgz*: restore the given dump. Notice that the current database is completely removed, so DO NOT restore a dump if you don't have a backup of the current data +- **dump.sh**: dump the current database in a file like *eventman-dump-2017-11-28T21:57:43.tgz* +- **restore.sh**: *eventman-dump-2017-11-28T21:57:43.tgz*: restore the given dump. Notice that the current database is completely removed, so DO NOT restore a dump if you don't have a backup of the current data +- **shell.sh**: open a shell for the database