Brett McLain
Application Systems Architect
PotashCorp
SaaS application that uses Twilio to send SMS and phone calls to devices that connect to the cell phone network.
MeteorJS (runs on Node.js)
MongoDB
Flot Charts
Twitter Bootstrap
Production deployments are NodeJS applications.
Meteor has it’s own package manager called isobuild. Extremely similar to NPM.
Meteor can also use NPM packages now on the client or server (as of version 1.3).
Supports ECMAScript 6 (ES 2015).
Meteor Up (mup) - Meteor deployment plugin.
I use Meteor Up (mup) for deployments.
Single command to build and deploy code to an unlimited number of servers in a rolling fashion.
Installs all necessary software automatically (NodeJS, npm, MeteorJS, docker, nginx, mongo).
Setups up an nginx reverse proxy in front of a docker instance for meteor and a docker instance for mongo.
{
// Server authentication info
"servers": [
{
"host": "localhost",
"username": "ubuntu",
"pem": "~/RelaySupply.pem"
}
],
// Install MongoDB in the server, does not destroy local MongoDB on future setup
"setupMongo": false,
// 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.40",
// Application name (No spaces)
"appName": "RelaySupplyControlPanel",
// Configure environment
"env": {
"PORT": 80,
"ROOT_URL": "https://controlpanel.relaysupply.com",
"MONGO_URL": "mongodb://10.0.2.151:27017,10.0.3.138:27017,10.0.4.44:27017/relaysupply-prod",
"MONGO_OPLOG_URL": "mongodb://10.0.2.151:27017,10.0.3.138:27017,10.0.4.44:27017/local",
"DISABLE_WEBSOCKETS": "0",
"CLUSTER_BALANCER_URL": "REPLACE_ME",
"CLUSTER_DISCOVERY_URL": "mongodb://10.0.2.151:27017/relaysupply-prod",
"CLUSTER_SERVICE": "web",
},
// 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": 60,
"ssl": {
"certificate": "./.prod/fullchain.pem",
"key": "./.prod/privkey.pem",
"port": 443
}
}
Provides clustering capability within Meteor JS apps.
Meteor Cluster is a regular meteor package.
2 Load Balancers, 2 DDP Servers
Load balancer servers are pointed to by DNS records.
Once the client connects to a load balancer server, it *might* receive the address of a DDP server to share out the load.
Supports clustering of microservices too!
So...now what?
Low Cost!
Availability
Performance
Originally hosted everything (prod, dev, mongo, reverse proxy) on a single Virtual Private Server (VPS).
I have past experience with Amazon, it’s well documented, tons of tools.
Google *appears* pricier, less tools.
Digital Ocean…?
EC2 (Elastic Compute Cloud)
Elastic Bean Stalk
Elastic Load Balancers
Route 53 (DNS)
OpsWorks
CloudFormation
Elastic Block Store
The list goes on!
On demand infrastructure.
Amazon Machine Image (AMI) of many popular operating systems, platforms, community images, etc.
Reserved Instances - t2.micro = $0.006/hour - 3 year contract. Relatively cheap.
Spot instances (bid for unused servers @ 80% of cost).
Can apply auto-scaling groups.
Fairly basic...let's see what else Amazon has!
Elastic Beanstalk is a Platform as a Service (PaaS) that handles the complexities of your underlying infrastructure.
Manages load balancing (via ELBs), instance scaling, instance health monitoring, and deployments.
Auto scaling occurs when average CPU > 70% for 2 minutes.
When auto scaling occurs in either auto scaling group, it creates a new instance using the same image.
That image runs a script on boot...