56
Deploying Web Apps with PaaS and Docker Tools Docker Global Hacking Weekend Eddie Lau ([email protected] )

Deploying Web Apps with PaaS and Docker Tools

Embed Size (px)

DESCRIPTION

share why and when 42 Labs use Heroku or Dockerized Server Docker Hong Kong Meetup - Docker Hack Day 2014 Sharing

Citation preview

Page 1: Deploying Web Apps with PaaS and Docker Tools

Deploying Web Apps

with PaaS

and Docker Tools

Docker Global Hacking Weekend

Eddie Lau ([email protected])

Page 2: Deploying Web Apps with PaaS and Docker Tools

Me

Founder of 42 Labs (http://www.42la.bs)

Software Consultancy for Tech Startups

Online Portfolio

https://www.linkedin.com/in/3dd13

http://github.com/3dd13

http://3dd13.me

Page 3: Deploying Web Apps with PaaS and Docker Tools

instead of telling what Docker is,

I will show you

why / when do we use it

Page 4: Deploying Web Apps with PaaS and Docker Tools

Agenda

• Web Application Architecture

• Deploying Rails apps on Heroku.com

• Deploying Rails apps with Dokku

• Other Docker tools

Page 5: Deploying Web Apps with PaaS and Docker Tools

Problem

Page 6: Deploying Web Apps with PaaS and Docker Tools

publish my awesome Rails app

Page 7: Deploying Web Apps with PaaS and Docker Tools

Solution

Page 8: Deploying Web Apps with PaaS and Docker Tools

upload to a server

Page 9: Deploying Web Apps with PaaS and Docker Tools

install libraries

Page 10: Deploying Web Apps with PaaS and Docker Tools

EASY ?

Page 11: Deploying Web Apps with PaaS and Docker Tools

Consideration

Page 12: Deploying Web Apps with PaaS and Docker Tools

Q1: Where to deploy ?

Page 13: Deploying Web Apps with PaaS and Docker Tools

Q1: Where to deploy ?

• a machine at your home / office ?

• a machine in Data Center ?

Page 14: Deploying Web Apps with PaaS and Docker Tools

NO !!

Page 15: Deploying Web Apps with PaaS and Docker Tools

use Cloud

Page 16: Deploying Web Apps with PaaS and Docker Tools

Q2: How to deploy ?

Page 17: Deploying Web Apps with PaaS and Docker Tools

we usually have

several 3-month-size projects

at the same time

Page 18: Deploying Web Apps with PaaS and Docker Tools

a 3-month-size MVP project

can be like …

Page 19: Deploying Web Apps with PaaS and Docker Tools

Web App Components

Web Application

(Ruby on Rails)

Web Frontend

(AngularJs)

Push Server

(Node.js)

Database

(PostgreSQL)Search Engine

(Elastic Search)Object Cache

(Redis)Static Asset

FilesApplication

Log

Server

Monitoring

Performance

Monitoring

Page 20: Deploying Web Apps with PaaS and Docker Tools

On a Ubuntu server,

you may have to …

Page 21: Deploying Web Apps with PaaS and Docker Tools

sudo apt-get update

sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3

libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libgdbm-dev libncurses5-dev automake

libtool bison libffi-dev …….

# install ruby

# install rails

# install nodejs

# setup postgresql

# init postgresql DB

# setup user account

# setup environment variables

# setup web server

# setup app server

Page 22: Deploying Web Apps with PaaS and Docker Tools

If we have to do this

12+ times a year …

Page 23: Deploying Web Apps with PaaS and Docker Tools

NO !!

Page 24: Deploying Web Apps with PaaS and Docker Tools

use Automation

Page 25: Deploying Web Apps with PaaS and Docker Tools

Q3: Who ?

Q4: What ?

Q5: When ?

Page 26: Deploying Web Apps with PaaS and Docker Tools

if your team

is still setting up server manually

Page 27: Deploying Web Apps with PaaS and Docker Tools

Change your company or

Change your company

Page 28: Deploying Web Apps with PaaS and Docker Tools

Cloudify

to enhance

automation

Page 29: Deploying Web Apps with PaaS and Docker Tools

Web App Components

Web Application

(Ruby on Rails)

Web Frontend

(AngularJs)

Push Server

(Node.js)

Database

(PostgreSQL)Search Engine

(Elastic Search)Object Cache

(Redis)Static Asset

FilesApplication

Log

Server

Monitoring

Performance

Monitoring

Page 30: Deploying Web Apps with PaaS and Docker Tools

I don’t want to bother with

OTHER STUFF

Page 31: Deploying Web Apps with PaaS and Docker Tools

Web App Components

Web Application

(Ruby on Rails)

Web Frontend

(AngularJs)

Push Server

(Node.js)

Database

(PostgreSQL)Search Engine

(Elastic Search)Object Cache

(Redis)Static Asset

FilesApplication

Log

Server

Monitoring

Performance

Monitoring

Page 32: Deploying Web Apps with PaaS and Docker Tools

there are

Freemium Cloud services

out there

Page 33: Deploying Web Apps with PaaS and Docker Tools

Web App Components

Web Application

(Ruby on Rails)

Web Frontend

(AngularJs)

Push Server

(Node.js)

Database

(PostgreSQL)Search Engine

(Elastic Search)Object Cache

(Redis)Static Asset

FilesApplication

Log

Server

Monitoring

Performance

Monitoring

Page 34: Deploying Web Apps with PaaS and Docker Tools

Web App Components

Web Application

(Ruby on Rails)

Web Frontend

(AngularJs)

Push Server

(Node.js)

Database

(PostgreSQL)Search Engine

(Elastic Search)Object Cache

(Redis)Static Asset

FilesApplication

Log

Server

Monitoring

Performance

MonitoringPusher

RDS

Search Box

Redis To Go

Log Entries

s3

New RelicUptimeRobot

Page 35: Deploying Web Apps with PaaS and Docker Tools

How about

coding runtime environment

setup?

Page 36: Deploying Web Apps with PaaS and Docker Tools

PaaS

Page 37: Deploying Web Apps with PaaS and Docker Tools

Demo: Heroku

Page 38: Deploying Web Apps with PaaS and Docker Tools

• Generate new rails app

rails new docker-hk-meetup —database=postgresql

cd docker-hk-meetup

rails generate controller home index

• initialize git

git init

git add -A

git commit -m “initial commit”

• create a heroku app

heroku create docker-hk-meetup

• publish

git push heroku master

• available online !

heroku open

Page 39: Deploying Web Apps with PaaS and Docker Tools

Heroku is awesome

Page 40: Deploying Web Apps with PaaS and Docker Tools

BUT

Page 41: Deploying Web Apps with PaaS and Docker Tools

you will grow to a point …

Page 42: Deploying Web Apps with PaaS and Docker Tools

Expensive

Lost control

Slow

Page 43: Deploying Web Apps with PaaS and Docker Tools

so How ?

Page 44: Deploying Web Apps with PaaS and Docker Tools

Office

Machine

Data

Center

Cloud

ServerHeroku ?

Page 45: Deploying Web Apps with PaaS and Docker Tools

I want my own server

with total control

but less hassle

Page 46: Deploying Web Apps with PaaS and Docker Tools

Office

Machine

Data

Center

Cloud

ServerHeroku?

total control

but less hassle ?

Page 47: Deploying Web Apps with PaaS and Docker Tools

Docker

Page 48: Deploying Web Apps with PaaS and Docker Tools

Demo: Dokku

Page 49: Deploying Web Apps with PaaS and Docker Tools

There are other advantages

than just automation too:

https://www.docker.com/whatisdocker/

Page 50: Deploying Web Apps with PaaS and Docker Tools

We still use heroku heavily.

but for some growing projects,

we start using Docker

Page 51: Deploying Web Apps with PaaS and Docker Tools

Docker Tools

Page 52: Deploying Web Apps with PaaS and Docker Tools

PaaS

Dokku - private heroku

• https://github.com/progrium/dokku

Octohost - private heroku

• http://octohost.io/

Deis - like Dokku for server cluster

• https://github.com/deis/deis

Flynn - like Dokku for server cluster

• https://github.com/flynn/flynn

Page 53: Deploying Web Apps with PaaS and Docker Tools

Dev Tools

Fig - Isolated development environment

• http://www.fig.sh/rails.html

• https://github.com/docker/fig

Page 54: Deploying Web Apps with PaaS and Docker Tools

Docker Management

Interface

Panamax - Web interface

• http://panamax.io/

Page 55: Deploying Web Apps with PaaS and Docker Tools

Manage Cluster

Serf - cluster membership by gossip notification

• https://www.serfdom.io/

• https://github.com/hashicorp/serf

Shipyard - Multi-host cluster Docker management

• http://shipyard-project.com/

• https://github.com/shipyard/shipyard

Page 56: Deploying Web Apps with PaaS and Docker Tools

Questions ?

mailto:[email protected]

https://www.linkedin.com/in/3dd13

http://github.com/3dd13

http://3dd13.me