• Stars
    star
    2,268
  • Rank 19,578 (Top 0.4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Production Quality Meteor Deployments

Meteor Up

This version is no longer maintaining.
Mupx is the stable version.
New development is moved to here: https://github.com/kadirahq/meteor-up.

Production Quality Meteor Deployments

Meteor Up (mup for short) is a command line tool that allows you to deploy any Meteor app to your own server. It supports only Debian/Ubuntu flavours and Open Solaris at the moments. (PRs are welcome)

You can use install and use Meteor Up from Linux, Mac and Windows.

Screencast: How to deploy a Meteor app with Meteor Up (by Sacha Greif)

Table of Contents

Features

  • Single command server setup
  • Single command deployment
  • Multi server deployment
  • Environmental Variables management
  • Support for settings.json
  • Password or Private Key(pem) based server authentication
  • Access, logs from the terminal (supports log tailing)
  • Support for multiple meteor deployments (experimental)

Server Configuration

  • Auto-Restart if the app crashed (using forever)
  • Auto-Start after the server reboot (using upstart)
  • Stepdown User Privileges
  • Revert to the previous version, if the deployment failed
  • Secured MongoDB Installation (Optional)
  • Pre-Installed PhantomJS (Optional)

Installation

npm install -g mup

Creating a Meteor Up Project

mkdir ~/my-meteor-deployment
cd ~/my-meteor-deployment
mup init

This will create two files in your Meteor Up project directory:

  • mup.json - Meteor Up configuration file
  • settings.json - Settings for Meteor's settings API

mup.json is commented and easy to follow (it supports JavaScript comments).

Example File

{
  // Server authentication info
  "servers": [
    {
      "host": "hostname",
      "username": "root",
      "password": "password",
      // or pem file (ssh based authentication)
      //"pem": "~/.ssh/id_rsa",
      // Also, for non-standard ssh port use this
      //"sshOptions": { "port" : 49154 },
      // server specific environment variables
      "env": {}
    }
  ],

  // Install MongoDB on the server. Does not destroy the local MongoDB on future setups
  "setupMongo": true,

  // WARNING: Node.js is required! Only skip if you already have Node.js installed on server.
  "setupNode": true,

  // WARNING: nodeVersion defaults to 0.10.36 if omitted. Do not use v, just the version number.
  "nodeVersion": "0.10.36",

  // Install PhantomJS on the server
  "setupPhantom": true,

  // Show a progress bar during the upload of the bundle to the server.
  // Might cause an error in some rare cases if set to true, for instance in Shippable CI
  "enableUploadProgressBar": true,

  // Application name (no spaces).
  "appName": "meteor",

  // Location of app (local directory). This can reference '~' as the users home directory.
  // i.e., "app": "~/Meteor/my-app",
  // This is the same as the line below.
  "app": "/Users/arunoda/Meteor/my-app",

  // Configure environment
  // ROOT_URL must be set to https://YOURDOMAIN.com when using the spiderable package & force SSL
  // your NGINX proxy or Cloudflare. When using just Meteor on SSL without spiderable this is not necessary
  "env": {
    "PORT": 80,
    "ROOT_URL": "http://myapp.com",
    "MONGO_URL": "mongodb://arunoda:[email protected]:10023/MyApp",
    "MAIL_URL": "smtp://postmaster%40myapp.mailgun.org:[email protected]:587/"
  },

  // Meteor Up checks if the app comes online just after the deployment.
  // Before mup checks that, it will wait for the number of seconds configured below.
  "deployCheckWaitTime": 15
}

Setting Up a Server

mup setup

This will setup the server for the mup deployments. It will take around 2-5 minutes depending on the server's performance and network availability.

Deploying an App

mup deploy

This will bundle the Meteor project and deploy it to the server.

Additional Setup/Deploy Information

Deploy Wait Time

Meteor Up checks if the deployment is successful or not just after the deployment. By default, it will wait 10 seconds before the check. You can configure the wait time with the deployCheckWaitTime option in the mup.json

SSH keys with passphrase (or ssh-agent support)

This only tested with Mac/Linux

With the help of ssh-agent, mup can use SSH keys encrypted with a passphrase.

Here's the process:

  • First remove your pem field from the mup.json. So, your mup.json only has the username and host only.
  • Then start a ssh agent with eval $(ssh-agent)
  • Then add your ssh key with ssh-add <path-to-key>
  • Then you'll asked to enter the passphrase to the key
  • After that simply invoke mup commands and they'll just work
  • Once you've deployed your app kill the ssh agent with ssh-agent -k

Ssh based authentication with sudo

If your username is root, you don't need to follow these steps

Please ensure your key file (pem) is not protected by a passphrase. Also the setup process will require NOPASSWD access to sudo. (Since Meteor needs port 80, sudo access is required.)

Make sure you also add your ssh key to the /YOUR_USERNAME/.ssh/authorized_keys list

You can add your user to the sudo group:

sudo adduser *username*  sudo

And you also need to add NOPASSWD to the sudoers file:

sudo visudo

# replace this line
%sudo  ALL=(ALL) ALL

# by this line
%sudo ALL=(ALL) NOPASSWD:ALL  

When this process is not working you might encounter the following error:

'sudo: no tty present and no askpass program specified'

Server Setup Details

This is how Meteor Up will configure the server for you based on the given appName or using "meteor" as default appName. This information will help you customize the server for your needs.

  • your app lives at /opt/<appName>/app
  • mup uses upstart with a config file at /etc/init/<appName>.conf
  • you can start and stop the app with upstart: start <appName> and stop <appName>
  • logs are located at: /var/log/upstart/<appName>.log
  • MongoDB installed and bound to the local interface (cannot access from the outside)
  • the database is named <appName>

For more information see lib/taskLists.js.

Multiple Deployment Targets

You can use an array to deploy to multiple servers at once.

To deploy to different environments (e.g. staging, production, etc.), use separate Meteor Up configurations in separate directories, with each directory containing separate mup.json and settings.json files, and the mup.json files' app field pointing back to your app's local directory.

Custom Meteor Binary

Sometimes, you might be using mrt, or Meteor from a git checkout. By default, Meteor Up uses meteor. You can ask Meteor Up to use the correct binary with the meteorBinary option.

{
  ...
  "meteorBinary": "~/bin/meteor/meteor"
  ...
}

Access Logs

mup logs -f

Mup can tail logs from the server and supports all the options of tail.

Reconfiguring & Restarting

After you've edit environmental variables or settings.json, you can reconfigure the app without deploying again. Use the following command to do update the settings and restart the app.

mup reconfig

If you want to stop, start or restart your app for any reason, you can use the following commands to manage it.

mup stop
mup start
mup restart

Accessing the Database

You can't access the MongoDB from the outside the server. To access the MongoDB shell you need to log into your server via SSH first and then run the following command:

mongo appName

Server Specific Environment Variables

It is possible to provide server specific environment variables. Add the env object along with the server details in the mup.json. Here's an example:

{
  "servers": [
    {
      "host": "hostname",
      "username": "root",
      "password": "password",
      "env": {
        "SOME_ENV": "the-value"
      }
    }

  ...
}

By default, Meteor UP adds CLUSTER_ENDPOINT_URL to make cluster deployment simple. But you can override it by defining it yourself.

Multiple Deployments

Meteor Up supports multiple deployments to a single server. Meteor Up only does the deployment; if you need to configure subdomains, you need to manually setup a reverse proxy yourself.

Let's assume, we need to deploy production and staging versions of the app to the same server. The production app runs on port 80 and the staging app runs on port 8000.

We need to have two separate Meteor Up projects. For that, create two directories and initialize Meteor Up and add the necessary configurations.

In the staging mup.json, add a field called appName with the value staging. You can add any name you prefer instead of staging. Since we are running our staging app on port 8000, add an environment variable called PORT with the value 8000.

Now setup both projects and deploy as you need.

SSL Support

Meteor Up has the built in SSL support. It uses stud SSL terminator for that. First you need to get a SSL certificate from some provider. This is how to do that:

  • First you need to generate a CSR file and the private key
  • Then purchase a SSL certificate.
  • Then generate a SSL certificate from your SSL providers UI.
  • Then that'll ask to provide the CSR file. Upload the CSR file we've generated.
  • When asked to select your SSL server type, select it as nginx.
  • Then you'll get a set of files (your domain certificate and CA files).

Now you need combine SSL certificate(s) with the private key and save it in the mup config directory as ssl.pem. Check this guide to do that.

Then add following configuration to your mup.json file.

{
  ...

  "ssl": {
    "pem": "./ssl.pem",
    //"backendPort": 80
  }

  ...
}

Now, simply do mup setup and now you've the SSL support.

  • By default, it'll think your Meteor app is running on port 80. If it's not, change it with the backendPort configuration field.
  • SSL terminator will run on the default SSL port 443
  • If you are using multiple servers, SSL terminators will run on the each server (This is made to work with cluster)
  • Right now, you can't have multiple SSL terminators running inside a single server

Updating

To update mup to the latest version, just type:

npm update mup -g

You should try and keep mup up to date in order to keep up with the latest Meteor changes. But note that if you need to update your Node version, you'll have to run mup setup again before deploying.

Troubleshooting

Check Access

Your issue might not always be related to Meteor Up. So make sure you can connect to your instance first, and that your credentials are working properly.

Check Logs

If you suddenly can't deploy your app anymore, first use the mup logs -f command to check the logs for error messages.

One of the most common problems is your Node version getting out of date. In that case, see “Updating” section above.

Verbose Output

If you need to see the output of meteor-up (to see more precisely where it's failing or hanging, for example), run it like so:

DEBUG=* mup <command>

where <command> is one of the mup commands such as setup, deploy, etc.

Binary Npm Module Support

Some of the Meteor core packages as well some of the community packages comes with npm modules which has been written in C or C++. These modules are platform dependent. So, we need to do special handling, before running the bundle generated from meteor bundle. (meteor up uses the meteor bundle)

Fortunately, Meteor Up will take care of that job for you and it will detect binary npm modules and re-build them before running your app on the given server.

  • Meteor 0.9 adds a similar feature where it allows package developers to publish their packages for different architecures, if their packages has binary npm modules.
  • As a side effect of that, if you are using a binary npm module inside your app via meteorhacks:npm package, you won't be able to deploy into *.meteor.com.
  • But, you'll be able to deploy with Meteor Up since we are re-building binary modules on the server.

Additional Resources

More Repositories

1

react-komposer

Feed data into React components by composing containers.
JavaScript
735
star
2

node-usage

process usage lookup with nodejs
JavaScript
390
star
3

meteor-streams

Realtime messaging for Meteor
JavaScript
286
star
4

laika

testing framework for meteor
JavaScript
241
star
5

meteor-ddp-analyzer

Simple DDP Proxy which logs DDP messages
JavaScript
151
star
6

meteor-smart-collections

Meteor Collections Re-Imagined
JavaScript
148
star
7

use-magic-link

Simple auth setup for your React app in few minutes with Magic Link.
JavaScript
110
star
8

meteor-cluster

Smarter way to run cluster of meteor nodes
JavaScript
100
star
9

learnnextjs-demo

Demo App of the http://learnnextjs.com
JavaScript
94
star
10

nodemiral

Server Automation for NodeJS over SSH
JavaScript
93
star
11

nariya

Continuous Deployment Server
JavaScript
67
star
12

hello-react-meteor

Learning Some React with Proper Meteor Integration (Routing, SSR)
JavaScript
65
star
13

meteor-static-blog

Static Blog Made with Meteor
JavaScript
60
star
14

chrome-node

NodeJS Runtime for Chrome (For Packaged Apps)
55
star
15

mongo-metrics

Metrics tracking and aggregation with MongoDB
JavaScript
54
star
16

node-redis-scripto

Redis Script Manager for NodeJS
JavaScript
52
star
17

travis-ci-meteor-packages

Travis CI support for Meteor (Smart) Packages
JavaScript
52
star
18

open-comment-box

OpenSource Realtime Comments Platforms
JavaScript
49
star
19

horaa

Mocking NodeJS Modules
JavaScript
45
star
20

fastai-shell

A workflow to setup and use fastai on Google Cloud Platfrom
Shell
42
star
21

streams-blackboard

Realtime Blackboard with Meteor Streams
JavaScript
38
star
22

podda

Simple Reactive DataStore for JavaScript
JavaScript
33
star
23

meteor-find-faster

Faster & Efficient Implementation of Meteor's Collection.find()
JavaScript
33
star
24

meteor-streams-chat-app

Chat App with Meteor Streams
JavaScript
31
star
25

coursebook-server

JavaScript
27
star
26

coursebook-ui

Main UI for coursebook
JavaScript
26
star
27

keep-calm-and-node-on

KEEP CALM and NODE ON
23
star
28

drev

DREV - Distributed Redis based EventEmitter for NodeJS
JavaScript
21
star
29

meteor-custom-authentication-system

Custom Authentication System for Meteor
JavaScript
21
star
30

dcoinwallet

"A Bitcoin Wallet" for power users.
JavaScript
20
star
31

meteor-seo-without-spiderable

Meteor SEO support without spiderable
JavaScript
20
star
32

nextjs-e2e-demo

Next.js E2E Demo
JavaScript
19
star
33

nextjs-magic-bank

JavaScript
18
star
34

mocha-mongo

Set of mongodb testing helpers for mocha
JavaScript
18
star
35

reaktor-demo

Demo of Reaktor - New Router Syntax for FlowRouter + ReactLayout
JavaScript
18
star
36

meteor-apm-client

Application Performance Monitoring for Meteor
JavaScript
17
star
37

meteor-ssr-demo-page-rendering

Rendering Pages on the Server via meteor-ssr
JavaScript
17
star
38

nextjs-issg-example

A simple example featuring Next.js iSSG
JavaScript
15
star
39

bulletproof-next-app

JavaScript
15
star
40

jailguard

Safe Way to Run User Provided JavaScript with NodeJS
JavaScript
15
star
41

arunoda.me

My personal website + blog
JavaScript
13
star
42

hello-laika

Sample app with tests written in laika
JavaScript
11
star
43

heroku-nodejs-binary-buildback

Official NodeJS Binaries on Heroku
Shell
11
star
44

stress-test-meteor

Stress Test Meteor
JavaScript
11
star
45

pick-mongo-primary

Get MongoDB Shell command to PRIMARY from the Mongo URL
JavaScript
10
star
46

adeep

Jupyter Notebook
9
star
47

cmake-boilerplate

CMake Boilerplate for C
C
9
star
48

qbox

Quick Flow controller for NodeJS
JavaScript
9
star
49

rn-storybook

React Native storybook demo
Objective-C
9
star
50

travis-ci-laika

Travis CI support for laika
Shell
8
star
51

wait-for-mongo

Simple utility which waits until mongodb to come online
JavaScript
8
star
52

try-apollo

My first proper attempt with Apollo
JavaScript
8
star
53

learn-redux

JavaScript
7
star
54

next-apollo-demo

Simple Next.js example with Apollo
JavaScript
7
star
55

jquery-signature

Getting a unique signature for a dom event using jQuery
JavaScript
7
star
56

node-userdown

Run node apps with stepping down user permissions
JavaScript
7
star
57

awesome-blackboard

JavaScript
7
star
58

coursebook-publish

Publish lessons into coursebook
JavaScript
7
star
59

appzone-ussd-sim

Rich USSD Simulator for Appzone
JavaScript
7
star
60

marlin

Marlin firmware for My Tevo Tornado
C
6
star
61

Appzone-NodeJS

NodeJS Client for Appzone
JavaScript
6
star
62

nextjs-example-preload-data

A Next.js example with data preloading
JavaScript
6
star
63

winstoon

A Simple Wrapper for Winston
JavaScript
6
star
64

meteor-subscription-manager

Subscription Manager for Meteor
JavaScript
6
star
65

cas-pipes

MongoDB Aggregation Pipelines meets Cassandra
JavaScript
5
star
66

kgatsby

Gatsby starter for a Contentful project.
JavaScript
5
star
67

AppZone-Community-Simulator

Simulator for AppZone.lk powered by the Community
JavaScript
5
star
68

meteor-heapsave

Take Heapdumps and save them into S3
JavaScript
5
star
69

mnode

How to find the node version used by Meteor
JavaScript
5
star
70

meteor-runner

Best way to run meteor apps in production
JavaScript
4
star
71

meteor-version-playground

Play with Meteor 0.9 Package Versions
JavaScript
4
star
72

tusker

Redis Based Distributed Task Locking
JavaScript
4
star
73

lesson-nextjs-static-regeneration

JavaScript
3
star
74

telescope-client

Telescope Client Hosted on Heroku
3
star
75

datocms-hugo-portfolio-demo-4731

CSS
3
star
76

very-bad-app

Very bad app which scores 100% on lightshouse
JavaScript
3
star
77

github-cms-demo-data

Data for the Next.js blog using GitHub CMS
3
star
78

github-issue-search

Github Issue Search Meteor App
JavaScript
3
star
79

cryptocurrency

Playing with https://www.coursera.org/learn/cryptocurrency
JavaScript
3
star
80

hello-laika-discover-meteor

Laika Hello World example for the Discover Meteor Screencast
JavaScript
3
star
81

react-kode-camp-todo

A todo app used for React Kode Camp
JavaScript
2
star
82

Appzone-CMD

Command line utility for Appzone.lk platform
2
star
83

meteor-user-authorization-test-with-laika

Meteor user authorization testing with meteor
JavaScript
2
star
84

youfool.art

The Simplest NFT Platform Ever
JavaScript
2
star
85

nariya-helloworld

Nariya Helloworld App
JavaScript
2
star
86

multiuser-sms-simulator

Multiuser SMS Simulator
JavaScript
2
star
87

AppZoneSimulator

Rich Simulator for AppZone.lk
JavaScript
2
star
88

datocms-snipcart-gatsby-example-demo-6375

CSS
2
star
89

fast-render-telescope

Telescope with Fast Render (using for fast-render QA)
JavaScript
2
star
90

hibar

Intelligent JQuery
JavaScript
2
star
91

mongotest

Helper functions for testing with mongodb
JavaScript
2
star
92

meteor-rethink-hello

meteor-rethink-hello
JavaScript
2
star
93

gc-game

JavaScript
2
star
94

fashona-learnbox

Fashona LearnBox
JavaScript
2
star
95

appzone-live-test

Live Test Appzone Applications
JavaScript
2
star
96

wantrepreneur-realised

I was a Wantrepreneur, but I realised!
2
star
97

AppZone-Java-Sample

Java Maven Sample for AppZone.lk
Java
2
star
98

AppZone-Java-Client

OpenSource Java Client for AppZone.lk
Java
2
star
99

nodespy

Spy and Expectation Framework for NodeJS with Stubbing
JavaScript
2
star
100

fastai-courses

Holds notebooks related to fastai courses I'm working on
Jupyter Notebook
2
star