DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Deploy Meteor App with MUP


Create VPS

First build a vps on DigitalOcean, and name it "MeteorUpEx". Get its IP address "128.199.72.xxx" at the home page of the droplet. Get its root password in you email. Add the following section into ~/.ssh/config:

Host do
Hostname 128.199.72.206
User root

Add ssh auto login with ssh-copy-id do.

Publish Meteor App

Install Meteor Up with npm install -g mup.

Create a mup project:

cd ~/docs/tmp
mkdir nfDeploy
cd nfDeploy
mup init

Now you can see a mup.json file, edit it as follows:

{
  "servers": [
    {
      "host": "128.199.72.xxx",
      "username": "root",
      "pem": "~/.ssh/id_rsa"
    }
  ],

  "setupMongo": true,
  "setupNode": true,
  "nodeVersion": "0.10.36",
  "setupPhantom": true,
  "appName": "newfairs",

  "app": "/home/chad/docs/tmp/newfairs/newfairsweb",

  "env": {
    "PORT": 80,
    "ROOT_URL": "http://niufairs.biz"
  },

  "deployCheckWaitTime": 15
}

Note that the "appName" is also the database name used by Meteor app in mongoDB. "app" is the path of your Meteor app source code folder on your local computer. mup will bundle codes in it, and publish them to host on vps.

You can only use key authentication. If you use password, an "sshpass required for password based authentication" error occurs.

Setup production environment: mup setup; Delpoy app: mup deploy;

If you use external mongodb, add "MONGO_URL" into "env" section of mup.json. For example:

"MONGO_URL": "mongodb://104.237.135.xxx:27017/meteor"

After changing the mongo url, run mup reconfig to validate the new config and restart the Meteor app.

Import Data

First dump data from database "meteor" in source mongoDB server to local machine:

mongodump -h 104.237.135.xxx -d meteor -o mynf
scp -r mynf do:~/
ssh do
cd mynf
mongorestore -d newfairs meteor

Now verify data in mongoDB of the vps with mongo newfairs.



Published

Mar 25, 2015

Last Updated

Mar 25, 2015

Category

Tech

Tags

  • meteor 47
  • mup 1
  • node 4
  • vps 5

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor