Search code examples
sslmeteormeteor-up

How to correctly deploy multi meteor instances WITH SSL on one digitalocean droplet using mup?


my mup.json config for first meteor instance:

{
  "servers": [
    {
      "host": "111.222.333.444",
      "username": "root",
      "password": "mypass"
    }
  ],
  "setupMongo": true,
  "setupNode": true,
  "nodeVersion": "0.10.40",
  "setupPhantom": false,
  "enableUploadProgressBar": true,
  "appName": "myapp1",
  "app": "../myapp1",
  "env": {
    "PORT": 3001,
    "ROOT_URL": "https://my.domain.com"
  },
  "ssl": {
    "pem": "./ssl.pem"
  },
  "deployCheckWaitTime": 15
}

So after deployment I want to get access to this instance by https://my.domain.com:3001. Then with similar configuration I want to deploy second instance to same droplet and get access to it by https://my.domain.com:3002.

The problem is that after deployment accessing by https taking ERR_CONNECTION_CLOSED, but accessing by http is OK.

How can I make it working?


Solution

  • Finally, I did it.

    Firstly, I used mupx. But there I had troubles too. Later I found that my fault was writing same ports for different apps or protocols. So, there is working configurations of first and second apps:

    {
      "servers": [{
        "host": "111.222.333.444",
        "username": "root",
        "password": "mypass",
        "env": {}
      }],
      "setupMongo": true,
      "appName": "myapp1",
      "app": "../myapp1",
      "env": {
        "PORT": 8000,
        "ROOT_URL": "http://my.domain.com"
      },
      "deployCheckWaitTime": 15,
      "enableUploadProgressBar": true,
      "ssl": {
        "certificate": "../ssl/bundle.crt",
        "key": "../ssl/private.key",
        "port": 8001
      }
    }
    
    {
      "servers": [{
        "host": "111.222.333.444",
        "username": "root",
        "password": "mypass",
        "env": {}
      }],
      "setupMongo": true,
      "appName": "myapp2",
      "app": "../myapp2",
      "env": {
        "PORT": 8100,
        "ROOT_URL": "http://my.domain.com"
      },
      "deployCheckWaitTime": 15,
      "enableUploadProgressBar": true,
      "ssl": {
        "certificate": "../ssl/bundle.crt",
        "key": "../ssl/private.key",
        "port": 8101
      }
    }
    

    bundle.crt and private.key are common for all apps. Don't forget to use mupx.

    So after

    mupx setup
    mupx deploy
    

    We can get access for first app by

    http://my.domain.com:8000
    https://my.domain.com:8001
    

    And for second app by

    http://my.domain.com:8100
    https://my.domain.com:8101
    

    EDIT: accessing by http is not working. I don't know why, maybe it just for my configuration. But this feature I don't need, I need only https. So if you know how to fix, please, write.

    EDIT2: it's alright, http access works. The reason was Chrome browser, it always redirects my domain from http to https. After cleaning browser history it do all good.