Multiple Meteor apps on one local server

Hi all,

I’ve seen several questions being posted on this forum which are similar to this, but sadly no answers have been given for those. There are also some that look the same but have a completely different scope to this.

The situation is this: We have a number of Meteor-based tools we want to write for insight into internal data, which we want to run on a single, internal server on our network. This means that they should be available on URLs looking like this:

http://meteorserver/app1
http://meteorserver/app2

(I’ve seen a lot of solutions for this that use different subdomains or FQDNs, but that is not an option for us)

I’ve tried MUP, which looks from the documentation that it should do the trick, but for some reason (and I’ve seen this in other questions as well, like “Meteor up - two apps running one virtual server”), only the first app launched ever shows up. The other app path returns an nginx error.

I’ve also tried using Phusion Passenger (https://www.phusionpassenger.com/), but frustratingly, the ‘multi-tenant’ option that they seem to support, is completely undocumented and even googling for solutions on that seems not to yield any results.

Are there any other solutions out there? Using external servers (like Galaxy or several Digital Ocean Droplets, etc.) aren’t an option as the whole system needs to work internally.

Any help would be appreciated!

This can be done on a manual deploy by putting both apps in the one server block and using proxy-pass conditional on path:

server {
  listen 80;
  server_name meteorserver;
  
  location /app1/ {
    proxy_pass http://127.0.0.1:3000/;
  }

  location /app2/ {
    proxy_pass http://127.0.0.1:4000/;
  }
}

On top of the other settings for websockets, headers etc

1 Like

Which it looks like MUP supports doing this via a custom server block: http://meteor-up.com/docs.html#custom-nginx-config

module.exports = {
  // ... rest of config

  proxy: {
    domains: 'website.com',
    nginxServerConfig: './path/to/config'
  }
};

Which might be worth a try?

Hi!

I have the same needs. I spent the whole day looking for a solution without success yet. But I am new to Nginx and Meteor Up.
Snakenuts, have you managed to achieve that?

Coagman’s idea with MUP is one of those I tried, and the most promising… but I didn’t get the expected results. Maybe my config is wrong, but there is no details on how to achieve that.

Meteor Up docs only says that it is possible thanks to nginxLocationConfig, but the only result Google gives about this keyword is an issue posted on Meteor Up’s Github, which hasn’t been answered.

I tried with nginxServerConfig as coagman suggested. There is also very few Google results about it, I have read them all: no clue on how to set this up. What I tried has failed.

I think my main problem is: how to tell mup to launch app1 on port 3000 and app2 on port 4000???

Has anyone any idea? Snakenuts, how have you got the job done?

I also started with MUP to deploy my apps. But over a period of time shifted to do things myself. It is actually very easy to do if you have some knowledge. In my current DO setup I have 4 meteor apps running happily.
I had written something sometime back it has got stale, but it essentially the same process. I use PM2 to control the running of nodeApp making life very simple.
have a look at https://github.com/pkumar-uk/meteor-deploy for general direction.

I have not included nginx settings, but that is much more easy to do. You can ping me to get the nginx settings if you go this path.

Thank you for your reply.
PM2… I have heard about it, thought that I should have a look, then forgot it. Sounds to be able to do the job, indeed. I will give it a try.

traefik is easier to use than nginx, and better supports your use case. Take a look at it.

Thanks for the answers!

I tried pm2, but I struggled many hours, getting rid of errors and problems, just to keep hitting new ones. (I am fairly new to all this.) Plus the process is heavy and boring, even more in my case since I have to create, upload and extract the bundle myself: it is the only way I found to get around the ‘pm2 missing’ problem.

I would probably have succeeded to use pm2 with a whole more day of fighting, but I finally found an other way to build what I wanted, much, much lighter and more simple.
I use meteor up and Vulcan. Vulcan uses packages as subapps out of the box, and the routes are dead easy to set up.

I haven’t tried traefik: I keep it in mind, that could help. Thanks.

1 Like

(Apologies for the late reaction to this. I was away on a break for a bit…)

I did manage to get it running - in a fashion. I see the main things I did reflected in the posts above:

  • out-of-the-box MUP didn’t work.
  • I did look at PM2, but had the same issues corentinv had with it.
  • I ended up not running nginx through MUP but setting it up manually and having URL-based pass-throughs going to different docker instances. I did have to launch each instance with a different port as MUP didn’t like running things on the same port.

Currently, we’re just using MUP without nginx and going to different ports for different apps whilst we’re working out the best solution. It might be configuring nginx manually (which would work in our case as it’s an internal system and I’d be the only admin for it), but any better solutions might be worth a looking at traefik. I’d not heard of that.