Presented by @aymericbrisse
Semantic Web & Ruby enthusiast
One codebase tracked in revision control, many deploys
Explicitly declare and isolate dependencies
bundle install
bundle exec
Store config in the environment
Treat backing services as attached resources
Strictly separate build and run stages
Execute the app as one or more stateless processes
Export services via port binding
upstream api {
server 172.17.0.1:5000; # application port binding
server 172.17.0.2:5000;
}
server {
listen 80;
server_name api.clermontech.org;
root /usr/local/share/api;
location / {
proxy_pass http://api; # match the name of upstream directive which is defined above
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Scale out via the process model
Maximize robustness with fast startup and graceful shutdown
Keep development, staging, and production as similar as possible
Traditional app | Twelve-factor app | |
---|---|---|
Time between deploys | Weeks | Hours |
Code authors vs code deployers | Different people | Same people |
Dev vs production environments | Divergent | As similar as possible |
Treat logs as event streams
Run admin/management tasks as one-off processes
rake db:migrate
manage.py syncdb
irb
rails console
python
php scripts/fix_bad_records.php
bundle exec rake db:migrate
bin/python manage.py syncdb