-
-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to deploy multiple apps to the same server? #52
Comments
You can assign a custom port for meteor app by adding a |
Hey Madushan! I've just found out, that if you specify a custom port you will get some errors on 'Verifying Deployment' although the apps seems to be deployed 100% right on the specified port. Maybe its still looking for the app on 80 or something? Have a good day!
|
It should check for the correct port, Can try adding a |
I did it, it took a little longer but still ended up with the same errors. The newest build of the app is running fine on :3000 anyway, my mup.js:
|
@dufia @madushan1000 Thanks it worked! But even though the app is deployed and working, I get the same error dufia gets. Another small question... when deploying two apps, is it going to use the same mongo container? When I deployed the second app I think it removed the existing mongo container and created a new one! |
Here it gets tricky, you don't really have control over MongoDB when using MUP. I have a Backbone app that uses MongoDB and I would like my Meteor app to share the same DB. Still, I would like to use MUP cause its good software. Its seems easy to DO, but it isn't. MUP claims to support MongoDB outside of MUP, but fails badly. I tried current MUP, current MUPX and the newest MUP (under development). Neither of them supported MongoDB outside of MUP (or Docker), errors everywhere. Try it yourself. I am waiting for the newest stable of MUP. |
@THPubs @dufia I'll take a look at it and try to figure out what's causing it. BTW We do not advice to use MongoDB setup comes with mup. It's only intended for testing or aery small apps. For a production app, we recommend setting up a MongoDB replicaset on different hosts or somewhere like compose.io and set |
@madushan1000 Actually this is for a small app. It does give issues if I remove the mongo from the mup.js and just leave the url for the existing one...
I was trying to connect two apps to a single db. |
same here +1 |
@dufia :-( Hope we can get a solution soon. The old mup didn't work well with meteor 1.3... Tomorrow I have to launch an app. :-) |
I'm not recommending this in a production environment, but you can set up mongo in the first meteor deployment and remove all of the mongo config and just set the |
Thanks I tried that but then faced with a 502 bad gateway error when visit the site. Here's the mup logs :
It looks like it's failing to connect to the mongo database. I then removed mongo from both the mups and installed mongo locally and let the apps connect to it. Still not working. The app will only connect to it's own mongo docker container (Also we can't change the port of that mongo container. It use the default one). |
Actually I have no other choice... The old mup didn't work. Might be because im using meteor 1.3? |
Old mup should work. Actually, we are not doing anything meteor version specific inside mup. We just use The method I posted above should not work actually. We use docker link internally to link mongo container to meteord container. There are some things you can do listed here. PS: I found the problem with failing deployment verification(I was not taking the meteor port from proper place). I'll add a fix soon. |
Ah thanks :-) I will give another look at the old mup :-) |
I tried to connect two apps to the same database (localhost:27017) with all versions of MUP: Old, MUPX, current. MUPX has the same issues like the current (under development). I think it is because it is inside Docker and you are unable to access localhost. I don't know if it is a feature or a bug, it just doesn't work. #828 That being said (MUP is unable to access database via localhost:27017), do you think it would work if database was accessed via servers ip address instead? Like http://128.34.32.349:27017 |
@dufia Yeah, The mongo setup comes with mup is not meant to be used in production, Let alone two app sharing it(never host your web app and db in the same place, If one goes down, there is a high probability the other will too) To answer your other question, You would be able to access it trough a public IP(or if you are in a private LAN, private IP) if you configure your firewall to expose the MongoDB port to outside (This is a bad idea, since mup's MongoDB installation doesn't setup any authentication at all, the whole world will be able to access it) |
Thanks. Now everything is clear, you can easily connect multiple apps to the same database, just not via localhost. You have to allow Mongo to be remotely accessed and use servers IP address. I know, it might be silly for back-end expert but for me it wasn't. |
Yeah, This is because the way docker works. Unless you've linked your mongo container to meteor container, When you refer as localhost, you actually mean docker containers local address. not the docker host's one. BTW even if you want to use a mongo instance on localhost, set it up separately with a username and password and then set |
Sorry, if i have two apps, should i set different port for mongo? because i want to make sure two apps are different from others. For example. first app is and the second app is:
Or I just set it as same port but it actually work different from other app. Sorry, i dont quite understand this part. I use nginx to proxy my application. First app is in port 3000 and second app is port 3002. Although they are in same server, but i dont want it to share same mongo. From what @THPubs said before, it will overwrite the mongo if i create new container
|
Yes, The mongo installation mup setup is just a basic one. It's not meant to be used in production at all. Setup your own mongo and use |
Thank you.. You have simple answer but i can understand and it meant alot |
i tried to enable remote access. Then, new mongo url should look like
or
or
or
|
both of the |
But when i run DEBUG=* mup deploy, here is the output after Pushing Meteor Application Bundle : when i run `netstat -a' on server, i think it show that my mongodb have already enable remote access.
Updated: This problem not show when i run |
That error has nothing to do with mongo. It's mup saying it can't connect to your server. I'm not sure why. |
i dont know, But after DEBUG=* reconfig, and deployCheckWaitTime: 120, the problem solved. Thank you. Sorry for asking too many question. |
I'm not exactly sure why, Can you post you |
`module.exports = {
};` Here is my mup.js. |
@madushan1000 I have a same issue. I deployed application called A and now want to deploy other application called B that use A database. Which configuration needs for do this in MUP? |
For the record: Deploying multiple apps to the same server, giving each app separate databases on my-app-111:
my-app-222:
When I access the MongoDB shell on the server (
|
This is the solution: |
Using the old mup we were able to deploy multiple apps binding to different ports and use nginx to manage them. How can we do it with this one?
The text was updated successfully, but these errors were encountered: