class Container::Backup::Mongo
Public Instance Methods
backup()
click to toggle source
docs.mongodb.com/database-tools/mongodump/#bin.mongodump docs.mongodb.com/database-tools/mongorestore/#bin.mongorestore
- "backup={volumes: [mongo_data],databases: [mongo: {user: ${MONGO_INITDB_ROOT_USERNAME}, password: ${MONGO_INITDB_ROOT_PASSWORD}}]}"
# File lib/container/steps/databases.rb, line 46 def backup # mongodump --host="mongodb0.example.com" --port=27017 [additional options] stop sh "docker run -it --rm --volumes-from #{container} #{image} bash -c 'mongodump -v --host=#{params['host'] || 'localhost'} --port=#{params['port'] || 27017} --out=/#{backup_path}'" start end
restore()
click to toggle source
# File lib/container/steps/databases.rb, line 52 def restore # mongorestore --username joe --password secret1 --host=mongodb0.example.com --port=27017 # docker run -it --rm --link mongo:mongo -v /tmp/mongodump:/tmp mongo bash -c 'mongorestore -v --host $MONGO_PORT_27017_TCP_ADDR:$MONGO_PORT_27017_TCP_PORT /tmp' stop sh "docker run -it --rm --volumes-from #{container} #{image} bash -c 'mongorestore -v --host=#{params['host'] || 'localhost'} --port=#{params['port'] || 27017} /#{backup_path}'" start end