How to upload database to meteor.com

If you want to upload your local db to replay.meteor.com(replace replay.meteor.com with yourapp.meteor.com), follow the following steps:

Step 1, create 3 scripts file: export.sh, showdb.sh, restore.sh

For export.sh, write:

mongodump -h 127.0.0.1:82 -d meteor -o meteor
#port is 82 because I am running the local meteor at 80
#port should be your local port + 2, so the default would be 3000+2 = 3002

For showdb.sh, write:

meteor mongo --url replay.meteor.com

For restore.sh, write:

mongorestore -u client -p $1 -h production-db-a1.meteor.io:27017 -db replay_meteor_com meteor/meteor/ --objcheck --drop
#production-db-a1.meteor.io is the physical server and might be different for your app

Step 2:

sh export.sh
#this will export your db into a local file

Step 3:

sh showdb.sh
#output should be
#mongodb://client:d2f3d2a0-73eb-f641-a41b-e12517cb5a2a@production-db-a1.meteor.io:27017/replay_meteor_com
#copy d2f3d2a0-73eb-f641-a41b-e12517cb5a2a to your clipboard

Step 4:

sh restore.sh d2f3d2a0-73eb-f641-a41b-e12517cb5a2a
#that should get the local file and restore it to the server
#WARNING: it will drop your remote db at meteor.com

Note:

– The ‘d2f3d2a0-73eb-f641-a41b-e12517cb5a2a’ seems to work only once and expires in a minute. So, hurry up

– Pay attention to the server address since they do change from time to time

Advertisements
Standard

One thought on “How to upload database to meteor.com

  1. Pingback: Day 23, week 3 assessment | Shao

Comments are closed.