Mup.js example with SSL

I can use mup to deploy my Meteor app without SSL. I have SSL enabled in my DigitalOcean server and But I haven’t been able to get it to work with SSL yet and I’m guessing that I’m doing something wrong in my mup.js file.

Can someone share a mup.js file that includes settings for “proxy.domains” and “proxy.ssl”? You could change the sensitive parts before sharing. I just need to see a working example.

Im not sure what you mean by having “SSL enabled in the my DigitalOcean server” but you can just let mup manage everything for you (including generating the certificates with letsencrypt) by configuring the reverse proxy appropriately (see http://meteor-up.com/docs.html#reverse-proxy). If you do this then you include a block like this in your mup file:

  proxy: {
    domains: 'www.yourdomain.com',
    ssl: {
      letsEncryptEmail: 'you@yourdomain.com',
      forceSSL: true
    }
  }

But perhaps you want to use the same certs for another non meteor service?

@mattsouth, I’m not sure if I know what I mean. :wink: I’m trying your suggestion. When I run “mup setup” I get this error: “bash: line 4: https://mvolkmann.site: No such file or directory”.

Here is my mup.js file with sensitive values replaced. Do you see what I’m doing wrong?

module.exports = {
  servers: {
    one: {
      host: 'mvolkmann.site',
      username: 'root',
      password: 'not-my-real-password'
    }
  },

  app: {
    name: 'meteor-svelte-todos',
    path: '../',

    servers: {
      one: {}
    },

    buildOptions: {
      serverOnly: true
    },

    env: {
      ROOT_URL: 'https://mvolkmann.site:4000',
      MONGO_URL:
        'mongodb+srv://mvolkmann:some-password@cluster0.tqq7g.mongodb.net/meteor?retryWrites=true&w=majority'
      //MONGO_OPLOG_URL: 'mongodb://mongodb/local'
    },

    docker: {
      image: 'abernix/meteord:node-12-base'
    },

    enableUploadProgressBar: true
  },

  proxy: {
    domains: 'https://mvolkmann.site',

    ssl: {
      forceSSL: true,
      letsEncryptEmail: 'email-I-registered-with-lets-encrypt'
    }
  }
};

The domains part on proxy.domains should not include the protocol (https) eg:

  proxy: {
    domains: 'mvolkmann.site',

Though the error you posted sounds like something else. Is MUP reporting that the error is while running on your machine or on the target server?

1 Like

Thanks, that helped! Now it looks like I need to learn about nginx server blocks. Down the rabbit hole I go.

I can now successfully run “mup setup” and “mup deploy”. When I ssh to my server and enter “docker ps” I see this:

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
61164fdd1b75 mup-meteor-svelte-todos:latest “/bin/sh -c 'exec $M…” 26 minutes ago Up 26 minutes 80/tcp, 3000/tcp meteor-svelte-todos

My mup.js file specifies that I want the app to run on port 4000. I chose this port instead of 3000 because my DigitalOcean server has a Node process running on port 3000. I tried to configure nginx to support using port 4000, but browsing https://mvolkmann.site:4000 doesn’t run my app. What can I share that might help someone figure out where I’m going wrong? Below is my latest mup.js file with the sensitive parts replaced, but I’m guessing the problem is related to my nginx configuration on my DigitalOcean server.

module.exports = {
  servers: {
    one: {
      host: 'mvolkmann.site',
      username: 'root',
      password: '{my-password}',
      opts: {
        port: 4000
      }
    }
  },

  app: {
    name: 'meteor-svelte-todos',
    path: '../',

    servers: {
      one: {}
    },

    buildOptions: {
      serverOnly: true
    },

    env: {
      // If you are using ssl, it needs to start with https://
      ROOT_URL: 'https://mvolkmann.site',
      MONGO_URL:
        'mongodb+srv://{my-username}:{my-password}@cluster0.tqq7g.mongodb.net/meteor?retryWrites=true&w=majority'
      //MONGO_OPLOG_URL: 'mongodb://mongodb/local'
    },

    docker: {
      // abernix/meteord:node-12-base works with Meteor 1.9 - 1.10
      // If you are using a different version of Meteor,
      // refer to the docs for the correct image to use.
      image: 'abernix/meteord:node-12-base'
    },

    enableUploadProgressBar: true
  },

  meteor: {
    env: {
      ROOT_URL: 'https://mvolkmann.site' // need this?
    }
  },

  proxy: {
    clientUploadLimit: '0', // disable upload limit
    domains: 'mvolkmann.site',
    ssl: {
      forceSSL: true,
      // Enable Let's Encrypt
      letsEncryptEmail: '{my-email-address}'
    }
  }
};

MUP sets up it’s own nginx container that automatically generates configurations for other docker containers that have a VIRTUAL_HOST env var set in the docker config.
I think it also uses a private docker network to connect them

If you’re running your own install of nginx, it’s likely that all the autosetup and ssl via letsencrypt won’t work either

I use mechanic for managing nginx routing on a DO instance. Let’s you custom map ports, SSL etc.