Mupx Multiple Deployments mup.json config


#1

Hi; how can I deploy only one app and start-up multiple instances in different ports?

Example:

xxx.xxx.xxx.xxx:3000
xxx.xxx.xxx.xxx:3001
xxx.xxx.xxx.xxx:3003

I can deploy one instance with Mup; but don’t know how to do Multiple Deployments.

In Mupx docs I only find this:

"Multiple Deployments

Meteor Up supports multiple deployments to a single server. Meteor Up only does the deployment; if you need to configure subdomains, you need to manually setup a reverse proxy yourself.

Let’s assume, we need to deploy production and staging versions of the app to the same server. The production app runs on port 80 and the staging app runs on port 8000.

We need to have two separate Meteor Up projects. For that, create two directories and initialize Meteor Up and add the necessary configurations.

In the staging mup.json, add a field called appName with the value staging. You can add any name you prefer instead of staging. Since we are running our staging app on port 8000, add an environment variable called PORT with the value 8000.

Now setup both projects and deploy as you need."


#2

For now (this might change in the future) the best way to handle this is to create a directory representing each one of your deployments (locally), with a matching deployment specific mup.json in each directory. Make sure each mup.json is configured for each deployment accordingly (e.g. proper ports), and pointing to the same shared local app path (via the mup.json app property). You can then mup deploy from each directory as needed.


#3

Y tried to duplicate the directory in my development machine; and change the PORT in the mup.json but when I deploy the second instance, the first one went down…


#4

Can you post a couple samples of your mup.json files? My guess is mup thinks you’re trying to control the same deployment from within each separate mup directory, so you should look into making sure you’re differentiating enough to prevent mup from getting confused. For example, make sure your appName is different in each mup.json, make sure you’ve run mup setup for each mup deployment directory, etc.


#5

I tried mupx setup with out luck…

mup.json 1

{
// Server authentication info
"servers": [
{
“host”: “107.170.94.xxx”,
“username”: “root”,
“password”: “xxx”,
// or pem file (ssh based authentication)
// WARNING: Keys protected by a passphrase are not supported
//“pem”: “~/.ssh/id_rsa”
// Also, for non-standard ssh port use this
//“sshOptions”: { “port” : 49154 },
// server specific environment variables
"env": {}
}
],

“setupMongo”: false,
“appName”: “mupdemo”,

“app”: “.”,

“env”: {
“PORT”: 3007,
“ROOT_URL”: “http://myapp2.com”,
“MONGO_URL”: “xxxxx”
},

“deployCheckWaitTime”: 45,

“enableUploadProgressBar”: true
}

mup.json 2

// Server authentication info
"servers": [
{
“host”: “107.170.94.xxx”,
“username”: “root”,
“password”: “xxx”,
// or pem file (ssh based authentication)
// WARNING: Keys protected by a passphrase are not supported
//“pem”: “~/.ssh/id_rsa”
// Also, for non-standard ssh port use this
//“sshOptions”: { “port” : 49154 },
// server specific environment variables
"env": {}
}
],

“setupMongo”: false,
“appName”: “mupdemo”,

“app”: “.”,

“env”: {
“PORT”: 3009,
“ROOT_URL”: “http://myapp2.com”,
“MONGO_URL”: “xxxx”
},

“deployCheckWaitTime”: 45,

“enableUploadProgressBar”: true
}


#6

As @hwillson said, you will need to choose a different appName in each mup.json file/deployment. Otherwise, mup is going to think that you are trying to overwrite your old app with a new version. So:

In first mup file:

"appName": "mupDemo"

In second mup file:

"appName": "mupDemo2"


#7

I tried ; but if I use the same folder in the server :

“app”: “.”,

The deploy method show this error:


#8

You have to run mupx setup after changing an apps name.

Looking at your screenshot, one quick thing to add. It looks like you have your app path configured to be the current directory, which means you’ve created full copies of your app for each mup deployment. You can simplify this a bit by keeping one copy of your application locally, then just have subdirectories for each mup deployment. So you could have something like:

your_app
  \deploy
    \server1\mup.json
    \server2\mup.json
    \server3\mup.json
    ...

So you would then run mupx whatever in each one of the serverX directories.


#9

Works great !! Thank!

The last one; how can I control the app from the server; for example;: stop, restart, start each one app ?