Skip to content

Instantly share code, notes, and snippets.

@victerryso
Last active January 20, 2016 02:02
Show Gist options
  • Save victerryso/6e1b402bd68feb39d124 to your computer and use it in GitHub Desktop.
Save victerryso/6e1b402bd68feb39d124 to your computer and use it in GitHub Desktop.
Meteor Deploy to Digital Ocean
# Sources
# johngibby.com/blog/How_to_deploy_your_meteor.js_app_on_Digital_Ocean
# stackoverflow.com/questions/20117104/mongodb-root-user
# digitalocean.com
# Create a Digital Ocean Ubuntu 14.04 Droplet
# You'll receive an email with your new IP and Password
# e.g.
# Droplet Name: dropletname
# IP Address: 000.000.000.000
# Username: root
# Password: abcdefgaah
# Variables
# IP Address: 000.000.000
# Domain Name: domain_name.com
# SSH User: root
# SSH Password: ssh_password
# App Name: app_name
# App Directory: ~/app_dir
# Mongo User: mongo_user
# Mongo Password: mongo_password
# SSH into server and setup Nginx
$ ssh root@000.000.000.000
> The authenticity of host '000.000.000.000 (000.000.000.000)' can't be established.
> RSA key fingerprint is .
> Are you sure you want to continue connecting (yes/no)?
$ sudo apt-get update
$ sudo apt-get install nginx
$ exit
# Install and configure Mup
$ cd ~/app_dir
$ mkdir .deploy
$ cd .deploy
$ npm install -g mup
$ mup init
$ vi mup.json
> {
> "servers": [
> {
> "host": "000.000.000.000",
> "username": "root",
> "password": "ssh_password"
> }
> ],
>
> "setupMongo": true,
> "setupNode": true,
> "nodeVersion": "0.10.36",
> "setupPhantom": true,
>
> "enableUploadProgressBar": true,
>
> "appName": "app_name",
> "app": "~/app_dir",
> "env": {
> "ROOT_URL": "http://localhost",
> "PORT": 3000
> },
> "deployCheckWaitTime": 15
> }
$ mup setup
$ mup deploy
# Configure Nginx
$ ssh root@000.000.000.000
$ sudo nano /etc/nginx/sites-enabled/domain_name.com.conf
> server{
> listen 80;
>
> # this could be your IP address, a subdomain or a full domain
> server_name domain_name.com;
> access_log /var/log/nginx/app.dev.access.log;
> error_log /var/log/nginx/app.dev.error.log;
> location / {
> proxy_pass http://127.0.0.1:3000;
> proxy_http_version 1.1;
> proxy_set_header Upgrade $http_upgrade;
> proxy_set_header Connection 'upgrade';
> proxy_set_header X-Forwarded-For $remote_addr;
> }
>
> }
$ sudo nano /etc/nginx/nginx.conf
# Search for "# server_tokens off;"
# Uncomment the line
$ service nginx restart
# Create Admin User to remotely login via Robomongo
$ mongo
> use admin
> db.createUser( { user: "mongo_user", pwd: "mongo_password", roles: [ "root" ] } )
# Robomongo Settings
# Connection
# Name: app_name
# Address: 127.0.0.1 : 27017
# Authentication
# Perform Authentication: true
# Database: admin
# Username: mongo_user
# Password: mongo_password
# SSH
# Address: 000.000.000.000 : 22
# Username: root
# Auth Method: password
# Password: ssh_password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment