MongoDB not working on deployed Meteor project - mongodb

I've been working on a project with some friends using MongoDB and Meteor. It was working fine until we deployed it, we noticed the Mongo DB was not connecting to the Meteor app.
We are using:
Azure's Virtual Machine server
Meteor for development
Mongo for our database (Hosted in Azure's Document DB, different location from the Meteor's Azure VM)
Meteor up (mup) for deployment
We did notice that when we run the project locally with meteor, we need to specify the MONGO_URL on the same command (MONGO_URL="MongoDB connection string" meteor) if not, it doesn't connect to the db. This may be happening on the website, although we have specified the mongo url in the mup as follows:
env: {
ROOT_URL: 'IP',
MONGO_URL: '<URL>'
},
We have checked everything and not sure how to proceed, any feedback would help.
EDIT: Specify server locations

Related

Connecting to mongoDB on deployed meteor app

I recently deployed an app on galaxy using meteor 2.0 and mongo. I deployed using the command meteor deploy <domain>.au.meteorapp.com --free --mongo and it gave me the mongo URL below.
mongodb://<username>:<password>#SG-apgalaxycluster-38734.servers.mongodirector.com:27017,SG-apgalaxycluster-38735.servers.mongodirector.com:27017/<domain>-au-meteorapp-com?replicaSet=RS-apgalaxycluster-0&ssl=true
I cant seem to access this DB on mongo compass as when I paste the connection string in I simply get an error saying self signed certificate
Does anyone know how I can access it?

Connecting to external dummy MongoDB server

To run Meteor without Mongo, a dummy MongoDB server is needed. Obviously, one solution is to run mongod locally, or launch a mock MongoDB server.
What other ways are there to connect to a dummy MongoDB server for testing purposes?
Any Mongo hosting providers that have put up a dummy/test server, basically a /dev/null over mongodb://?
mongolab has that in their free sandbox level.
compose.io also has a free sandbox level.
search for 'mongo sandbox' or 'mongo free'.
the local mongo (on osx) is invaluable; don't know about wind blows.

What is the mongodb server url for meteor

I am using PhpStorm editor with mongoDB plugin, I was wondering what should be the mongodb server url,so I could monitor my mongoDB's activities directly from PhpStorm
It depends if you set MONGO_URL. If you run meteor locally with out setting MONGO_URL try
mongo localhost:3001/meteor
If you have deployed your app to meteor.com try
meteor mongo yourapp.meteor.com --url
This will return the MONGO_URLso that you can monitor/backup/restore your DB. Eg
mongodb://client-lots-of-numers#production-db-a1.meteor.io:27017/yourapp_meteor_com
When running MongoDB using the meteor command line you can access the database at localhost:3001. The database name is meteor and there is no need for credentials.

How to persist mongodb when deploying with meteor?

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.

How is MongoDb installed by Meteor?

I'm new to both Meteor.js and MongoDB and after installing Meteor in the official way described I wonder how to connect to my MongoDB.
MongoDB was installed by Meteor during the installation and everything works fine but now I would like to have a look into it with another tool (like RazorSQL) to see what's in there.
But the standard connection parameters (localhost:27017) doesn't work, what can I do? Login? Password?
Update: February 2014 - Meteor 0.7.1 - The meteor port has been shifted to 3001 instead of 3002. So instead of adding two to the port meteor runs on, you add 1 instead.
MongoDB's database is installed in the meteor package containing your files in a hidden folder called .meteor. To access it from a remote tool simply add 2 to whatever your web server port is while meteor is running. It will be stored in the meteor database
e.g
http://localhost:3000 would have its mongodb server running at mongodb://localhost:3002/meteor there is no username/password on this instance if you ran it with meteor or meteor run
To get the Meteor Mongo url and port, first run your Meteor app using meteor run then run meteor mongo in a different terminal tab. You should see an output like this
[meteor-app] meteor mongo
MongoDB shell version: 2.6.7
connecting to: 127.0.0.1:3001/meteor
this means that your Meteor Mongo is running at 127.0.0.1:3001.
If you are running your Meteor app with meteor run then you neither need username/password nor authentication configuration just make sure that you set your default database name as meteor