Skip to content

Uploading Data to Heroku

dgorissen edited this page Sep 28, 2014 · 1 revision

New data dumps from the ministry must be imported into your local mongo instance and tested to ensure everything still works as expected. If all is good you can deploy to heroku which means updating the data in the heroku mongo instance as well.

The fastest way to do this is to take a binary dump of your local instance and import it into the remote mongo instance. You can do this as follows:

  1. Export your local database: mongodump -d <local database name> -o mongodump/
  2. Import into heroku: mongorestore --drop -h XXXX.mongolab.com:53158 -d heroku_appXXXXXXX -u heroku_appXXXXXXXX -p XXXXXXXXXXXXX mongodump/<local database name>

BEWARE: This will overwrite all existing data without warning!

Notes:

  • If you did not change your local database name you should put TaarifaAPI.
  • To find the correct host name (-h) and database name (-d) to use on import see the Tools tab of the MongoLab dashboard
  • The username (-u) and password (-p) to use can be found in the URI listed in the Taarifa Developer Google Doc.
  • If you get errors like Broken pipe 54.80.214.248:53158 assertion: 9001 socket exception [SEND_ERROR] switch to a more stable internet connection or simply import one collection at a time. Instead of specifying the directory on import, simply specify the collection bson file directly: mongodump/<local database name>/<collection>.bson
Clone this wiki locally