knowledge-kitchen

Continuous Deployment - Automatically Launching Applications

Making an application live and available to its users.

  1. Overview
  2. Moving on from development servers
  3. Production environment
  4. Cloud deployments
  5. Virtual machines and containers
  6. Kubernetes
  7. Continuous deployment
  8. Conclusions

Overview

Definitions

A few terms to disambiguate.

Delivery

Deployment

Atlassian's CI/CD diagram

Caveats

New releases of software, of course, must still successfully build and pass unit, integration and system tests before deployment.

Automation Pipeline

With version control, code linters, large language model-based code assistants, automated provisioning of virtual computing environments, automated builds, and automated testing, continuous deployment is the natural evolution of a fully automated software development and operations (devops) pipeline.

Moving on from development servers

Overview

Many application development frameworks, including Flask and React, come with development servers.

For example:

These are simple web servers that can be easily run on a development machine for quick debugging and testing. However, they are not intended for use in production environments.

Limitations of a development server

Development servers are not intended for use in production environments. Typically, development servers are…

Production servers

Production servers are intended to be better optimized for heavy loads, more secure, and more reliable than development servers.

Product servers (continued)

Tutorials are readily available to give guidance to the process of publishing apps to production servers.

For example…

Using Digital Ocean’s Droplets:

Using Digital Ocean’s App Platform:

Production environment

Hosting tiers

There are several tiers of hosting available for apps that can be deployed and accessed over the Internet, with many companies and services catering to each type

Hosting tiers (continued)

Hosting tiers

Shared hosting

With shared hosting, a developer receives an account on a web server shared by hundreds, if not thousands, of other developers.

Universities and other large organizations often provide shared hosting for their community members.

Dedicated machine

With a dedicated machine, i.e. a bare metal server, developers buy or rent a single physical machine managed by either themselves or the hosting company from whom it is rented.

Virtual Private Servers (VPS)

With VPS, a developer receives a virtual machine running on a physical machine shared by hundreds, if not thousands, of other users.

Cloud deployments

Deploying to “the cloud” is a catch-all term for deploying to a remote server that is managed by a third party.

Cloud deployments (continued)

Cloud versus VPS

Cloud deployments

The cloud is just someone else's computer

Cloud services

The cloud” is usually used to mean a grid of hundreds or thousands of physical computers all inter-networked and sharing resources, but presented to a developer as a single virtual machine.

Cloud resources

Cloud services providers offer a variety of resources to developers.

In addition to these, there are many accessory services such as load balancing, monitoring, logging, analytics, security, etc.

Big tech

The world of cloud deployment is dominated by a few players:

Their offerings are generally industrial-strength hosting solutions with obtuse interfaces and extensive capabilities that may be overkill and intimidating for non-specialists.

X-as-a-Service

The cloud is often referred to as a “service”, with a few common levels of service available to [paying] customers:

X-as-a-Service

Image courtesy of Microsoft Azure’s “What is PaaS“.

Infrastructure-as-a-Service (IaaS)

Some services handle much of the setup of a cloud infrastructure (compute resources, storage resources, networking interoperability, etc) without requiring the user to configure all details.

From IaaS, developers leverage The Cloud to receive the necessary preconfigured [virtual] hardware and networking abilites upon which to develop.

Platform-as-a-Service (PaaS)

Whereas IaaS provides the pre-set hardware and networking of a cloud deployment, PaaS additional provide the pre-set configuration of dependencies and platforms necessary to deploy a specific type of application.

From PaaS, developers receive an environment with platform systems already setup on an appropriate cloud compute and storage inrastructure and they can simply get to work on a specific type of project development.

Considerations when choosing IaaS versus PaaS

A few considerations when deciding whether to go with IaaS or PaaS:

Virtual machines and containers

Overview

Cloud compute services are provided as either virtual machines or containers.

Overview (continued)

Virtual machines versus containers

Example

For example, Digital Ocean, provides both virtual machines, which they call Droplets, and container deployments using their App Platform or Kubernetes services.

Kubernetes

Overview

Kubernetes (a.k.a. k8s) is a container “orchestrator” - it manages the deployment of containers across a cluster of machines.

Comparison to Docker Compose

Docker Compose, which also orchestrates containers, and kubernetes are designed for different use cases.

Components of a Kubernetes cluster

Kubernetes cluster

Components of a Kubernetes cluster (continued)

Each node in a cluster runs a container using a container runtime engine, like Docker or containerd.

Continuous deployment

Overview

Continuous Deployment (CD) is the process of automatically deploying new versions of a software application to a production environment with every change to the codebase.

Simple pipeline

A CI/CD pipeline for a simple application, such as one running on a single virtual machine, might involve the following steps:

  1. Developer pushes code to a repository (e.g. GitHub, GitLab, Bitbucket, etc.)

  2. CI server (e.g. GitHub Actions, Jenkins, Travis CI, Circle CI, etc.) builds and runs tests on the code.

  3. If the tests pass, the CI server copies the code to the production environment, e.g. by using the rsync command to copy the code from the build server to the production server.

  4. The production server deploys the application by stopping and restarting it.

  5. The updated application is now available to users.

Simple containerized pipeline

A similar CI/CD pipeline that runs the application either directly with Docker or using Docker Compose (but not using Kubernetes) might involve the following:

  1. Developer pushes code to a repository (e.g. GitHub, GitLab, Bitbucket, etc.)

  2. CI server (e.g. GitHub Actions, Jenkins, Travis CI, Circle CI, etc.) builds and runs tests on the code.

  3. If the tests pass, the CI server uploads the built Docker image to a container registry such as DockerHub.

  4. The CI server deploys a container using the new image to the production environment using docker or docker-compose commands.

  5. The updated application is now available to users.

Even simpler containerized pipeline

An even simpler containerized pipeline does not require the developer to develop a Docker image of their own system in order to use containers.

Kubernetes pipeline

Deploying to a Kubernetes cluster follows similar steps:

  1. Developer pushes code to a repository (e.g. GitHub, GitLab, Bitbucket, etc.)

  2. CI server (e.g. Jenkins, Travis CI, Circle CI, GitHub Actions, etc.) builds and runs tests on the code.

  3. If the tests pass, the CI server uploads the built Docker image to a container registry such as DockerHub,’

  4. The CI server deploys a kubernetes cluster using the new image using kubectl commands.

  5. The updated application is now available to users.

Conclusions

Thank you. Bye.