Cloud Native Python

Book description

Build cloud native applications in Python

About This Book

  • This is the only reliable resource that showcases the tools and techniques you need build robust and resilient cloud native applications in Python

  • Learn how to architect your application on both, the AWS and Azure clouds for high availability

  • Assess, monitor, and troubleshoot your applications in the cloud

  • Who This Book Is For

    This book is ideal for developers with a basic knowledge of Python who want to learn to build, test, and scale their Python-based applications. No prior experience of writing microservices in Python is required.

    What You Will Learn

  • Get to know “the way of the cloud”, including why developing good cloud software is fundamentally about mindset and discipline

  • Know what microservices are and how to design them

  • Create reactive applications in the cloud with third-party messaging providers

  • Build massive-scale, user-friendly GUIs with React and Flux

  • Secure cloud-based web applications: the do’s, don’ts, and options

  • Plan cloud apps that support continuous delivery and deployment

  • In Detail

    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

    Style and approach

    Filled with examples, this book takes a step-by-step approach to teach you each and every configuration you need to make your application highly available and fault tolerant.

    Publisher resources

    Download Example Code

    Table of contents

    1. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    2. Introducing Cloud Native Architecture and Microservices
      1. Introduction to cloud computing
        1. Software as a Service
        2. Platform as a Service
        3. Infrastructure as a Service
      2. The cloud native concepts
        1. Cloud native - what it means and why it matters?
        2. The cloud native runtimes
        3. Cloud native architecture
          1. Are microservices a new concept?
          2. Why is Python the best choice for cloud native microservices development?
            1. Readability
            2. Libraries and community
            3. Interactive mode
            4. Scalable
      3. Understanding the twelve-factor app
      4. Setting up the Python environment
        1. Installing Git
          1. Installing Git on Debian-based distribution Linux (such as Ubuntu)
          2. Seting up Git on a Debian-based distribution
          3. Installing Git on Windows
            1. Using Chocolatey
          4. Installing Git on Mac
            1. Installing the command-line tools for OS X
            2. Installing Git for OS X
        2. Installing and configuring Python
          1. Installing Python on a Debian-based distribution (such as Ubuntu)
            1. Using the APT package management tools
            2. Using source code
          2. Installing Python on Windows
          3. Installing Python on Mac
            1. Installing the command-line tools for OS X
            2. Installing Python for OS X
        3. Getting familiar with the GitHub and Git commands
      5. Summary
    3. Building Microservices in Python
      1. Python concepts
        1. Modules
        2. Functions
      2. Modeling microservices
      3. Building microservices
        1. Building resource user methods
          1. GET /api/v1/users
          2. GET /api/v1/users/[user_id]
          3. POST /api/v1/users
          4. DELETE /api/v1/users
          5. PUT /api/v1/users
        2. Building resource tweets methods
          1. GET /api/v2/tweets
          2. POST /api/v2/tweets
          3. GET /api/v2/tweets/[id]
      4. Testing the RESTful API
        1. Unit testing
      5. Summary
    4. Building a Web Application in Python
      1. Getting started with applications
      2. Creating application users
        1. Working with Observables and AJAX
        2. Binding data for the adduser template
      3. Creating tweets from users
        1. Working on Observables with AJAX for the addtweet template
        2. Data binding for the addtweet template
      4. CORS - Cross-Origin Resource Sharing
      5. Session management
      6. Cookies
      7. Summary
    5. Interacting Data Services
      1. MongoDB - How it is advantageous, and why are we using it?
        1. MongoDB terminology
      2. Setting up MongoDB
        1. Initializing the MongoDB database
        2. Integrating microservices with MongoDB
        3. Working with user resources
          1. GET api/v1/users
          2. GET api/v1/users/[user_id]
          3. POST api/v1/users
          4. PUT api/v1/users/[user_id]
          5. DELETE api/v1/users
        4. Working with the tweets resources
          1. GET api/v2/tweets
          2. GET api/v2/tweets/[user_id]
          3. POST api/v2/tweets
      3. Summary
    6. Building WebViews with React
      1. Understanding React
      2. Setting up the React environment
        1. Installing node
        2. Creating package.json
      3. Building webViews with React
        1. Integrating webView with microservices
      4. User authentication
        1. Login user
        2. Sign up user
        3. User profile
        4. Log out users
      5. Testing the React webViews
        1. Jest
        2. Selenium
      6. Summary
    7. Creating UIs to Scale with Flux
      1. Understanding Flux
        1. Flux concepts
        2. Adding dates to UI
        3. Building user interfaces with Flux
        4. Actions and dispatcher
        5. Stores
      2. Summary
    8. Learning Event Sourcing and CQRS
      1. Introduction
      2. Understanding Event Sourcing
        1. Laws of Event Sourcing
      3. Introduction to CQRS
        1. Advantages of the CQRS-ified architecture
        2. Challenges related to ES and CQRS
        3. Overcoming challenges
          1. Problem solving
            1. Explanation of the problem
            2. The solution
      4. Kafka as an eventstore
        1. Applying Event Sourcing with Kafka
        2. How it works
      5. Summary
    9. Securing the Web Application
      1. Network security versus application security
        1. The web application stack
          1. Application - security alternatives in the platform
            1. Transport protocol
            2. Application protocol
          2. Application - security threats in application logic
            1. Web application security alternatives
      2. A word on developing security-enabled web applications
      3. Summary
    10. Continuous Delivery
      1. Evolution of continuous integration and continuous delivery
        1. Understanding SDLC
        2. The Agile software development process
          1. How does the Agile software development process work?
      2. Continuous integration
      3. Jenkins - a continuous integration tool
        1. Installing Jenkins
          1. Prerequisite
          2. Installation on a Debian (Ubuntu)-based system
        2. Configuring Jenkins
        3. Automating Jenkins
        4. Securing Jenkins
        5. Plugins management
        6. Version control systems
      4. Setting up a Jenkins job
      5. Understanding continuous delivery
        1. Need for continuous delivery
        2. Continuous delivery versus continuous deployment
      6. Summary
    11. Dockerizing Your Services
      1. Understanding Docker
        1. Few facts about Docker versus virtualization
        2. Docker Engine - The backbone of Docker
        3. Setting up the Docker environment
          1. Installing Docker on Ubuntu
          2. Installation on Windows
        4. Setting up Docker Swarm
          1. Setting up the Docker environment
            1. Assumption
            2. Initializing the Docker manager
            3. Add node1 to master
            4. Testing the Docker Swarm
      2. Deploying an application on Docker
        1. Building and running our MongoDB Docker service
        2. Docker Hub - what is it all about?
        3. Docker Compose
      3. Summary
    12. Deploying on the AWS Platform
      1. Getting started with Amazon Web Services (AWS)
      2. Building application infrastructure on AWS
        1. Generating authentication keys
        2. Terraform - a tool to build infrastructure as code
          1. Configuring the MongoDB server
          2. Configuring the Elastic Load balancer
        3. CloudFormation - an AWS tool for building infrastructure using code
          1. The VPC stack on AWS
      3. Continuous Deployment for a cloud native application
        1. How it works
          1. Implementation of the Continuous Deployment pipeline
      4. Summary
    13. Implementing on the Azure Platform
      1. Getting started with Microsoft Azure
        1. A few points on Microsoft Azure basics
          1. Architecturing our application infrastructure using Azure
        2. Creating a virtual machine in Azure
      2. CI/CD pipeline using Jenkins with Azure
      3. Summary
    14. Monitoring the Cloud Application
      1. Monitoring on the cloud platform
      2. AWS-based services
        1. CloudWatch
        2. CloudTrail
        3. AWS Config service
      3. Microsoft Azure services
        1. Application Insights
        2. Introduction to ELK stack
          1. Logstash
          2. Elasticsearch
          3. Kibana
      4. Open source monitoring tool
        1. Prometheus
      5. Summary

    Product information

    • Title: Cloud Native Python
    • Author(s): Manish Sethi
    • Release date: July 2017
    • Publisher(s): Packt Publishing
    • ISBN: 9781787129313