Skip to content

Commit cd2e5a5

Browse files
Replacing example scripts with better docs in README.rst
1 parent 4a0752f commit cd2e5a5

File tree

3 files changed

+20
-86
lines changed

3 files changed

+20
-86
lines changed

README.rst

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,25 +148,40 @@ The backups are `mongorestore <https://docs.mongodb.com/manual/reference/program
148148
...
149149
$ mongorestore --host mongod12.example.com --port 27017 -u admin -p 123456 --oplogReplay --dir /var/lib/mongodb-consistent-backup/default/20170424_0000/rs0/dump
150150

151-
Run as Docker Container (Experimental)
151+
Run as Docker Container
152152
~~~~~~~~~~~~~~~~~~~~~~~
153153

154-
Note: you need to use persistent volumes to store backups and/or config files long-term when using Docker. Data in Docker containers is destroyed when the container is deleted. See `scripts/docker-persistent.sh <scripts/docker-persistent.sh>`__ and `scripts/docker-persistent.example.conf <scripts/docker-persistent.example.conf>`__ as an example/demo of how to implement persistence.
154+
To persist logs, configs and backup data 3 directories should be mapped to be inside the Docker containter.
155+
156+
The -v/--volume flags in the examples below map container paths to paths on your Docker host. The example below assumes there is a path on the Docker host named *'/data/mongobackup'* with *'data'*, *'conf'* and *'logs'* subdirectories mapped to inside the container. Replace any instance of *'/data/mongobackup'* below to a different path if necessary.
157+
158+
*Note: store a copy of your mongodb-consistent-backup.conf in the 'conf' directory and pass it's container path as the --config= flag if you wish to use config files.*
155159

156160
**Via Docker Hub**
157161

158162
::
159163

160-
$ docker run -i timvaillancourt/mongodb_consistent_backup <mongodb_consistent_backup-flags>
164+
$ mkdir -p /data/mongobackup/{conf,data,logs}
165+
$ cp -f /path/to/mongodb-consistent-backup.conf /data/mongobackup/conf
166+
$ docker run --rm -it \
167+
-v "/data/mongobackup/conf:/conf:Z" \
168+
-v "/data/mongobackup/data:/var/lib/mongodb-consistent-backup:Z" \
169+
-v "/data/mongobackup/logs:/var/log/mongodb-consistent-backup:Z" \
170+
timvaillancourt/mongodb_consistent_backup:latest --config=/conf/mongodb-consistent-backup.conf
161171

162172
**Build and Run Docker Image**
163173

164174
::
165175

166176
$ cd /path/to/mongodb_consistent_backup
167177
$ make docker
168-
$ docker run -t mongodb_consistent_backup <mongodb_consistent_backup-flags>
169-
178+
$ mkdir -p /data/mongobackup/{conf,data,logs}
179+
$ cp -f /path/to/mongodb-consistent-backup.conf /data/mongobackup/conf
180+
$ docker run --rm -it \
181+
-v "/data/mongobackup/conf:/conf:Z" \
182+
-v "/data/mongobackup/data:/var/lib/mongodb-consistent-backup:Z" \
183+
-v "/data/mongobackup/logs:/var/log/mongodb-consistent-backup:Z" \
184+
mongodb_consistent_backup --config=/conf/mongodb-consistent-backup.conf
170185

171186
ZBackup Archiving (Optional)
172187
~~~~~~~

scripts/docker-persistent.example.conf

Lines changed: 0 additions & 15 deletions
This file was deleted.

scripts/docker-persistent.sh

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)