I have a side project using dokku, it works well. But then I want to dump the production data to local in order to test some cases. I thought it should be as simple as dump and restore, but I was wrong. It took me a while, I think write it down might help someone else or future me.
dokku mongo:export mongo_service_name > data.dump.gz
scp firstname.lastname@example.org:data.dump.gz ~/
mongorestore --host localhost:27017 --gzip --archive=data.dump.gz --db mongo_service_name
The tricky part is the name after
--db, should match the database name in your dump file.
That’s all. Hope it helps.
Thanks for reading!
Follow me (albertgao) on twitter, if you want to hear more about my interesting ideas.