Deploying Web Apps 
with PaaS 
and Docker Tools 
Docker Global Hacking Weekend 
Eddie Lau (3dd13@42la.bs)
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
instead of telling what Docker is, 
I will show you 
why / when do we use it
Agenda 
• Web Application Architecture 
• Deploying Rails apps on Heroku.com 
• Deploying Rails apps with Dokku 
• Other Docker tools
Problem
publish my awesome Rails app
Solution
upload to a server
install libraries
EASY ?
Consideration
Q1: Where to deploy ?
Q1: Where to deploy ? 
• a machine at your home / office ? 
• a machine in Data Center ?
NO !!
use Cloud
Q2: How to deploy ?
we usually have 
several 3-month-size projects 
at the same time
a 3-month-size MVP project 
can be like …
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 
Files 
Application 
Log 
Server 
Monitoring 
Performance 
Monitoring
On a Ubuntu server, 
you may have to …
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 
…
If we have to do this 
12+ times a year …
NO !!
use Automation
Q3: Who ? 
Q4: What ? 
Q5: When ?
if your team 
is still setting up server manually
Change your company or 
Change your company
Cloudify 
to enhance 
automation
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 
Files 
Application 
Log 
Server 
Monitoring 
Performance 
Monitoring
I don’t want to bother with 
OTHER STUFF
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 
Files 
Application 
Log 
Server 
Monitoring 
Performance 
Monitoring
there are 
Freemium Cloud services 
out there
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 
Files 
Application 
Log 
Server 
Monitoring 
Performance 
Monitoring
Web App Components 
Web Application 
(Ruby on Rails) 
Web Frontend 
(AngularJs) 
Push Server 
(Node.js) 
Database 
(PostgreSQL) 
Search Engine 
(Elastic Search) 
RDS 
Object Cache 
Redis To Go 
(Redis) 
Search Box 
Static Asset 
s3 
Files 
Application 
Log Entries 
Log 
Server 
Monitoring 
Performance 
New Relic 
Pusher Monitoring 
UptimeRobot
How about 
coding runtime environment 
setup?
PaaS
Demo: Heroku
• 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
Heroku is awesome
BUT
you will grow to a point …
Expensive 
Lost control 
Slow
so How ?
Office 
Machine 
Data 
Center 
Cloud 
Server 
Heroku ?
I want my own server 
with total control 
but less hassle
Office 
Machine 
Data 
Center 
Cloud 
Server 
? Heroku 
total control 
but less hassle ?
Docker
Demo: Dokku
There are other advantages 
than just automation too: 
https://www.docker.com/whatisdocker/
We still use heroku heavily. 
but for some growing projects, 
we start using Docker
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
Dev Tools 
Fig - Isolated development environment 
• http://www.fig.sh/rails.html 
• https://github.com/docker/fig
Docker Management 
Interface 
Panamax - Web interface 
• http://panamax.io/
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
Questions ? 
mailto:3dd13@42la.bs 
https://www.linkedin.com/in/3dd13 
http://github.com/3dd13 
http://3dd13.me

Deploying Web Apps with PaaS and Docker Tools

  • 1.
    Deploying Web Apps with PaaS and Docker Tools Docker Global Hacking Weekend Eddie Lau (3dd13@42la.bs)
  • 2.
    Me Founder of42 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
  • 3.
    instead of tellingwhat Docker is, I will show you why / when do we use it
  • 4.
    Agenda • WebApplication Architecture • Deploying Rails apps on Heroku.com • Deploying Rails apps with Dokku • Other Docker tools
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
    Q1: Where todeploy ?
  • 13.
    Q1: Where todeploy ? • a machine at your home / office ? • a machine in Data Center ?
  • 14.
  • 15.
  • 16.
    Q2: How todeploy ?
  • 17.
    we usually have several 3-month-size projects at the same time
  • 18.
    a 3-month-size MVPproject can be like …
  • 19.
    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 Files Application Log Server Monitoring Performance Monitoring
  • 20.
    On a Ubuntuserver, you may have to …
  • 21.
    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 …
  • 22.
    If we haveto do this 12+ times a year …
  • 23.
  • 24.
  • 25.
    Q3: Who ? Q4: What ? Q5: When ?
  • 26.
    if your team is still setting up server manually
  • 27.
    Change your companyor Change your company
  • 28.
  • 29.
    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 Files Application Log Server Monitoring Performance Monitoring
  • 30.
    I don’t wantto bother with OTHER STUFF
  • 31.
    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 Files Application Log Server Monitoring Performance Monitoring
  • 32.
    there are FreemiumCloud services out there
  • 33.
    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 Files Application Log Server Monitoring Performance Monitoring
  • 34.
    Web App Components Web Application (Ruby on Rails) Web Frontend (AngularJs) Push Server (Node.js) Database (PostgreSQL) Search Engine (Elastic Search) RDS Object Cache Redis To Go (Redis) Search Box Static Asset s3 Files Application Log Entries Log Server Monitoring Performance New Relic Pusher Monitoring UptimeRobot
  • 35.
    How about codingruntime environment setup?
  • 36.
  • 37.
  • 38.
    • Generate newrails 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
  • 39.
  • 40.
  • 41.
    you will growto a point …
  • 42.
  • 43.
  • 44.
    Office Machine Data Center Cloud Server Heroku ?
  • 45.
    I want myown server with total control but less hassle
  • 46.
    Office Machine Data Center Cloud Server ? Heroku total control but less hassle ?
  • 47.
  • 48.
  • 49.
    There are otheradvantages than just automation too: https://www.docker.com/whatisdocker/
  • 50.
    We still useheroku heavily. but for some growing projects, we start using Docker
  • 51.
  • 52.
    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
  • 53.
    Dev Tools Fig- Isolated development environment • http://www.fig.sh/rails.html • https://github.com/docker/fig
  • 54.
    Docker Management Interface Panamax - Web interface • http://panamax.io/
  • 55.
    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
  • 56.
    Questions ? mailto:3dd13@42la.bs https://www.linkedin.com/in/3dd13 http://github.com/3dd13 http://3dd13.me