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
// or pem file (ssh based authentication)
// Install MongoDB in the server, does not destroy local MongoDB on future setup
// WARNING: Node.js is required! Only skip if you already have Node.js installed on server.
// WARNING: If nodeVersion omitted will setup 0.10.36 by default. Do not use v, only version number.
// Install PhantomJS in the server
// 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
// Application name (No spaces)
// Location of app (local directory)
// 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
i updated setupMongo to false, redeploying and i got this error (mupx logs --tail=50):
[188.8.131.52] at Object.Future.wait (/bundle/bundle/programs/server/node_modules/fibers/future.js:398:15)
[184.108.40.206] at new MongoConnection (packages/mongo/mongo_driver.js:213:1)
[220.127.116.11] at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:1)
[18.104.22.168] at Object.<anonymous> (packages/mongo/remote_collection_driver.js:38:1)
[22.214.171.124] at Object.defaultRemoteCollectionDriver (packages/underscore/underscore.js:750:1)
[126.96.36.199] at new Mongo.Collection (packages/mongo/collection.js:102:1)
[188.8.131.52] at AccountsServer.AccountsCommon (accounts_common.js:23:18)
[184.108.40.206] at new AccountsServer (accounts_server.js:16:5)
[220.127.116.11] at Package (globals_server.js:5:12)
[18.104.22.168] 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
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:
“nodeVersion”: “0.12.0”, “MONGO_URL”: “mongodb://dummyadmin:dummypass@my-ip:27017/todos”
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:
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.