Hosting a Meteor app on Ubuntu using Node, Mongo, and PM2

 

meteor

Recently I had to start hosting a Meteor app on Ubuntu.  The process is pretty straightforward however there are a few gotchas.  This post is really just to help me remember in the future.

First, clone your repo on the target server or move the source files there before you compile/build the app.  This is important if you are using a different OS than what your server is.  I ran into issue when compiling it on OSX and moving it to Ubuntu.

After moving the files, install meteor.

Then compile your app

It will create a archive for you.

Extract it to the directory you will host the app

cd into the server folder

install node modules

install pm2

cd back to the app bundle dir

create a process.json file

add your configuration

create a shell script

add bash script

make it executable

run the bash script

run pm2 startup

this will output a command to run, run it

save current process

All set! Check the status of your app

You should see something similar to this

 

Also, here is a sample nginx site configuration using Let’s Encrypt SSL

 

One thought on “Hosting a Meteor app on Ubuntu using Node, Mongo, and PM2

  1. Thanks for this.

    FYI: using the instances “-i max” flag is useless in fork_mode I believe, should be cluster_mode.

Leave a Reply

Your email address will not be published. Required fields are marked *