- Codebase - One codebase tracked in revision control, many deploys
- Dependencies - Explicitly declare and isolate dependencies
- Config - Store config in the environment
- Backing Services - Treat backing services as attached resources
- Build, release, run - Strictly separate build and run stages
- Processes - Execute the app as one or more stateless processes
- Port binding - Export services via port binding
- Concurrency - Scale out via the process model
- Disposability - Maximize robustness with fast startup and graceful shutdown
- Dev/prod parity - Keep development, staging, and production as similar as possible
- Logs - Treat logs as event streams
- Admin processes - Run admin/management tasks as one-off processes
Last active
December 31, 2015 12:29
-
-
Save teohm/7986198 to your computer and use it in GitHub Desktop.
- a separate repo
- store env files in repo
- or store 1 env.yml, generate env files during deployment
# env.yml
default: &default
DATABASE_URL: foo
FOO: bar
development:
<<: *default
staging:
<<: *default
DATABASE_URL: foo_staging
BAR: foo
# yaml2env.rb
require 'yaml'
YAML.load_file('env.yml').each do |env_name, vars|
File.open("env.#{env_name}", 'w') do |f|
vars.each do |key, value|
f.puts "#{key}=#{value}"
end
end
end
# Gemfile
gem 'dotenv-rails'
# .env.sample
DATABASE_URL=blablabla
# .gitignore
.env*
!.env.sample
rm config/database.yml
# .env
DATABASE_URL=sqlite3://localhost/?database=db/{app}_development.sqlite3&pool=5&timeout=5000
DATABASE_URL=postgresql://postgres@localhost/{app}_development?encoding=unicode&pool=5&timeout=5000
DATABASE_URL=mysql://root@localhost/{app}_development?encoding=unicode&pool=5&timeout=5000
S3 API seems to be the de facto interface
https://code.google.com/p/mogilefs/ http://www.quora.com/Amazon-S3/Is-there-open-source-software-that-implements-Amazon-S3-plug-compatible-storage http://stackoverflow.com/questions/9210162/is-there-a-server-that-provides-an-amazon-s3-style-api-locally
use Upstart to manage process in Ubuntu
http://dustin.sallings.org/2010/02/28/running-processes.html http://upstart.ubuntu.com/cookbook
foreman can export Upstart script, but the template seems not working now (possiblly captured the wrong process id due to nested forking.)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment