add shell command
This commit is contained in:
parent
f53924396e
commit
94ab4ed788
3 changed files with 11 additions and 3 deletions
|
@ -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
|
||||
|
|
4
docker-tools/shell.sh
Executable file
4
docker-tools/shell.sh
Executable file
|
@ -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
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue