![]() |
VOOZH | about |
We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.
Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.
Follow TNS on your favorite social media networks.
Become a TNS follower on LinkedIn.
Check out the latest featured and trending stories while you wait for your first TNS newsletter.
“Good code fails when you don’t have good process and a platform to help you. Good teams fail when you don’t have a good culture that embraces DevOps, microservices and not giant monoliths.”
This was how Java Framework Spring’s Tim Spann eloquently sums up why his team chose a combination of 12-factor application patterns, microservices and Cloud Foundry.
Juggling a distributed team, with local development machines running on Windows, Oracle JDK and Tomcat, alongside a “special” Java application to simulate an application server, they were stuck bouncing around between development and QA.
Then they started applying 12-factor apps.
Many teams struggle with overly complicated, slowed-down app deployment. Virtualization, networking and setting up run-time meet different tool versions and languages, and your architecture is often what slows you down and holds you back.
The 12-factor app methodology specifically created for building Software as a Service (SaaS) apps, while avoiding the headaches that has typically bedeviled long-term enterprise software projects. SitePoint succinctly describes it as “an outline for building well structured and scalable applications.”
These best practices are based on a few specific parameters for deployment of cloud-native applications:
The 12-factor methodology is programming language agnostic and works with any combo of backing services.
“It’s here to change the way you think and to be able to deliver software faster,” said Mirantis senior solutions architect Greg Pryzby in his talk “You must be 12-factors high to ride,” which he gave at the OpenStack Summit earlier this year:
The 12-factor app methodology addresses the following challenges:
As with all cultural transformations, answering these challenges could down to three parts: the people, the processes and the tech.
“Understanding the processes and educating the people help us to understand that one side of how do I build an app to identify potholes so they can get fixed,” Pryzby said.
Pryzby offers the four words that 12 factor stands on:
And then you need to follow these five design principles, most of which are so logical, it’d be good if they are followed for all cloud-based services:
You need to build on top of one codebase, fully tracked with revision control and many deployments. Deployments should be automatic, so everything can run in different environments without work.
“If you’re thinking that something is different in dev than in QA, don’t put it in the code,” Pryzby said, echoing a common theme you will see running throughout the 12 factors.
“How many times have you installed or tried to install something only to find out you had the wrong version of glibc?” asked Pryzby. Or perhaps you had the wrong version of Python or the wrong version of one of the Python libraries?
The second factor is about explicitly declaring and isolating dependencies because the app is a standalone and needs to install dependencies. This is why you declare what you need in the code.
“Your development, your QA and your production have to be identical for 12-factor apps to actually work because when you scale for web, you can’t have any room for error.”
Here you store your configuration files in the environment. This factor focuses on how you store your data — the database Uniform Resource Identifier (URI) will be different in development, QA and production.
You need to treat backing services like attached resources because you may want different databases depending on which team you’re on. Sometimes dev will want a lot of logs, while QA will want less. With this method, even each developer can have their own config file.
You want to strictly separate the Build and Run stages, making sure everything has the right libraries. Then you put everything together in something that can be released and installed in the environment and then be able to run it.
“As a developer, I want to be able to develop something that is this nice, tightly deliverable object, thing, that I can give to Ops. Ops then can put it in that environment and run it. And ideally, I will never hear from Ops again,” Pryzby said, “because you’ve made it a well-defined solution” with few dependencies.
You want to make sure that stuff is stored in a backing store, meaning you’re able to scale out and do what you need to do. The app is executed in one or more stateless processes. As you scale up and out, you don’t want to have a state that you need to pass along.
“People are back and forth on how important this is,” admitted Pryzby, but argues exporting services via port binding allows your internal customers to access your endpoints without traversing security. Then, you are able to access your app directly via a port to know if it’s your app or another point in the stack that isn’t working properly.
Small, defined apps allow scaling out as needed to handle the varying loads. Break your app into much smaller pieces and then look for services out there that you either have to write or can consume.
Make sure changes can take effect very quickly. It’s about making sure you can start up and take down fast. And that you can handle a crash.
Development, staging and production should be as similar as possible. Continuous deployment needs continuous integration based on matching environments to limit deviation and errors. If you keep dev, staging and production as similar as possible, anyone can understand it and release it. This is of course simply good development but it also enables a lot more scalability.
Your app only worries about creating a sort of event stream. Then, depending on the configuration, you can decide where that log will publish.
Intel’s Nick Weaver Discusses Orchestration
Your admin tools ship with the product. Pryzby warns us to not go messing with the database. Instead, use the tooling you built alongside your app to go and check the database. This also means that the privileges are the same across your system — no more special cases that put your security at risk.
Of course, factor 12 is only a solution for certain companies. It’s not ready for those that are still trying to overcome the baggage of their legacy, on-premise applications. The right use case for this DevOps methodology is in new apps or instances where you’ve already started the refactoring process for a brownfield project that you’re completely reworking.
It’s all about deciding what your main problem is and if factor 12 can solve that problem. And even devotees of factor 12 don’t always apply all 12 factors. Will Koffel has written a good piece that highlights which factors are mandatory versus very important versus only rather important.
But, when it comes down to it, as always, you should prioritize what works for your team.