Phusion passenger with multiple apps on same server

I already have a meteor app deployed using mup. Now I want to deploy another app to the same server.

I would like to know is Phusion Passenger required if I deploy two meteor apps on the same server using subdomain. I understand I have to create virtual host configuration to access the two apps. Secondly, my second meteor app will exist in a separate directory on my local machine from where I can run mup to deploy it to the same server.

The question is do I need Phusion passenger on the server for the two apps. Will they run without it with only the virtual host configurations pointing to different ports ?

If for efficiency reasons I must use passenger then

  1. Do I need to pass passenger variables like ROOT_URL, MONGO_URL in virtual host files on server. They already exist in mup.json

  2. mup deployment ensures that the app starts every time the server restarts . how will passenger ensure this for an app

You should not use both mup and passenger at the same time.

You should choose one and stick with it.

If you go with mup, you must ensure both apps run on separate ports from separate directories but then you should need a reverse proxy (probably nginx) to redirect port 80 for each virtual domain to the relevant app.

If you go with passenger, it does all of that automatically for you. Furthermore, it can stop and restart apps based on their usage so that you can utilize your server resources and not waste valuable cpu/ram with apps that don’t have active visitors/users.

If you decide to use pasenger, please take a look at the https://www.phusionpassenger.com/library/ documentation, especially the “deployment” section with nginx mode. The documentation will answer all of your questions if you read them carefully and take some time familiarizing yourself with it.

I went through the Phusion passenger library link. The documentation feels like a cakewalk.

  1. The nginx integration mode lists the steps to install node.js, mongodb and then the app. Since I have been using mup these are already installed . Can I just install passenger and configure everything or should I start with fresh (blank) server image and follow the documentation through from the beginning.

  2. Can I edit the mup script to disable what is not required as per passenger documentation and use it to deploy. Or can I disable the configuration changes that mup made but are not required by passenger on the server instead of starting from a fresh server.

  3. The app deploy and also the update section on passenger seems lengthy . Should the automated scripts given in deployment automation guide be used.

  1. Although technically you can use whatever mup has installed for you, it is always better to start clean so that you know exactly what has been going on in your server

  2. See my first answer

  3. Yes they can be used after your initial setup for deploying new versions of your app

Thanks ! that clarifies between mup and passenger.

Technically, regarding Phusion passenger,

  1. how does Phusion passenger differentiate multiple apps without the ports. Does it use different domain and sub domains in vhost configuration files to distinguish between them .

  2. Other than passenger-status admin command , Is there any dashboard /UI control panel which shows what apps are running and their consumption of resources.

  3. when there are multiple apps deployed on server with passenger, Does each app has its own instance of node as well.

  4. when does passenger start an app. when the first request for the app comes in or when nginx starts, passenger starts and all the passenger enabled apps are started.

  5. when is mongodb started. when the app starts ?

Your welcome

  1. passenger is a “process manager” and uses nginx to manage http traffic to/from those processes. So it uses virtual host configurations where you can use different domains, subdomains, ports, transports or any combination of them. It is up to you. You can do anything that nginx allows you to do and as long as you point the configuration to your meteor app bundle, passenger takes care of the wiring.

  2. they have a commercial service called union station which I’ve never used. You can use kadira for monitoring your apps

  3. They all use the same installed node unless you want to use different node versions/instances and configure your nginx configuration blocks accordingly. It is extremely flexible. You can run a meteor app on node 0.10.40, a node express app on node 6.0, a php wordpress site, a static html site and a ruby on rails app at the same time on the same server with passenger.

  4. depends on the configuration. please read the configuration reference section. there are options to pre-start apps, min and max instances, when to scale up/down etc

  5. mongodb has no relation to passenger. it is a separate service/process that you run either on the same server, on another server or you purchase from a PaaS provider.

Thank you! for being patient and your efforts in answering the queries.

Regarding point 4, are there any defaults to it.
point 5, If passenger does not start mongodb how do I automate it to start everytime nginx restarts (may be I should check nginx reference). With mup this was done automatically.

No problem, I’m glad I’m of help

On 4. https://www.phusionpassenger.com/library/config/nginx/reference already shows you the defaults for each configuration item. You should be especially reading the https://www.phusionpassenger.com/library/config/nginx/reference/#resource-control-and-optimization-options section

And on 5. mongodb does not depend on nginx, passenger or mup or anything else. It is a completely separate server process. It starts on “server startup” if you configur it right. If you install mongodb as per the official docs https://docs.mongodb.org/v3.0/tutorial/install-mongodb-on-ubuntu/ then it will start automatically with your server

Thank you ! that was a great help. I appreciate your efforts in guiding and clarifying the queries. Thanks a lot!

1 Like

Hi
I have a query again .
Regarding your point 3. How do I configure [quote=“serkandurusoy, post:6, topic:22118”]
They all use the same installed node unless you want to use different node versions/instances and configure your nginx configuration blocks accordingly. It is extremely flexible. You can run a meteor app on node 0.10.40, a node express app on node 6.0, a php wordpress site, a static html site and a ruby on rails app at the same time on the same server with passenger.
[/quote]

nginx to have multiple node instances . I have one meteor app that runs on 0.10.46 and another will need 4…4.7 or higher and both need to run with phusion passenger. ?

Hey I’m not able to dig into the docs right now, but if you look at the
phusion passenger library (the official docs), namely the configuration
reference section, you will see where and how you can use different node
versions for different passenger node apps.

Looks like
passenger_nodejs path-to-node-js;

Is the configuration parameter. Will try. Thank you so much !

1 Like