Quantcast
Channel: 懒得折腾
Viewing all articles
Browse latest Browse all 764

DigitalOcean ❤ Meteor

$
0
0

DigitalOcean ❤ Meteor

WHY?

You need to deploy Meteor app on DigitalOcean without tearing you hair.

SERVER SIDE (PRODUCTION)

#1 Signup for DigitalOcean

Click here and get your $10 credit (ref for my cats food!)

#2 Create new droplet with Ubuntu

No worry. We’ll install Node.js later (via Meteor Up).

#3 Login to server via local Terminal

Which xxx.xxx.xxx.xxx is your IP you saw in DigitalOcean dashboard.

$ ssh root@xxx.xxx.xxx.xxx

If it’s first time. You will need to accept (type “yes”) then enter passwordthat appear in your email which sent from Digital Ocean. Change default password to your desired one then goto next step.

#4 Make sure everything fresh

# sudo apt-get update

LOCAL SIDE (DEVELOPMENT)

Back to our save development zone

#1 Install Meteor via Terminal

Actually #2 will do this automatically but just in case. ;)

$ curl https://install.meteor.com/ | sh

#2 Get Meteor Todos example

$ meteor create --example todos

#3 Install Meteor Up (mup)

$ sudo npm install -g mup

You’ll see something like…

/usr/local/bin/mup -> /usr/local/lib/node_modules/mup/bin/mup
mup@0.11.1 /usr/local/lib/node_modules/mup
├── colors@0.6.2
├── underscore@1.7.0
├── uuid@1.4.2
├── async@0.9.2
├── archiver@0.14.4 (buffer-crc32@0.2.5, lazystream@0.1.0, readable-stream@1.0.33, tar-stream@1.1.5, lodash@3.2.0, zip-stream@0.5.2, glob@4.3.5)
├── rimraf@2.4.2 (glob@5.0.14)
├── cjson@0.3.1 (jsonlint@1.6.0)
└── nodemiral@1.1.0 (progress@1.1.5, debug@0.7.4, async@0.9.0, underscore@1.8.3, ejs@0.8.8, ssh2@0.4.6)

#4 mup + todos

$ cd todos
$ mup init

You’ll get mup.json

Meteor Up: Production Quality Meteor Deployments
 — — — — — — — — — — — — — — — — — — — — — — — —
Empty Project Initialized!

#5 Config mup.json

Config your host, username, password, app, env.ROOT_URL to match your environment. (or pem if you feeling brave)

{
 // Server authentication info
 "servers": [
 {
 "host": "xxx.xxx.xxx.xxx",
 "username": "root",
 "password": "your_password"
 // or pem file (ssh based authentication)
 //"pem": "~/.ssh/id_rsa"
 }
 ],
 // Install MongoDB in the server, does not destroy local MongoDB on future setup
 "setupMongo": true,
// WARNING: Node.js is required! Only skip if you already have Node.js installed on server.
 "setupNode": true,
// WARNING: If nodeVersion omitted will setup 0.10.36 by default. Do not use v, only version number.
 "nodeVersion": "0.10.36",
// Install PhantomJS in 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)
 "app": ".",
// Configure environment
 "env": {
 "ROOT_URL": "http://xxx.xxx.xxx.xxx"
 },
// Meteor Up checks if the app comes online just after the deployment
 // before mup checks that, it will wait for no. of seconds configured below
 "deployCheckWaitTime": 15
}

#6 Setup mup on server

$ mup setup

You’ll see…

Meteor Up: Production Quality Meteor Deployments
 — — — — — — — — — — — — — — — — — — — — — — — —
Started TaskList: Setup (linux)
[xxx.xxx.xxx.xxx] — Installing Node.js
[xxx.xxx.xxx.xxx] — Installing Node.js: SUCCESS
[xxx.xxx.xxx.xxx] — Installing PhantomJS
[xxx.xxx.xxx.xxx] — Installing PhantomJS: SUCCESS
[xxx.xxx.xxx.xxx] — Setting up Environment
[xxx.xxx.xxx.xxx] — Setting up Environment: SUCCESS
[xxx.xxx.xxx.xxx] — Copying MongoDB configuration
[xxx.xxx.xxx.xxx] — Copying MongoDB configuration: SUCCESS
[xxx.xxx.xxx.xxx] — Installing MongoDB
[xxx.xxx.xxx.xxx] — Installing MongoDB: SUCCESS
[xxx.xxx.xxx.xxx] — Configuring upstart
[xxx.xxx.xxx.xxx] — Configuring upstart: SUCCESS

#7 Deploy mup to server

$ mup deploy

You’ll see something like…

Meteor Up: Production Quality Meteor Deployments
 — — — — — — — — — — — — — — — — — — — — — — — —
" Checkout Kadira!
 It’s the best way to monitor performance of your app.
 Visit: https://kadira.io/mup "
Building Started: .
Started TaskList: Deploy app 'todos' (linux)
[xxx.xxx.xxx.xxx] — Uploading bundle
Started TaskList: Deploy app 'todos' (linux)
[xxx.xxx.xxx.xxx] - Uploading bundle
[xxx.xxx.xxx.xxx] - Uploading bundle: SUCCESS
[xxx.xxx.xxx.xxx] - Setting up Environment Variables
[xxx.xxx.xxx.xxx] - Setting up Environment Variables: SUCCESS
[xxx.xxx.xxx.xxx] - Invoking deployment process
[xxx.xxx.xxx.xxx] - Invoking deployment process: SUCCESS

#8 Smile!

Yes it’s done! :D Let’s try open http://xxx.xxx.xxx.xxx on your favourite browser you should it live!

Happy Coding! :D



Viewing all articles
Browse latest Browse all 764

Trending Articles