Resetting database on app deployed to Digital Ocean using MUPX


#1

This is a follow up to this SO post: http://stackoverflow.com/a/24375983/4168250

Is there a tutorial anywhere for doing this? My inexperience will show through but I deployed a prototype app to Digital Ocean using MUPX and I am now trying to reset the database in the same way I used to run meteor reset on myApp.meteor.com.

When @arunoda says run meteor mongo, where do I do that? In the terminal? Or through the server console provided by DO? Thank you.


#2

You may connect your remote server via SSH and use local mongo instance or docker exec.


#3

Any further suggestions on how to do that? There are step-by-step tutorials for deploying using MUPX but nothing on resetting. Sadly, I don’t know how to use the suggestion.


On second thought…I should really do some more research before asking more here. I just really miss myApp.meteor.com.


#4

What was the tutorial you followed for your MUPX deployment?

You probably created a user account for your DigitalOcean server while you were following your deployment instructions. You need to remotely log in to that account. Your DO dashboard will tell you the IP address of your server. If you’re on a Mac or Linux computer, you can login by opening a terminal application and using ssh. For example,

ssh <yourAccountsUserName>@<yourIPAddress>

or

ssh brendansDeploymentAccount@127.0.0.1

If you’re on a Windows machine, you can use an application named PuTTY to make the ssh connection.

Or you can use the server console provided by DO’s web dashboard. That will log you in as your server’s root user. You can use the su command to log in to your deployment user account from there.

Then once you’re logged in to your deployment account, you can cd into your app’s directory and run meteor mongo from there.


#5

Thanks! I’m sure it’s basic for most but it’s also helpful to many to have it all laid out in one place.


#6

Once you’ve ssh’ed in, if you want the mongo console for the database that your mupx deployment uses:

docker exec -it mongodb mongo

For any command that you want to run in the container that mupx uses for the database, precede it with docker exec -it mongodb.

E.g. to dump the database and copy it to some other directory

docker exec -it mongodb mongodump
docker cp mongodb:dump /var/local//backup/mongodb

#7

But what is the difference between mongodump and db.dropDatabase(), as suggested by @arunoda? I want to redeploy my app but want to delete all documents that I have created through resting the deployed prototype.


#8

Okay, ignore everything I said after:

Once you’ve done that, type:

use <yourDatabaseName>
db.dropDatabase()

Note: your database name is usually your app name


#9

All good now, thanks for the follow up. I admit I was confusing collections with database. Once I realized there was only one thing to delete (by checking show dbs), it became much clearer.