Hi,
I have configured two meteor applications to work both on the same ec2 server with two sub-domaine: admin.my-dom.co and app.my-dom.co
Thanks to nginx i am able to run the whole stuff perfectly except having some issue with mongo,
but unfortunately the admin app is still using it’s proper database,
I am using mupx to deploy and This is how my json look like:
{
// Server authentication info
"servers": [
{
"host": "my-ip",
"username": "ubuntu",
//"password": "password"
// or pem file (ssh based authentication)
"pem": "~/.ssh/aws.pem",
"env": {
"PORT": 3000,
"MONGO_URL": "mongodb://ubuntu@my-ip:27017/my-dom"
}
}
],
// 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.36 by default. Do not use v, only version number.
"nodeVersion": "0.10.40",
// Install PhantomJS in the server
"setupPhantom": true,
// Show a progress bar during the upload of the bundle to the server.
// Might cause an error in some rare cases if set to true, for instance in Shippable CI
"enableUploadProgressBar": true,
// Application name (No spaces)
"appName": "admin",
// Location of app (local directory)
"app": "/var/www/admin",
"env": {
"MONGO_URL": "mongodb://ubuntu@my-ip:27017/my-dom",
"PORT": 3000,
"ROOT_URL": "http://admin.my-dom.co"
},
// 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": 60
}`
i updated setupMongo to false, redeploying and i got this error (mupx logs --tail=50):
[object Object]
[54.186.213.175] at Object.Future.wait (/bundle/bundle/programs/server/node_modules/fibers/future.js:398:15)
[54.186.213.175] at new MongoConnection (packages/mongo/mongo_driver.js:213:1)
[54.186.213.175] at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:1)
[54.186.213.175] at Object.<anonymous> (packages/mongo/remote_collection_driver.js:38:1)
[54.186.213.175] at Object.defaultRemoteCollectionDriver (packages/underscore/underscore.js:750:1)
[54.186.213.175] at new Mongo.Collection (packages/mongo/collection.js:102:1)
[54.186.213.175] at AccountsServer.AccountsCommon (accounts_common.js:23:18)
[54.186.213.175] at new AccountsServer (accounts_server.js:16:5)
[54.186.213.175] at Package (globals_server.js:5:12)
[54.186.213.175] at /bundle/bundle/programs/server/packages/accounts-base.js:1814:4
It look like meteor can’t connect to the mongo database
No, not with mupx (at least not easily). From the mupx docs:
MongoDB installed and bound to the local interface (cannot access from the outside)
There are hacks to get around this but they aren’t pretty. I’d recommend instead looking into hosting a separate Mongo DB instance somewhere, then connecting to this separate DB from both apps. You can set this up yourself using something like a DigitalOcean Droplet, or look into using a hosted Mongo DB solution like compose.io or mLab.
Thanks again for your reply but i am still very stacked
i am runing the two app on the same server so i don’t think i have the same issue (Access from the outside)
My question is why it work for the main app and not for the second ?
This is very strange
The mongo instance successfully runned and i can login to the mongo shell
This is my pre online deployement and am realy confused about all of those errors
Just to add to this discussion, I have 2 separate apps running from one Mongo DB, but Mongo is on a separate machine (one is a test version of a site, another is production). Works without issue but yeah, you’d need Mongo to be on another machine and tell mupx NOT to install mongo.
It should just work then. Make sure the mongo_url is set properly and you’re good to go.
Thanks Korus i have now excatly what you have done
(2 separate apps connected to a mongo instnace on ec2 )
what’s the fibers error mean ?
This is my mongo string in mup.json:
“setupMongo”: false,
“setupNode”: true,
“nodeVersion”: “0.12.0”, “MONGO_URL”: “mongodb://dummyadmin:dummypass@my-ip:27017/todos”
You may need to accept connections on the Mongo machine from the IP of your apps. I vaguely remember having to set up Mongo / the server to accept direct connections.
ok,to resume there are two differents issues on this ticket
The first one was sharing a containred mongodb instance with two apps all of them on the same server => got no solution at least for now.
the second with connecting a meteor app to an external ec2 mongo instnace (The recommanded way) => i finaly got it !
i made a mistake on reading the logs the exact error was: Failed to authenticate
So i added an admin user to the right mongodb schema (not easy at all lol) and it should be fine now
Thanks a lot for your support and i hope it hasn’t been a wast of time for you guys
It is possible to deploy two apps using mupx and share the same db on a single box.
In your mup.json, you had:
What you need to do is to replace ubuntu@my-ip with mongodb (mupx doens’t set up a database on the ubuntu instance, it sets one up in a docker container on the ubuntu instance (the container is called mongodb).
i.e. replace the whole line above with:
"MONGO_URL": "mongodb://mongodb:27017/my-dom"
This will point to the mongo instance running in the existing mongodb container.
And it’s probably best to have "setupMongo": false when running mupx setup, to avoid restarting the mongodb container. Although that’s not a big deal unless you’ve started a replica set inside the container (so you can use the oplog) but, from your mup.json file, it doesn’t look like you’re doing that so no problem whether setupMongo is true or false.
I have have some problems with configuring two meteor applications. Could it be by the reason of using proxies (http://advanced.name if it matters) and change ip?