Book Image

Cloud Native Python

By : Manish Sethi
Book Image

Cloud Native Python

By: Manish Sethi

Overview of this book

Businesses today are evolving so rapidly that having their own infrastructure to support their expansion is not feasible. As a result, they have been resorting to the elasticity of the cloud to provide a platform to build and deploy their highly scalable applications. This book will be the one stop for you to learn all about building cloud-native architectures in Python. It will begin by introducing you to cloud-native architecture and will help break it down for you. Then you’ll learn how to build microservices in Python using REST APIs in an event driven approach and you will build the web layer. Next, you’ll learn about Interacting data services and building Web views with React, after which we will take a detailed look at application security and performance. Then, you’ll also learn how to Dockerize your services. And finally, you’ll learn how to deploy the application on the AWS and Azure platforms. We will end the book by discussing some concepts and techniques around troubleshooting problems that might occur with your applications after you’ve deployed them. This book will teach you how to craft applications that are built as small standard units, using all the proven best practices and avoiding the usual traps. It's a practical book: we're going to build everything using Python 3 and its amazing tooling ecosystem. The book will take you on a journey, the destination of which, is the creation of a complete Python application based on microservices over the cloud platform
Table of Contents (14 chapters)
6
Creating UIs to Scale with Flux

Understanding the twelve-factor app

Cloud native applications fit in with an agreement intended to augment versatility through predictable practices. This application maintains a manifesto of sorts called the twelve-factor app. It outlines a methodology for developers to follow when building modern web-based applications. Developers must change how they code, creating a new contract between the developers and the infrastructure that their applications run on.

The following are a few points to consider when developing a cloud native application:

  • Use an informative design to increase application usage with minimal time and cost to customers using automation

  • Use application portability across different environments (such as stage and production) and different platforms (such as Unix or Windows)

  • Use application suitability over cloud platforms and understand the resource allocation and management

  • Use identical environments to reduce bugs with continuous delivery/deployment for maximum agility of software release

  • Enable high availability by scaling the application with minimal supervision and designing disaster-recovery architectures

Many of the twelve-factors interact with each other. They focus on speed, safety, and scale by emphasizing on declarative configuration. A twelve-factor app can be described as follows:

  • Centralized code base: Every code that is deployed is tracked in revision control, and should have multiple instances deployed on multiple platforms.

  • Dependencies management: An app should be able to declare the dependencies, and isolate them using tools such as Bundler, pip, and Maven.

  • Defining configuration: Configurations (that is, environment variables) that are likely to be different in different deployment environments (such as development, stage, and production) should be defined at the operating-system level.

  • Backing services: Every resource is treated as a part of the application itself. Backing services such as databases and message queues should be considered as an attached resource, and consumed equally in all environments.

  • Isolation in build, release, and run cycle: This involves strict separation between build artifacts, then combining with configuration, and then starting one or more instances from the artifact and configuration combination.

  • Stateless processes: The app should execute one or more instances/processes (for example, master/workers) that share nothing.

  • Services port binding: The application should be self-contained, and if any/all services need to be exposed, then it should be done via port binding (preferably HTTP).

  • Scaling stateless processes: The architecture should emphasize stateless process management in the underlying platform instead of implementing more complexity to the application.

  • Process state management: Processes should scale up very quickly and shut down gracefully within a small time period. These aspects enable rapid scalability, deployment of changes, and disaster recovery.

  • Continuous delivery/deployment to production: Always try to keep your different environments similar, whether it is development, stage, or production. This will ensure that you get similar results across multiple environments, and enable continuous delivery from development to production.

  • Logs as event streams: Logging is very important, whether it is platform level or application level, as this helps understand the activity of the application. Enable different deployable environments (preferably production) to collect, aggregate, index, and analyze the events via centralized services.

  • Ad hoc tasks as on-off processes: In the cloud native approach, management tasks (for example, database migration) that run as a part of a release should be run as one-off processes into the environment as opposed to the regular app with long-running processes.

Cloud application platforms such as Cloud Foundry, Heroku, and Amazon Beanstalk are optimized for deploying twelve-factor apps.

Considering all these standards and integrating applications with steady engineering interfaces, that is, handling stateless outline design, makes disseminated applications that are cloud prepared. Python revolutionized application systems with its obstinate, tradition-over-setup way to deal with web improvements.