Homepage

Meteor app deployment with nginx and passenger

Meteor is getting more and more popular these days, and no wonder: creating a web application is so easy. But what can we do if we want to push our great project live? Unfortunately, there are not too many deployment tools available (yet?). In this article, I’m going to explain step by step how to deploy a Meteor application to debian/ubuntu system (apt-get command required).

Meteor is getting more and more popular these days. Creating a web application is so easy. But what can we do if we want to push live our great project? Unfortunately, there are not too many deployment tools available (yet?). In this article I’m going to explain step by step how to release your Meteor application to debian/ubuntu system (apt-get command required).

Before we start, please make sure you have:

  • Root access - we need to install some software (nginx, node and so on)

  • Standard user access named deploy - we will use this account to deploy app, we don’t want to use root account, because it’s a security risk

  • Installed make and g++ packages (apt-get install make g++)

Now we can start installing required software on our server.

Install nodejs

To install nodejs on debian/ubuntu we can use official repository. First, login as root and install curl - it’s required for nodejs installer:

tsx

Now, add a repository for apt:

tsx

Run command to install nodejs:

tsx

Install mongodb

Mongodb is not required for Meteor app, but it’s highly recommended - we need to store data somewhere, right?

First, let’s add repository for apt:

tsx

Run command to install mongodb:

tsx

Make sure that mongodb is running:

tsx

Install nginx with passenger

Now the most important part. We need to install nginx web server. Standard debian/ubuntu apt repositories don’t contain passenger. That’s why we will use official passenger repository. To add repository for apt execute:

tsx

If you have debian jessie run:

tsx

If you have ubuntu trusty run:

tsx

Now we can install nginx with passenger support:

tsx

Configure nginx to start node/meteor application

Next thing that we need to do is to tell nginx where the Meteor app main directory is. Also, we need to specify url and mongodb access. All services are already available on our machine so it should be easy. Create file /etc/nginx/sites-available/example.com and put this content:

tsx

And that’s all. Copy this file to the available sites dir and make a symlink to enable the app:

tsx

Now we need to check if passenger configuration has been enabled in nginx. Open a /etc/nginx/nginx.conf file and make sure that these two lines are not commented:

tsx

Restart nginx

tsx

Build and upload Meteor app to the server

Now we are ready to deploy the app. First we need to build the app. Go to your Meteor app dir on local machine and use this command:

tsx

The compressed build should be available in /tmp directory. Before we upload the image, we need to prepare directories:

tsx

Upload the image to the remote machine:

tsx

Decompress the image:

tsx

If we are deploying from MacOSX we need to remove bcrypt package. Then we can install needed packages and bcrypt:

tsx

It will take a minute or two. Warnings can be ignored here.

Create public and tmp dirs because passenger requires them:

tsx

Finally we are ready to restart the app:

tsx

Your Meteor application should be up and running now. Go to http://example.com to check it.

Make automation script for deployment

The deployment process is not complicated but it requires a few commands to execute. We don’t want to repeat them every time. To automate the whole deployment process, we can use simple bash script that will do all above things for us:

tsx

Please verify that USER and NAME variables are correct. Then we can easily deploy it using single command:

tsx

This script can be placed in your meter app in main directory. Also, It is highly recommended to upload your public ssh key for deploy user. Otherwise we will have to type password a few times.

That’s all. We can use this command every time we need to deploy new release.

Final thoughts

Deploying Meteor app with nginx and passenger is quite easy. The great thing is that we don’t have to worry about restarting node process after deployment or app crash. Passenger process will do it for us. Also, the bash script is not perfect, but it’s a good place to start. It would be great to display some progress messages and handle errors better. But this is something to be taken care of later.

sales decorator

Build an e-commerce that sells more!

Contact us and receive a bespoke proposal in 7 days

More posts in this category

  • February 05, 2025 • 10 min read

    API-first CMS: What Options You Have (Web Dev Agency's Take)

    According to the 2024 State of the API Report by Postman, 74% of organizations are adopting API-first strategies. This statistic isn’t just impressive—it signals a major shift in how businesses operate. While API-first approaches have long been a staple in software development, they're now reshaping content management as well. More and more companies are realizing that traditional CMS platforms can't keep up with the demand for flexibility, speed, and seamless integrations.

    READ MORELearn more about api first cms
  • January 23, 2025 • 15 min read

    Best CMS for SaaS: Top Cloud-Based Solutions

    Choosing the right Content Management System (CMS) is a critical decision for your SaaS business. Your unique needs require solutions that are not only flexible, scalable, and user-friendly but also tailored to meet the demands of a fast-paced, customer-focused industry. A CMS should simplify your workflows and help you deliver personalized, high-quality digital experiences.

    READ MORELearn more about best cms for saas top cloud based solutions
  • December 12, 2024 • 10 min read

    We Picked the Best (Headless) CMS for Vue

    Picture a digital experience where content effortlessly flows across platforms, development is agile, and performance is unmatched. By combining the power of Vue.js, a progressive JavaScript framework, with a modern headless CMS, you can achieve all this and more.

    READ MORELearn more about headless cms for vue