heroku git push deploy@paas taiwan meetup #2
DESCRIPTION
Heroku introduction and twelve factor app@ PaaS TaiwanTRANSCRIPT
git push deploy
PaaS TW Meetup #2
/her-OH-koo/
!
PHP / WordPress Developer Rails newbie
@uchengwang
王昱程Wang Yu-Cheng
http://spectator.do
How Heroku Works Twelve-Factor App
Get Start1.Sign up2.Install the Heroku Toolbelt3.Create your app
heroku
localgit push
slug compilerslug
launch
dyno dyno
scale scale …stack stack
Creative Commons – Attribution (CC BY 3.0) Box designed by Nono Martínez Alonso from the Noun Project
compiled
Stack
OS(ubuntu) language runtime
libraries
Buildpack
config
You can run anything!
dyno
• Isolated
• Self-healing
• Read-only
• Stateless
• Recycle every 24hrs
Twelve-Factor Apphttp://12factor.net
scalabilityportability
productivity
One codebase tracked in revision control, many deploys.
I. Codebase
One codebase, one app
Explicitly declare and isolate dependencies
II. DependenciesGemfile =>dependency declarationBundle exec => dependency isolation
III. Config
Store config in the environment
An app’s config is everything that is likely to vary between deploys (staging, production, developer environments, etc).
Don’t check in to the codebase
IV. Backing Services
Treat backing services as attached resources
IV. Backing Servicescon’t
V. Build, release, run
Strictly separate build and run stages
VI. Processes
stateless processes
share-nothing processes
VII. Port binding
Export services via port binding
Containerless
Add web server by dependency declaration
VIII. Concurrency
Scale out via the process model
IX. Disposability
Fast startup
Graceful shutdown
XI. Logs
Treat logs as event streams
Write logs to file
X. Dev/prod parity
Development = Staging = Production
Time gapPersonal gapTool gap
Design for continuous deployment
XII. Admin processes
Run admin/management tasks as one-off processes
bundle exec rake db:migrate
How about Docker?
Docker Heroku
dockerfile buildpack
image slug
container dyno
docker client heroku client
docker registry add-on
http://tuhrig.de/docker-vs-heroku/
https://github.com/progrium/dokku