8 ms·
The Twelve-Factor App (2011)
- DLion 5y agoI prefer the 15-factor app, as evolution of the 12: https://domenicoluciani.com/2021/10/30/15-factor-app.html https://domenicoluciani.com/2021/10/30/15-factor-app.html
- zmmmmm 5y agoThe three extra ones seem like good areas to think about but low effort and not well defined at all in the link ... > We can use machine learning towards those metrics to derive future business strategies really???? > Make sure all security policies are in place no information
- KennyFromIT 5y agoI'm interested to know what causes submissions like this - content that is years old and posted with no context - to hit the first page on a random day.
- dang 5y agoSometimes it's people who feel like posting oldies/perennials/classics, and sometimes it's people running across a thing for the first time. We've had to learn not to crack down on these too heavily because there's always an up-and-coming cohort of new users who've never seen them before, and HN should be a place to run across them. Once a year seems to be an acceptable maximum rate (https://news.ycombinator.com/newsfaq.html https://news.ycombinator.com/newsfaq.html).
- KennyFromIT 5y agoThanks for the explanation. Now for my next question: Out of all the other posts out there right now, how on Earth did my little inquiry catch your eyes? ;-)
- dang 5y agoPurest randomness.
- kretaceous 5y agoHey dang. I have a question too. Does it really need a 2011 tag? I thought only blog posts and news articles got year tags. 12FA is guidelines website that is mostly timeless. What's the criteria for a year tag?
- gunapologist99 5y agoThe year tag is also very useful for when you might have read it the first time, and want to know that it hasn't changed, or if you don't need/want to re-read it (while still participating in the discussion). It's also interesting to see how things have aged.
- pvg 5y agoThe year tags can and do go on anything, they're more for the readers than as some sort of commentary on the timeliness or lack thereof of the content. I think lots of people just find them handy to easily distinguish recent from not-so-recent stuff, as a very basic use case.
- onionisafruit 5y agoI’ve been curious what the oldest year tag applied on HN is.
- Tomte 5y agoMine is this: https://news.ycombinator.com/item?id=22005431 https://news.ycombinator.com/item?id=22005431 (1539).
- koolba 5y agoMany of us recall with great fondness the first time we read about 12 factor apps. In particular, those of us that had been working on systems like this, but hadn’t codified it with explicit guidelines. It just made sense. The pleasantness of things just working consistently from scratch on a brand new server. Replacing the concept of pet servers with cattle. It’s all related. I’m sure every time this makes the front page it reaches at least one fresh pair of eyes. Relevant xkcd: https://xkcd.com/1053/ https://xkcd.com/1053/
- linkdd 5y agoIs HN a search engine for xkcd? Honestly people, do you have them indexed somewhere? I'm amazed by your ability to find the appropriate xkcd whenever it's needed. Me, I'd have to spend at least half an hour on Google trying to find it, and then give up or see that someone else already posted it. I love this community.
- tim-- 5y agoSome xkcd comics are classics - my gotos are the one about ISO dates (https://xkcd.com/1179/ https://xkcd.com/1179/) and password strength (https://xkcd.com/936/ https://xkcd.com/936/). Both of these were found by search Google 'xkcd (dates|passwords)', and having them be the first result. Explain XKCD is great if you know roughly what topic was covered by a comic, but can't quite find the URL. https://www.explainxkcd.com/ https://www.explainxkcd.com/
- linkdd 5y ago> Explain XKCD is great Thanks for the tip, I added it to my favorites. Could it be used to implement a Slack bot similar to /giphy?
- erik_seaberg 5y agoThat exists: https://relevant-xkcd.com/slack https://relevant-xkcd.com/slack
- deleted 5y ago
- runeb 5y agoFrom a historical standpoint I would think it is interesting to someone who may have come into the profession in the last decade to know more about why the practises we today take for granted and as obvious came about.
- breckenedge 5y agoThe account “tosh” does this pretty regularly.
- KennyFromIT 5y agoYes, I've noticed this as well.
- deleted 5y ago[deleted]
- tosh 5y agoIn this specific case: I stumbled upon Craig's tweet/poll yesterday https://twitter.com/craigkerstiens/status/1519496090646589440 https://twitter.com/craigkerstiens/status/151949609064658944... The killer feature of Heroku was/is: * git push heroku main * Review apps * Heroku postgres * Add-ons & this reply https://twitter.com/srinathkrishna/status/1519496730202361856 https://twitter.com/srinathkrishna/status/151949673020236185... I'd say the 12factor manifesto was the biggest thing to come out of Heroku. There's a lot of wisdom in there.
- dang 5y agoLots of past submissions but not that interesting threads: Twelve Factors of Web Application Development - https://news.ycombinator.com/item?id=3267187 https://news.ycombinator.com/item?id=3267187 - Nov 2011 (37 comments) The Twelve-Factor App - https://news.ycombinator.com/item?id=19947507 https://news.ycombinator.com/item?id=19947507 - May 2019 (3 comments) Related: Twelve-factor app development on Google Cloud - https://news.ycombinator.com/item?id=21415488 https://news.ycombinator.com/item?id=21415488 - Nov 2019 (63 comments) 12 Factor CLI Apps - https://news.ycombinator.com/item?id=18172689 https://news.ycombinator.com/item?id=18172689 - Oct 2018 (247 comments)
- numbsafari 5y agoOne thing that I think could be updated in the 12F approach is the use of env vars for config, especially secrets. I’ve generally found it much better to mount these into the filesystem and read from there. It helps with, for example, secret rotation for long running processes. Relying on process restarts can be ugly in some setups, especially if startup time is expensive.
- zach_garwood 5y agoSeconded, but porque no los dos? I tend to put my applications' env vars in `/etc/environment`.
- numbsafari 5y agoIt’s a good question and idea. I’ve been trending towards treating secrets and non-secrets differently. For non-secrets, I tend to have a config discovery mechanism that lets me read config from files, then from env, then from cli args as final fallback. This is mostly for ergonomics. I prefer to use files for deployed processes, and env vars or cli params when debugging or working interactively. Env vars are handy for cli args I’m going to be repeating a lot. But for secrets I’ve tended to only fetching those from files, but allowing the file location to be specified by env var or cli arg for quick changes. It sounds kinda complicated, but you write that logic into a library and then everything behaves the way you expect consistently.
- dfsdf4sds 5y agoFor what it's worth at $dayjob (public company, 1B+ revenue) we do the exact same, although either I misunderstood you or we have the exact opposite priority: args always win, if they're not defined then env wins, then config file, then default config value in code which sometimes is an actual value, and sometimes it defaults to throwing an exception and never passing a readiness check, depending on the behavior of the config in question. This last one is mostly a relic of the past and we believe it's better to blow up if there's no default configuration value in the chart in all cases; it also makes it way easier not to have to chase defaults through the code. We use these for running locally and debugging as you say, but come deployment time we ship all applications as helm charts with default config values, store overrides and static secrets (with SOPS) in a different, company-global repo, and use kubernetes secrets to mount a tmpfs volume to pass them in to the application. There's no way to pass args or env there.
- NationOfJoe 5y agoWhen i first found 12 factor i was really impressed, it was/is a collection of guidelines that suit their defined purpose really well, easy to read and implement. I always feel like there should be more parts of software/web dev with guidelines like this. An easily digestible format that is easy to discuss with colleagues other examples i can think. - https://refactoring.guru/ https://refactoring.guru/ - not exactly a list of guidelines but a nice digestible collection of common patterns, pro's cons and when to/not use them - to a lesser degree, agile manifesto. a nice list of guidelines, but not as implementable (mainly because it is more related to people/management) but saying that i am not sure exactly what parts of the field i need this for. I didn't know i needed this for building/deploying web apps before i saw 12 factor. maybe application folder structures, guidelines to mitigate/remove software rot?
- lliamander 5y agoIt's been a long time since I read this. I just did a mental audit of the services my company runs, and they all (more or less) match what's in this document. It's not even a conscious thing anymore. I think any mid-level backend engineer (or any web-related software engineer, for that matter) would do well to read through this and dive deeper into each of these recommendations to understand why they were chosen.
- canjobear 5y agoI was hoping this would be about twelve-factor authentication
- CameronNemo 5y agoPlease delete this comment I don't want anyone getting ideas.
- e1ghtSpace 5y agohttps://www.youtube.com/watch?v=h7SBVutX6OU https://www.youtube.com/watch?v=h7SBVutX6OU We just need 6 more.
- Cthulhu_ 5y agoI've just done my taxes using the country's digital sign-in. - Go to tax website - Click on log in - Website tells you to open the app - App tells you to push a button, this shows a four letter code - You type in the four letter code on the website - Website shows a QR code - Scan the QR code on the app - App asks you if you want to sign in to the website, hit yes - App asks for a 5-digit PIN code I think there was another confirmation, but anyway, there were a Lot of steps and I'm not convinced adding more steps made it safer. I mean they could've skipped the first "type a four letter code" by just showing the QR code directly, it can tell the app what code to use and what website it is, etc.
- vemv 5y agoI really dislike 12FA. It's meaningless. The name sounds neat, but it is undistinguishable from "some guy's twelve preferences". Of course advocating for "some guy's twelve preferences" would never be considered serious argumentation in an engineering context. Yet we do for 12FA. I might agree with this or that point, but taking the package as a whole just leads to weaponization and cargo-culting.
- matsemann 5y agoI disagree. It perhaps started as someone's preference, but the fact that it got so widely known and shared made it something more. Same goes for the Joel Test. And it's not about cargo-culting, it's value lies mostly in having a set of things you can show your company: "this is industry standard, we're far from there and should work on that". Not everything in these lists needs to be done that way. But they're still nice pointers for where to move towards (or beyond).
- lliamander 5y agoI'm not sure how you can say it's meaningless. It's clearly not just a bunch of babble that you often see in business writing: each of these is a specific, concrete suggestion. I'm also fairly sure it wasn't just one guy's preferences, and in any case those preferences were born out of experience with the early days of the web. I've worked on web services that did not follow those principles as well as ones that do, and it seems pretty clear to me these principles are all more or less correct. In my experience this is now more-or-less best practice* for web services. *with maybe minor exceptions such as accessing secrets from an external vault service.
- vemv 5y ago"12 factor app" is exactly as meaningful as "24 factor app" or "100 factor app", i.e. not at all. Who gets to say how many "factors" are relevant? What's the common thread of the 12 factors?
- lliamander 5y agoI'm struggling to understand your criticism. Why the authors decided to put 12 instead of 24 or 100 (or whatever) is irrelevant. What's relevant is whether the factors themselves are meaningful. The common thread is covered in the introduction. It's about building services that back web applications in a way that makes it easy to deploy and manage them.
- KronisLV 5y agoI really like 12 Factor Apps, the set of ideas and approaches has allowed me to make a few personal projects more easy to setup and run. Additionally, i worked on the webpage and some components for Apturi Covid (Latvia's COVID contact tracing app, perhaps a bit less relevant now) which was also really easy to hand over to Ops to run thanks to the simple configuration: https://apturicovid.lv/#en https://apturicovid.lv/#en That said, at work there are still some people who don't want to use those approaches, their argumentation being along the lines of: - config: "we don't like long lists of environment variables, files are easier to read" (ignoring that those don't play nicely with containers) - config: "files let you group things more easily (processes.properties, datasource.properties, urls.properties)" (ignoring discoverability issues) - backing services: "ehh, there's nothing wrong with hardcoding at least parts of a path in the app" (disregarding that context paths can change) - build, release, run: "just put some default config in the app directory for running locally, bundle the front end and back end for ease of deployment" (ignoring that this bundling makes things more risky in regards to accidentally committing/shipping the wrong stuff, and bundling components slows everything down, can't build FE/BE in parallel) - processes: "how do i restart Tomcat inside of the container?" (treating containers as VMs, though 12FA aren't necessarily bound to containers per se) - concurrency: (the entire system is built in a way that is only compatible with a single instance, local filesystem used for stuff etc.) - disposability: (the older apps take minutes to start up due to being large monoliths) - logs: "but files are easier to work with" (they're only easier if you don't have proper log shipping infra in place) What's my point with all of this? Well, for starters, if your apps are bad (large clunky monoliths), then it's not like 12 Factor App principles will make things that much better for you, since the actual implementation might be different due to previous assumptions that were made in the app design. And even if they could, then you still have other people with conflicting opinions or simply views of cloud native and container based applications that will not have you easily running or scaling these apps anytime soon. It's not like every system needs to be structured like that, but sometimes i wonder whether it would be easier to just work on new projects only and not bother modernizing the older ones. For all i (perhaps should) care about, those older systems might as well run with their config and log files on the file system, inside of Tomcat instances with JDK version and config drift, no scalability and manual restarts after crashes when things inevitably break, as well as eventual disk space issues - just with someone who feels comfortable spending their time that way behind the wheel, not me. A bit like the blog post "Green Vs. Brown Programming Languages" which talked about most of the dreaded programming languages being old and most of the loved ones being new: https://earthly.dev/blog/brown-green-language/ https://earthly.dev/blog/brown-green-language/ Perhaps that's simply due to there not being any old legacy codebases to maintain in the newer languages, ergo them being liked.
- nickjj 5y agoI really like this methodology and it still applies today across techs, such as with Docker and Kubernetes. It feels like one of those things that'll be around for another 10+ years. If anyone is interesed in seeing each pattern applied directly to an open source code base I made a video on that at: https://nickjanetakis.com/blog/creating-a-twelve-factor-app-with-docker-that-also-works-on-kubernetes https://nickjanetakis.com/blog/creating-a-twelve-factor-app-...
- imglorp 5y agoI feel there is a little misdirection in the 12F idea. > The twelve-factor methodology can be applied to apps written in any programming language, and which use any combination of backing services (database, queue, memory cache, etc). Not every landscape fits the WEB-LOGIC-mumble_db_mumble model. Sometimes your backing services are not Someone Else's Problem: maybe you need to curate them and deploy them with the rest of your 12F fleet (applying 12F where possible) but the realities are lots of handholdy things like state, schemas, migrations, and entropy in general.
- cduzz 5y agoI personally am stunned that the advice for logging is taken as canon. I can see using container stderr/stdout as a way to collect exceptions, but using it as a source of exceptions, access logs, authentication events, all mixed together where splunk or "hadoop" will parse it for you? Madness.
- ninkendo 5y agoAs opposed to what, exactly? Should I be reinventing logfile rotation inside my web app? Why not just log to a stream and have a dedicated logging service figure out what to do with it? It sounds reasonable to me.
- lakomen 5y agoJust today I pondered how you can resell old content as new. One example was a song that I heard as a young teen, strawberry fields by some random Brit on MTV. I liked the song to only find out years later that it's a song by the Beatles. A bloody song by the Beatles with some new drums and some spaz spazzing to the music... Well there you go again... the 12factor app from 2011. A few years ago when I was browsing job offers that was a hard requirement in job ads I saw. Now it's forgotten, but since k8s and cloud hype all I see is bs cloud hype job ads. Microservices and cloud hype agile scrum blockchain ai machine learning devops bs bs bs. When will they ever learn when will they ever learn... Why can't we get away from hype driven development and recruitment? For the record, I'm not saying 12factor is a bad idea, it actually great, refined by experience. But in the newsosphere it was forgotten. I see it as a standard that makes sense, but I'm getting annoyed that that 11 year old site is something that makes the hacker news. And how the memory of us humans is so limited. Of course young people starting out likely never heard of 12factor. So it's new and shiny for them. Goto 10.
- afiori 5y agoI don't feel like the (valid) point you are making applies to this case. The 12 Factor App describe reasoning and motivations behind many common architectures today (speaking as someone that doesn't work with k8s) and for anyone that was not around in 2011-2015, it could be an interesting read
- dantelex 5y agoOnboardbase was built to solve this use case. It manages and syncs your env across every stage of development.(Disclaimer: I’m the founder.) I honestly started building this out of the need not share credentials and envs over communication channels like slack anymore. I needed a seamless and secure way to work with envs without having it scattered and fragmented across several mediums. Envs are essential to how you work and i believe a solution shouldn't just be secure but it should also be seamless to how you work https://onboardbase.com/blog/say-hello-to-onboardbase https://onboardbase.com/blog/say-hello-to-onboardbase