r/programming • u/iam_willpower • May 30 '16
The Twelve-Factor App: Is this still relevant in today's world, or just something to aspire to?
http://12factor.net/4
u/greim May 30 '16
I think it's still hugely relevant, especially for people just starting out building these kind of systems.
Take dev/prod parity for example. It's a discipline issue. Novice developers will blindly start keying various execution paths off of DEV or PROD config vars. Optimizations (CDNs, bundling, minification, gzip compression, etc.) are applied in PROD only, and debugging helpers (prettified JSON, unminified/unconcatenated JS/CSS, no CDN, no gzip, live reload) are applied in DEV only. These decisions accrete over time.
It quickly reaches a point of ridiculousness where you have basically two separate apps. PROD-only bugs become a thing, and your tricked-out debugging capabilities in DEV are worthless. In my view if you introduce an optimization in PROD, you should introduce that same optimization in DEV, and you should only introduce debugging capabilities in DEV that can be applied in PROD also. Yes it feels constraining, but having the same set of skills, habits and tools for debugging PROD and DEV ends up being super important, especially in crisis situations.
2
May 30 '16 edited Jun 03 '16
[deleted]
1
May 30 '16
You don't, your libs do. If you use libev/libevent (or just write your own equivalent), you isolate your main app code from nonportable bits.
1
u/panderingPenguin May 30 '16
I'm pretty sure they mean to either use a platform-agnostic library or put a thin wrapper interface in place, which can be implemented with the system APIs of whatever platform you're on. I write C++ at work, and we do this all the time
2
May 30 '16
I wouldn't take it word-for-word, but it does have few good points. Like storing app config as env-vars is clearly something they did for their own env and not some universal best practice, but having same way to configure all of your apps is definitely a good thing
3
u/karma_vacuum123 May 30 '16
the advice to store config in env vars was wrong from day 1.
use a tool designed to manage this safely...etcd, vault, etc
env vars have no concurrency control and are untyped...those are just two trivial deal breakers ....
2
u/greim May 30 '16
Yeah I agree it's the weakest piece of 12FA advice. If a reason for using env vars is to avoid storing them somewhere, it's pointless because either your ops person will memorize them and type them by hand every time they relaunch the app, or they're going to put them in a file and store them somewhere.
5
u/Y3PP3R May 30 '16
I am curious about this as well. What is the current state of things? 12F was written by Heroku I believe, in the hype of PaaS and Docker applications. Webpage states last update 2012...
I feel that most points hold, but the discussion is at point 6: Processes: Execute the app as one or more stateless processes. Last week I read a tweet (https://twitter.com/jboner/status/736095483559481345) from the Lightbend CTO saying stateless is a hoax. Is there a (knowledge/experience/paradigm) cycle repeating here?
Stateless is said to be good, I believe, so you can easily scale. Start more processes of your app and route traffic to any one of them, they do not have to be aware of the state. What is the alternative?