Slide 1

Slide 1 text

Mini-Heroku "Dokku" Japanese: @zyunnosuke English: @morizyune

Slide 2

Slide 2 text

By the way... • ᪁ޱίϤϷ΅ίϤϷͶͧ΁ᵞӾͭ͵͚ • Heroku ΅ git πϫЀϖͽϔϤϺα͢ͽͣͼ䮭

Slide 3

Slide 3 text

Heroku ΄僻ාᇇ΄ϔϮϷϐϕ • US/UK΁ͭ͡ςЄϝ͢僻͚ => ॡଘ၇ཞෙ΁200-300ms ֖ϹφϪЀφ͢͡͡Ρ • 30ړզӤίμψφͭ΀͚;φϷЄϤᇫ䙪΁΀Ρ (ࢧ᭿ᒽ ͘Π) • 僻ාͶ; PostgreSQL ΁1ӡϹπЄϖզӤጭ梍ͽͣ΀͚ (ࢧ᭿ᒽ͘Π) • cronጱ΀㳌ቘΨͯΡ͵Η΁΅㳨΄ workerϤϺψφ Ψ㵕 ͯ͡஠ᥝ͘͢Ρ

Slide 4

Slide 4 text

About "Dokku" • πЀψϤϕ΅̿Docker powered mini-Heroku in around 100 lines of Bash̀ • Heroku;֒͵build΄՛奲Εͽ̵Ruby̵Java̵ Scala̵Go̵DockerᒵϔϤϺαͽͣΡ • ubuntu 14.04 ΁ 2πϫЀϖͽαЀφϕЄϸͽͣΔͯ $ wget https://raw.githubusercontent.com/dokku/ dokku/v0.7.2/bootstrap.sh $ sudo DOKKU_TAG=v0.7.2 bash bootstrap.sh

Slide 5

Slide 5 text

Dokku Architecture • nginx • Docker • git (docker image repository) • buildstep(buildpack emulates Heroku build) • bash script git push => buildpack => ίϤϷ΄containerΨ build => nginx 奺ኧͽweb΁ل樄

Slide 6

Slide 6 text

Deploy Flow (1) • on your Dokku host: # Create the app dokku apps:create ruby-rails-sample # Plugin installation requires root, hence the user change sudo dokku plugin:install https://github.com/dokku/dokku- postgres.git # Create a postgres service with the name rails-database dokku postgres:create rails-database # Linking backing services to applications dokku postgres:link rails-database ruby-rails-sample

Slide 7

Slide 7 text

Deploy Flow (2) • From your local machine: # get command line tool(like herokutoolbelt) gem install dokku-cli # get Heroku Ruby on Rails example app git clone [email protected]:heroku/ruby-rails-sample.git # Add remote repository to git git remote add dokku [email protected]:ruby-rails-sample # Set secret key bundle exec rake secret dokku config:set SECRET_KEY_BASE=xxx # Deploy the app (Zero downtime) git push dokku master

Slide 8

Slide 8 text

Sample application • https://workshop.morizyun.com • ܎ଙͥΟ͚晁አͭͼय़ͣ΀ϕ϶ϣϸ僻ͭ

Slide 9

Slide 9 text

Many Plugins • Elasticsearch̵PostgreSQL̵https䌏䖕̵ϦЄτϐμ扯戣;͡

Slide 10

Slide 10 text

Digital Ocean • $25 Coupon - http://www.newcoupons.info/ digitalocean-free-25usd-credit/

Slide 11

Slide 11 text

Dokku ϔϮϷϐϕ • μ϶φό䯤౮΅ͽͣ΀͚(๜ኾςЄϠφ΁΅㷗ͭͳ͜) • ςЄϝ͢஠ᥝ(͠ᰂ͢͡͡Ρ) • Heroku΄Ξ͜΁ϮЀϓπφϕ͢ωϺ;΅͚͡΀͚ • ͵Δ΁ Ruby ΄ DLͽε϶Є͢ڊΡ(厏ह䄜හ CURL_TIMEOUT, CURL_CONNECT_TIMEOUT Ψ晒ଶ΁槱ͥ) 'curl -L --fail --retry 3 --retry-delay 1 --connect-timeout 3 --max- time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/ cedar-14/ruby-2.3.1.tgz -s -o - | tar zxf -

Slide 12

Slide 12 text

͚ͩ͜͜ίϤϷ͢ݻ͚ͼ͚Ρ • cron;͡ΨϥϠЄ΁ֵ͚͵̶͚ϔЄόᰁ͘͢Ρ ᑕଶग़͚ • Ϥ϶αϦЄϕϚϐϕϼЄμٖ΄PaaS;ͭͼֵ͚ ͵͚ • 樄咲Ӿ΄ branch ΄嘦扯አ;ͭͼֵ͚͵͚

Slide 13

Slide 13 text

Let's try!! • Ubuntu ΄厏ह䯤塈ಋ殼 • http://blog.morizyun.com/posts/dokku-isntall-vultr-pass-mini-heroku • Digital Ocean Ύ΄ϔϤϺα • http://morizyun.github.io/blog/dokku-postgresql-rails-digital-ocean/ • Cron ΄ֵ͚ො • https://blog.morizyun.com/posts/dokku-cron-etire-exist-containt- docker-schedule