monterail / guidelines

[DEPRECATED] We are Ruby on Rails experts from Poland. Think hussars. Solid & winged. These are our guidelines.
71 stars 17 forks source link

12 factor rules #190

Closed jandudulski closed 10 years ago

jandudulski commented 10 years ago

I think that 12 factor are solid, well described rules which we can recommend to follow in our guidelines. They describes 12 aspects how apps should be developed, run and maintained during development.

teamon commented 10 years ago

I. Codebase - One codebase tracked in revision control, many deploys

git, done

II. Dependencies - Explicitly declare and isolate dependencies

Gemfile + rails-assets, done

III. Config - Store config in the environment

Figaro, dotenv, hsr config, done

IV. Backing Services - Treat backing services as attached resources

Her, Faraday, Drivers/Adapters, any questions here?

V. Build, release, run - Strictly separate build and run stages

we do not build, only release, one click/command in most cases

VI. Processes - Execute the app as one or more stateless processes

Procfile, hsr ps, you name it, done

VII. Port binding - Export services via port binding

hsr - done

VIII. Concurrency - Scale out via the process model

hsr scale (but puma/jruby/sidekiq -> threading is also good)

IX. Disposability - Maximize robustness with fast startup and graceful shutdown

fast startup -> derailed!, graceful - sidekiq retry

X. Dev/prod parity - Keep development, staging, and production as similar as possible

Not gonna happen until docker for osx is fully operational, for now it's *NIX - not bad

XI. Logs - Treat logs as event streams

hsr logs, gem 'rails_12factor' redirects logs to stdout - done

XII. Admin processes - Run admin/management tasks as one-off processes

hsr run, done

jandudulski commented 10 years ago

Sure, we follow these rules, but I think it's not a bad idea to have close at hand well described reasons behind :) - for us, for newcomers or whatever.

teamon commented 10 years ago

Make PR plz :)

sheerun commented 10 years ago

Here is PaaS, based on those principles:

http://docs.deis.io/en/latest/

On Wed, Jan 15, 2014 at 9:11 PM, Jan Dudulski notifications@github.comwrote:

I think that 12 factor http://12factor.net/ are solid, well described rules which we can recommend to follow in our guidelines. They describes 12 aspects how apps should be developed, run and maintained during development.

— Reply to this email directly or view it on GitHubhttps://github.com/monterail/guidelines/issues/190 .

sheerun commented 10 years ago

Another aspect of config management is grouping. Sometimes apps batch config into named groups (often called “environments”) named after specific deploys, such as the development, test, and production environments in Rails.

This method does not scale cleanly: as more deploys of the app are created, new environment names are necessary, such as staging or qa. As the project grows further, developers may add their own special environments like joes-staging, resulting in a combinatorial explosion of config which makes managing deploys of the app very brittle.

We could take this guideline to the heart, and do not use environments like staging (just dev, test, and production).

Ostrzy commented 10 years ago

There is problem that staging is somewhat mixed development and production. You wish that everything works just like in prod to test it, but you also do not want production keys for things like s3 for upload or payments.

sheerun commented 10 years ago

That's what configuration is for

teamon commented 10 years ago

RAILS_ENV=staging is mostly for convenience to distinguish it from production (e.g. in tools like sentry)

(btw, nowdays most PaaSes are 12-factor.)

teamon commented 10 years ago

btw @jandudulski, prprprprprprprprprpr!

jandudulski commented 10 years ago

I was waiting for moar input ;)

sheerun commented 10 years ago

I think the only way to add this to guidelines is to describe each factor having in mind Rails..

This is far too general.

teamon commented 10 years ago

There is also difference between applying 12factor to rails app and to infrastructure. I think we should stick to rails app side here.

sheerun commented 10 years ago

Yeah, @teamon explanations are weird mix of infrastructure and application customs

sheerun commented 10 years ago

I see here codetunes article

teamon commented 10 years ago

Anyone interested in this one? I personally think mentioning rails 12 factor in guidelines is enough.

jandudulski commented 10 years ago

PR added

teamon commented 10 years ago

@jandudulski diff is kinda weird...

jandudulski commented 10 years ago

removed trailing spaces, sorry ;]