Implementation of Meteor Up, cannot use meteor mongo --url

I recently applied the Meteor app to a drop of Digital Ocean with Ubuntu 14.04 x32. I used Meteor Up with this mup.json file:

 { // Server authentication info "servers": [ { "host": "mycorrecthostname", "username": "root", "password": "mycorrectpassword" } ], // Install MongoDB in the server, does not destroy local MongoDB on future setup "setupMongo": true, // WARNING: Node.js is required! Only skip if you already have Node.js installed on server. "setupNode": true, // WARNING: If nodeVersion omitted will setup 0.10.25 by default. Do not use v, only version number. "nodeVersion": "0.10.28", // Install PhantomJS in the server "setupPhantom": true, // Application name (No spaces) "appName": "meteor", // Location of app (local directory) "app": "/my/correct/path/to/app", // Configure environment "env": { "ROOT_URL": "http://mycorrecturl.com" }, // Meteor Up checks if the app comes online just after the deployment // before mup checks that, it will wait for no. of seconds configured below "deployCheckWaitTime": 15 } 

Everything works great. I tested the website and everything works as it should. I also installed ssh keys with the server and can ssh to it without a password.

Now, although I need to access my server database remotely. I have some local data in the python shelf file in which I need to sow my database. I understand how to connect to the remote database using pymongo , but I'm trying to get the URI of the connection with meteor mongo --url http://mycorrecturl.com/ and it just returns this error:

 Couldn't open a mongo connection: Site does not exist 

What? What's going on here? I would expect it to ask for authentication, but just doesn't exist? Officially confused.

Your help is welcome in advance!

Update

I hunted in my server directories, trying to successfully run meteor mongo there, but despite the fact that I installed a meteorite with curl https://install.meteor.com | /bin/sh curl https://install.meteor.com | /bin/sh , it just always says that I am not in the project meteor directory. Even the hidden .meteor directory was apparently not a project directory.

Update

I looked more closely at the Meteor Up docs and it says the following:

You cannot access MongoDB from the outside of the server. To access MongoDB shell, you first need to log in to your server via SSH and then run the following command.

 mongo appName 

I tried this and it works, but it is not very good. I need to have access to the database remotely. Is it just not possible when deploying Meteor Up?

One of the answers below seems to suggest that by setting MONGO_URL in my env object, I will basically manually tell the database which url to respond to. It's right?

Update

Meteor Up docs say the following:

<username> - database name

So, according to one of the answers, I edited my mup.json to include this:

 // Configure environment "env": { "ROOT_URL": "http://localhost/", "MONGO_URL": "mongodb://root:mypassword@127.0.0.1:27017/meteor" // My appName is "meteor", so that is the name of the database as well. } 

When I do mup deploy with these variables, the deployment fails. Here is the first part of the error (if you want the rest to leave me information):

 /usr/lib/node_modules/wait-for-mongo/bin/wait-for-mongo:14 throw err; 

When I use mup reconfigure , it does not fail, but then the website simply cannot be found at its URL. It seems to me that MONGO_URL not a control mechanism, but simply a pointer to an external database such as mongohq.

I think I will have no choice but to resort to the mongo appName and the python ssh library, but I would like to find a way to directly access my database remotely and continue to use Meteor Up.

+9
ssh mongodb meteor digital-ocean meteor-up
May 21 '14 at 14:46
source share
7 answers

You cannot remotely access the database if Meteor Up is installed and configured for you. From the Meteor Up docs:

You cannot access MongoDB from the outside of the server. To access MongoDB shell, you must first log in to your server via SSH and then run the following command.

 mongo appName 

However, it can be accessed in a different way than this mongo appName interface if these programs are running on the server.

Digital Ocean Ubuntu drops are equipped with Python 2.7, so using from pymongo import MongoClient client = MongoClient()

This will automatically connect to mongodb://localhost:27017/

pymongo not the default package, so install pip and then use pip to install pymongo .

 apt-get install python-pip python-dev build-essential pip install pymongo 
+7
May 22 '14 at 18:02
source share

This is because you did not set MONGO_URL to the "env" object.

 // Configure environment "env": { "PORT": 58090, # Your application port "ROOT_URL": "http://localhost/", "MONGO_URL": "mongodb://username:password@127.0.0.1:27017/myDatabase", "METEOR_ENV": "production" # If you need to separate your local environment from production }, 

Then just run mup deploy .

+4
May 21 '14 at 15:35
source share

I think I found a solution to access the database using mupx on the digitalocean ubuntu 14.04 server.

After deploying your application using mupx, follow these steps:

Log in with ssh to your server, then install mongo: apt-get install mongodb

Then run the mongo command on your server. Try checking if your database exists by running show dbs . If so, use yourdbname . It should contain all the data from your application!

Let me know if this works. Good luck.

+2
May 25 '16 at 13:53
source share

It took me a while to figure this out. It is not possible to access the mongodb server outside of your hosting server. Therefore, you must first ssh to your server and work from there. To connect to your db using pymongo, use the following:

 client = MongoClient('mongodb://localhost/APPNAME') posts = client.APPNAME.posts 

APPNAME should be specified in your mup.json file and replace posts with any collection that you need to update.

+1
Apr 6 '15 at 5:32
source share

I had this problem, but I was able to use 3T MongoChef for this. MongoChef has the ability to connect to the database via SSH, and it works like a charm. Hope this helps others.

Here is the appropriate screen in MongoChef where you can do this. enter image description here

+1
Oct. 15 '15 at 2:11
source share

You can modify mongod.conf to allow access from the outside (a bit dangerous, of course;)

 nano /etc/mongod.conf # Listen to local interface only. Comment out to listen on all interfaces. # bind_ip = 127.0.0.1 

then restart the server

 service mongod stop service mongod start 

and you can access it from the outside (using ssh-forwarding in robo-mongo)

0
Oct 26 '15 at 19:08
source share

All I did was add the IP address of my digital drip server, not localhost, and it worked:

 env: { ROOT_URL: 'http://yourdomain.com', MONGO_URL: 'mongodb://104.236.24.66:27017/meteor', PORT: 3002, }, 

Using this instance of mongo in docker for 2 meteor applications currently.

EDIT: it depends on how your firewall is configured. Refer to "ufw status". It also depends on how your mongo is deployed (which ports are redirected there, ex) 0.0.0.0:27017-> 27017).

0
Apr 15 '17 at 16:44
source share



All Articles