Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running meteor shell on production server deployed with meteor up

I need to run some server-side commands on my production app to modify some data, specifically adding some users to new roles from the alanning:roles package. My production server was deployed using mup. Per the mup docs, my app lives at /opt//app, so I navigated there via ssh and ran meteor shell. This doesn't seem to work. Does anyone have any other suggestions for updating user permissions on a production server?

like image 559
bgmaster Avatar asked Mar 14 '15 14:03

bgmaster


2 Answers

Could you write some server-side code that runs on Meteor.startup and deploy it to the server?

like image 100
kobra Avatar answered Nov 04 '22 15:11

kobra


I wouldn't recommend doing this often, but if you're first setting an app up, you can run the mongo shell on the server, and edit meteor's database documents directly.

if you ssh into the server and run mongo you'll get the mongo shell. If you let Meteor Up configure mongo for you, you'll have access from localhost without any authentication. The database name will be the same as your app name.

Run show dbs to list the databases in Mongo.

Run use myAppDatabaseName to switch to your app database, and run show collections to show your collections.

There should be a users collection.

You can run standard mongo queries here, so db.users.find() will show you all your users. db.users.findOne({_id: myUserId}) will fetch a single user.

For the roles package, it's probably better to create some secure code that runs on startup than edit the database directly, as there's quite a lot going on.

like image 25
Orangetronic Avatar answered Nov 04 '22 16:11

Orangetronic