arunoda / meteor-up-legacy

Production Quality Meteor Deployments
MIT License
2.26k stars 395 forks source link

Cannot mount volume to mongodb docker container. #851

Open sferoze opened 8 years ago

sferoze commented 8 years ago

I can't figure out how to do use mongorestore on the docker container mupx creates. Please if you know how please post instructions.

I don't know why this is not laid out in the docs. What if you want to restore database to production using mupx?

Here is my issue. I have used scp to copy my mongodb dump folder to my server in the root directory.

Since mongodb is inside a docker container. I am trying to mount the folder to the docker container.

I searched online and found the command but it is not working. This is the command I am using:

docker run -v /memrey_dump_1_24_16:/mongobackup mongodb

this is copying the folder memrey_dump_1_24_16 to /mongobackup folder inside the docker container.

But when I run this command I get the error

Unable to find image 'mongodb:latest' locally
Pulling repository docker.io/library/mongodb
Error: image library/mongodb:latest not found

What can I do. Please help by posting instructions on how I can simply accomplish mongorestore to production with mupx.

sferoze commented 8 years ago

I figured out how to do it

Here are the instructions

1) Copy dump folder to server

scp -r /local_path/to/dump_folder root@111.222.33.4:/remote/path

2) SSH into server

ssh root@111.222.33.4

3) Copy from root of server to inside docker container

docker cp dump_folder mongodb:/dump_folder

4) Go into mongodb docker container

docker exec -it mongodb bash

5) check if copied folder exists

ls (you should see dump_folder, if you named it the same folder as in this example)

6) use mongorestore

mongorestore --drop -d AppName dump_folder

MasterJames commented 8 years ago

The folder mupx copies to is defined here /var/lib/mongodb
https://github.com/arunoda/meteor-up/blob/91e33a24dc26e306f5bf10c319a57211dfc832b1/templates/linux/mongodb.conf

Also this script is part of mupx setup that does the database setup install if requested true in settings file. https://github.com/arunoda/meteor-up/blob/mupx/scripts/linux/install-mongodb.sh I hope you find this useful. The mongo restore backup stuff for clarity for others reading is only available through my PR. There is changes to that Readme and the help stuff thats spit out when mupx is called in error.

MasterJames commented 8 years ago

Ah I see you posted that at the same time or before I could complete. Anyway well done and thanks for posting your steps.