Here at CenturyLink Cloud, the 12-Factor App methodology factors in nicely with our PaaS offering -- AppFog. This article details how to leverage this useful methodology within our platform with the ultimate goal of developing a malleable and living outline for creating highly-organized, scalable applications. This approach positively changes the manner in which developers view their specific application architecture. We've covered this topic on a more technical level on our blog before, here.
The application deployment process can be a laborious and time-consuming task; especially when considerations like networking, automation, virtualization, testing, and establishing runtime environments are key factors. The 12-Factor App methodology doesn't diminish the complexity of the deployment process, but it provides a better framework for a more organized deployment process for apps.
Understanding what these 12-Factor App principles and their standards are, in addition to using a tool like CenturyLink Cloud's AppFog, allows devs to create software without worrying so much about application infrastructure.
The 12 Factors Explained
As noted on the 12-Factor App site, each factor has a standard that application developers should meet during deployment.
Codebase: One codebase tracked in revision control, many deploys The first principle relates to the application’s codebase and making sure the application is: 1. tracked with revision control and 2. sits in a central repository accessible to developers. At CenturyLink Cloud, code is generally stored in Github. This also is true for AppFog code -- developers have access to Github repositories and check code in through a strict versioning process.
Dependencies: Explicitly declare and isolate dependencies Developers cannot operate on assumption regarding dependencies. All the required elements that an application relies on to work properly must be monitored, controlled, and managed to minimize (and eliminate) conflicts and pain points. At CenturyLink Cloud we use the agile DevOps model, which requires us to identify dependencies upfront. Each system a team uses is monitored through continuous integration, ensuring any interruptions are caught immediately (an example of this integration can be found here.
Configuration: Store config in the environment Configuration (API keys, automation processes, and database credentials and their corresponding coding policies) should never be hardcoded. That is, written in such a way that they cannot be altered without modifying the program. Additionally, this configuration technique minimizes production data leaks and errors on the production side.
Backing Services: Treat backing services as attached resources A backing service requires a network connection and is increasingly useful in application development (prior to deployment). This methodology advises developers to implement changes or modifications without having to make changes to the code. This is best managed by using an API to call each backing service, as credentials are housed in a configuration file living in the runtime environment.
Build, release, run: Strictly separate build and run stages Treat these stages through the lens that they are exclusively independent to one another. Automation processes aid in simplifying the build process. At CenturyLink Cloud, Github is used to add tags to the latest build and Jenkins can be leveraged to automate the release stage.
Processes: Execute the app as one or more stateless processes Stateless processes minimize the effect of a failure by design, meaning if and when a dependency fails the entire application does not fail. Single points of failure are inevitable, but their impact can be lessened by storing data outside of running code to avoid operational failures.
Port binding: Export services via port binding Applications should have an accessible URL; for web apps, this happens automatically. Port binding allows applications using the 12-Factor method to be entirely self-contained. It also avoids the over-reliance of disparate methods of fault and stress injection in a fault-error-failure-cycle prior to releasing web-facing services.
Concurrency: Scale out via the process model Each application process should have the ability to scale, restart, or clone itself when necessary to improve holistic application sustainability and scalability.
Disposability: Maximize robustness with fast startup and graceful shutdown To ease the startup and shutdown process, application processes need to be viewed independently. When an application's processes are bundled together, the startup and shutdown processes can result in lengthy lag periods depending on their size. CenturyLink Cloud's Orchestrate is a service that helps with this factor.
Dev/prod Parity: Keep development, staging, and production as similar as possible When environments are analogous, testing and developing get simplified. Having similar environments assures different aspects of the application's configuration, configuration management processes, infrastructure stack, software and runtime versions, and deployment tools are consistent. This can decrease the proclivity of glitches and bugs making their way into the production environment, as all tests can be applied on production-level data.
Logs: Treat logs as event streams Logging is essential for debugging and maintaining the overall application health. Logs should be continuous and captured and stored by a separate service.
Admin processes: Run admin/management tasks as one-off processes Think of one-off admin processes as data collection jobs used to amalgamate key application information that is required to check the current state of the production environment. This process ensures there are no disparities within the data sets required to improve the app and the data mined from the long running production application.
The 12-Factor App Methodology is an invaluable blueprint that provides developers with an excellent step-by-step process, each with corresponding standards, en route to deploying a reliable SaaS product. The value of the 12-Factor methodology is that it eases the management of those individual steps, which can be a difficult task. At CenturyLink Cloud, AppFog PaaS uses this methodology to allow developers to focus on writing code and ultimately, building and delivering great applications.
Want to learn more about AppFog? Get started by checking out our Knowledge Base. Don't have an account on CenturyLink Cloud? No problem. Get started with CenturyLink Cloud for free and receive a healthy credit toward any of our products or services.