Novel way to deploy using Git with easy updates

Wanted to share how we deployed our clustered App (using kadira’s Cluster package, with changes).

We didn’t like mupx as it used Docker and it’s a black box for us. Instead, we actually use the meteor server itself with its built-in MongoDB. Our application needs the DB to be on the same server for speed. This approach also allows us access to the DB remotely (say to add users or do cleanups):

  1. Created our own super simple startup script for pm2 (which runs with prod settings and --production)
  2. With a GitLab webhook, a script automatically pulls the latest master branch when there is an update
  3. At each pull, if there are changes it rebuilds automatically (given we are running meteor server)

It works great, especially as we are adding features almost daily (and fixing bugs as we move out of Beta) based on feedback.

The downside is that it takes 30 - 60s to rebuild, so it’s technically a downtime. When you think that mupx needs as long to make sure your app is deployed, it’s not so bad. We will later update our pm2 script to use the build feature (haven’t figured it out, the Meteor Guide / docs are not clear there yet).

Something to consider with your current approach:

According to @gadicc, using the built-in meteor server uses “…roughly almost 3x as much RAM and almost 6x the CPU.” versus running a built version of your app via a plain old node instance.

https://forums.meteor.com/t/running-in-production-using-meteor-port-vs-bundling-app/24533/6?u=wallslide

1 Like

Thanks @wallslide, agreed. We are working our way to the build tools, just haven’t figured it out yet as the paths in the docs seem out of date.