Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mini-Heroku "Dokku"

morizyun
October 14, 2016

Mini-Heroku "Dokku"

It is about private PaaS "Dokku"!

morizyun

October 14, 2016
Tweet

More Decks by morizyun

Other Decks in Programming

Transcript

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

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

    repository) • buildstep(buildpack emulates Heroku build) • bash script git push => buildpack => ίϤϷ΄containerΨ build => nginx 奺ኧͽweb΁ل樄
  4. 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
  5. 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
  6. 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 -
  7. 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