Is there a simple way to reset the data from a meteor deployed app?
So, for example, if I had deployed an app named test.meteor.com — how could I easily reset the data that has been collected by that app?
Locally I run meteor reset, but I am unsure of what to do in production.
If you have your app with you you could do this in your project directory
meteor deploy test.meteor.com --delete
meteor deploy test.meteor.com
The first deletes the app so its all blank. The second deploys a fresh instance of it back.
one way is to login to the mongo instance yourself and delete the relevant data
so something like per collection:
$ meteor mongo APP.meteor.com
> db.users.drop()
> db.xxx.drop()
you could just drop the whole DB, but that would confuse their env and you have to --delete the app and re-deploy anyway.
> db.dropDatabase()
I know this is a bit old, but I just changed my collection name. so in your /lib/collections.js file,
someCollection = new Mongo.Collection("originalcollection");
becomes
someCollection = new Mongo.Collection("newcollectionname");
this is assuming of course that your app generates the data for the database.
Simply you can access your meteor DB as
production-db-d2.meteor.io:27017/XYZ_meteor_com
where XYZ = your subdomain
for authentication use meteor auth (username & password)
You can access it from rockmongo, robomogo, mongoui, etc tools.
To access from command line
First authenticate by typing username, password of meteor
$ meteor login
Then
$ meteor mongo XYZ.meteor.com
Related
A Meteor server code uses Accounts-ui package gets started like this:
appDir$ MONGO_URL=mongodb://username:password#cloud-host-url meteor
After creating the account, the user document fails to show up in the mongodb on the cloud-host but shows up in the local mongodb copy.
How can I correctly use the cloud mongodb?
I think the problem is how you set your MONGO_URL, try this in your CLI:
export MONGO_URL=mongodb://username:password#mongo_link && meteor
I set up my app data in my local dev Meteor environment using the default Mongo db that installed with Meteor. My app is ready to deploy on Heroku, but I intended for my data to go with it (similar to Rails "migrate").
In Heroku, I added the mLabs plugin and set the "MONGO_URL" variable. How do I get my local app db pushed to my mLabs instance for my deployment on Heroku?
Here's what worked for me.
1. make a dump of my local mongo db
In terminal (NOT mongo shell) in the app folder,
mongodump --port=3001 -o ../dump
2. move the db files out of the "dump/my-db-name" folder up into "dump"
In my local meteor instance, the "dump" folder was placed in the folder above my app, so "dump" was in the same directory as my app's folder. "dump" contained a folder named after my database ("dump/my-database-name/"). This caused the next script to fail with a mongorestore error "don't know what to do with 'my-database-name'". To prevent the error, I moved all of the files in the folder "my-database-name" up into "dump", then deleted the "my-database-name" folder.
By default, the meteor app creates with database name "meteor", so for anyone browsing this question who hasn't changed the db name, it will be "dump/meteor/".
4. Push the dumped database to the Heroku app's mLabs instance. I had already added the mLabs plugin in my Heroku app, and set the "MONGO_URL" in my Heroku app config. If these aren't done, they must be done first.
In terminal (NOT mongo shell), change from the app's directory to the directory that holds the "dump" directory.
Get the default "import" script for the Heroku app's mLabs instance by going to the mLabs plugin, and click the "Tools" tab. The script provided here did not work for me, but it may work for someone else, and it did provide the variables I used in the modified script below.
3. If the "import" script provided in mLabs tools did not work...
In mLabs "Users" tab, create a user with admin privileges.
Then, use this script with your variables replacing bracketed variables (replace the brackets, also).
mongorestore -h [your mLabs value] -d [your mLabs default user name] -u [your mLabs created user name] -p [your mLabs created user's password]
After the script runs, you should be able to refresh your mLabs "Collections" tab and see your pushed data.
Good luck :) I hope this helps someone!
I have an app deployed on digital ocean and am trying to perform a meteor reset to reset the DB etc. Where is meteor located when deployed via mup? I keep getting a command not recognized with meteor commands.
As far as I know you can't run meteor reset on deployed apps like that as it's already been built by MUP. The way you could mimic a meteor reset is to run the mongo shell on your digital ocean server:
mongo
You can check what the databases are by using:
show dbs
and then access the one meteor is running by doing:
use [db name]
and then manually drop the databases by using:
db.[collection name].drop()
http://docs.mongodb.org/manual/reference/method/db.collection.drop/
Meteor already has the user collection defined so you'd probably want to drop that collection too if you want a clean start
When I meteor deploy my app, it seems to create an entirely new mongodb instance. I'd like to be able to deploy with the current mongodb have locally.
Same goes the other way -- I'd like to be able to download the mongodb back to my localhost after it has been deployed.
For clarification, I'd really like to know the follow:
1) how to deploy with a fresh mongodb
2) how to deploy to an existing deployed app without overwriting the old mongodb
3) how to download/sync mongodb locally with the existing deployed app
4) how to make local backups of mongodb
You can perform a mongo dump using meteor mongo to export your local database and deploy your app using Meteor Up which should also allow you to automate the database import and deployment process.
"Meteor Up (mup for short) is a command line tool that allows you to deploy any meteor app into your own server."
You can stop the mongodb service and start a mongod instance in a separate terminal, by just typing mongod. This will let you monitor what's happening on the mongodb instance that you just started.
Open another terminal and do export MONGO_URL=mongodb://localhost:27017/nameOfDBgoesHere
This will create a new DB named "nameOfDBgoesHere" and it won't overwrite what you currently have, unless you name it with the same name.
After that just start meteor by typing meteor in your program's folder. In the mongod terminal that you opened you should see some connections opening.
By default mongodb creates it's DB files in /data/db. If you have another meteor app and follow the same steps in another terminal, while keeping the name of the DB you specified in the MONGO_URL you will just connect to it from that app - without overwriting anything.
As for the syncing with a deployed app and the local backups of mongo - it seems like something that the mongodb website covers, but maybe someone can chime in here. Not sure if there is a meteor specific, easy way of doing this.
I just built the chat application on the meteor and deployed it with meteor deploy appname. Now I want to delete the data present in the application. As we know meteor supports Mongo database, I tried by meteor reset but this reset only my local db not the application. So how can I delete the data from the meteor repo?
This is as simple as opening up a mongo shell to the remote database on the meteor.com servers.
all you need to do is type
meteor mongo appname
where appname is the name that you deployed your app to.
once you have a command prompt you can can use db.collectionName.remove({}) on each collection to get rid of your data.
Alternatively you can delete your whole deployment from the meteor servers.
meteor deploy --delete appname
Then redeploy
Meteor deploy appname