Mini-Heroku "Dokku"

82827b046babc7a4d4c54b8b96fee67a?s=47 morizyun
October 14, 2016

Mini-Heroku "Dokku"

It is about private PaaS "Dokku"!

82827b046babc7a4d4c54b8b96fee67a?s=128

morizyun

October 14, 2016
Tweet

Transcript

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

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

  3. Heroku ΄僻ාᇇ΄ϔϮϷϐϕ • US/UK΁ͭ͡ςЄϝ͢僻͚ => ॡଘ၇ཞෙ΁200-300ms ֖ϹφϪЀφ͢͡͡Ρ • 30ړզӤίμψφͭ΀͚;φϷЄϤᇫ䙪΁΀Ρ (ࢧ᭿ᒽ

    ͘Π) • 僻ාͶ; PostgreSQL ΁1ӡϹπЄϖզӤጭ梍ͽͣ΀͚ (ࢧ᭿ᒽ͘Π) • cronጱ΀㳌ቘΨͯΡ͵Η΁΅㳨΄ workerϤϺψφ Ψ㵕 ͯ͡஠ᥝ͘͢Ρ
  4. 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
  5. Dokku Architecture • nginx • Docker • git (docker image

    repository) • buildstep(buildpack emulates Heroku build) • bash script git push => buildpack => ίϤϷ΄containerΨ build => nginx 奺ኧͽweb΁ل樄
  6. 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
  7. 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 git@github.com:heroku/ruby-rails-sample.git # Add remote repository to git git remote add dokku dokku@dokku.me: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
  8. Sample application • https://workshop.morizyun.com • ܎ଙͥΟ͚晁አͭͼय़ͣ΀ϕ϶ϣϸ僻ͭ

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

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

  11. 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 -
  12. ͚ͩ͜͜ίϤϷ͢ݻ͚ͼ͚Ρ • cron;͡ΨϥϠЄ΁ֵ͚͵̶͚ϔЄόᰁ͘͢Ρ ᑕଶग़͚ • Ϥ϶αϦЄϕϚϐϕϼЄμٖ΄PaaS;ͭͼֵ͚ ͵͚ • 樄咲Ӿ΄ branch

    ΄嘦扯አ;ͭͼֵ͚͵͚
  13. 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