This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

A

Automation

The rule of the cloud is to ruthlessly automate everything

- Patrick Gelsinger, CEO Intel, ex-CEO VMWare

Apart from taking advantage of compute resources, such as a remote server or a database, cloud computing in its essence deals with automation of the software delivery process. The following are the 3 steps that are automated in this delivery process:

Application Development

There are several tasks that a developer would like to include in their development workflow such as running unit tests, deploying the application on each new change, let’s say this change is making a new commit to a GitHub repository. Such repetitive tasks can be automated on GitHub with the help of Actions.

Deployment Configuration

Say you are building a Python or a Node.js web application. What software does your local machine need to run this project? Let’s start from the basics, an operating system. Node.js or the Python interpreter to run the scripts that you’ll write, npm or pip to install and manage the required dependencies and so on. Now what if you have to deploy this application, say on Heroku or Google App Engine. You only provide the source code and the list of dependencies to it. However, behind the scenes, there are a lot more configurations that are done for you. Such as the choice of the machine/server on which your code will run, the operating system it will run on, etc. All of this is part of deployment configuration which is automated for you. As a developer, you only provide the code and the platform does the configurations for you.

This concept can also be extended to Infrastructure-as-Code. What if you want to specify the kind of machine your code should run on, the operating system that your code runs on, the version of Python or Node.js runtime that you need? With this, you have a lot more configurations to be done on your own. For big companies, with many such applications deployed, imagine how many such configurations they have to specify for each deployment? In order to automate configurations for Infrastructure-as-Code, many cloud technologies are available today, namely Ansible, Puppet, Chef.

Scaling

Imagine you have built a web application deployed using some cloud service and is accessed by hundreds of users every week. Let’s say it is your personal blog. One of your stories becomes a major hit and now you get thousands of users visitng your website, interacting with it. We can say that now there is an increased load on your website. How will you deal with this? This additional load can be carried out by autoscaling which is provided out of the box by most cloud platforms providing compute resources. By autoscaling, the number of servers or virtual machines running on a single server can be scaled as per the load without requiring any manual intervention.

1 - Actions by GitHub

Automate your development process with GitHub Actions

To quickly see GitHub Actions in action, check out the .github directory in the source code of this website here. You can see the following directory structure:

.github
├── dependabot.yml
└── workflows
    └── gh-pages.yaml

There is a .yaml or YAML (which stands for YAML Ain’t Markup Language) file that defines some workflow or a set of tasks that will be run on each event on the GitHub repository.

What is an event?

An event is a specific change made to your GitHub repository that should trigger your desired workflow. This event can be a new push, a new issue or a pull request made to the repository.

What is a workflow?

A set of automated tasks that are to be run of a specific event. A workflow is composed of several jobs and is defined in a YAML file such as specified above with gh-pages.yaml. This is how this file looks:

name: GitHub Pages

on:
  push:
    branches:
      - main # Set a branch to deploy
  pull_request:

jobs:
  deploy:
    runs-on: ubuntu-20.04
    concurrency:
      group: ${{ github.workflow }}-${{ github.ref }}
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true # Fetch Hugo themes (true OR recursive)
          fetch-depth: 1 # Fetch all history for .GitInfo and .Lastmod

      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v2
        with:
          hugo-version: "latest"
          extended: true

      - name: Build
        run: git submodule update --init --recursive --depth 1 && npm i && hugo

      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        if: ${{ github.ref == 'refs/heads/main' }}
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./public

There are 2 keywords to focus on in this file - on and jobs. on is where you define the event/s that should trigger this workflow and jobs are the set of tasks that should execute as a part of the workflow.

Learn

GitHub Actions is a powerful tool to have in your development arsenal. Learn more from the official documentation.

2 - App Engine by Google Cloud Platform

Deployment configuration and more with Google App Engine

A fully managed environment lets you focus on code while App Engine manages infrastructure concerns.

Google App Engine is a Platform-as-a-Service for deploying and managing web applications for Go, PHP, Python, Ruby, .NET, and Node.js runtimes along with custom runtimes. It offers autoscaling, cloud monitoring and logging services with the ability to define access rules for your web application.

Learn

Try out App Engine by deploying a Flask web application with this codelab!