Skip to main content

Devops and Cloud

Introduction

Congratulations on making it this far in the course. So far, we've learned a ton about different web technologies and how to build awesome, functional websites using modern web technologies.

Now you're probably wondering - how do I get my website to a live URL? So far in this course, we've been mostly working locally and using a few tools to deploy our sites, but how do we do this at scale?

Obviously, this is a very complex problem, companies like AWS or Google have spent billions on infrastructure to run platforms and services to support their applications.

In this lesson, we'll be talking about the fields of DevOps (Developer Operations) and Cloud.

What is DevOps?

DevOps is an acronym given to the combination of Development Operations. It's the philosophy that surrounds ensuring software teams run smoothly, and get their code built, shipped, and deployed with ease.

When you're building large-scale applications, you start to run into a few questions:

  • How do you deploy your code?
  • How do you configure your servers so they all work together?
  • How do you monitor your deployed services for bugs or errors?
  • How do you check the performance of your systems?
  • How do you plan for and fix problems that come up
  • How do you decrease the time spent on development cycles to ensure code is deployed to products at speed and scale reliably

Devops Image

Parts of DevOps

We'll be talking a bit about some DevOps best practices.

Imagine you're a software development team at Facebook releasing software

Continuous Integration

As a team, you want to ensure that each programmer's code is integrated into the codebase, tested, and validated. This should be done on a regular basis to ensure there are always new features being pushed. This practice is Continuous Integration (CI).

In industry, software teams build CI pipelines that run tests and check for bugs to ensure that every contribution to the code base will work properly. This is done using cloud services, something we'll talk more about.

Continuous Delivery

Now that your programmer's code is tested, you want to deliver your software to the customer. Continuous Delivery (CD) is deploying your tested changes into a testing or production environment after being built.

This means that developers will always have a working build and customers will always have a working build as fast as possible.

Microservices

Facebook is a massive company. Having all their services under a single server would be ridiculous, both in code size and complexity. It also would mean that if this monolith server were to crash, all of Facebook would be down.

Instead, companies use a microservice architecture, a design approach that breaks up a large application into multiple distributed services. Each service is running separately and communicates with other services through a well-defined API.

For example, a company like Facebook likely has a microservice for authentication, one for the news feed, etc. This also gives services the flexibility to be designed and built independently of each other.

Infrastructure as Code

Code infrastructure, or servers, is managed using code and software techniques instead of people. We'll talk more about this when we talk about the cloud, but this is crucial to ensuring services remain scalable.

Conclusion

DevOps is crucial for modern software companies to work code efficiently and consistently.

In this course, we'll go over a few DevOps tools

Beginner DevOps Tools

Since we can't cover all the DevOps tools out there, we'll cover some of the beginner services that should be immediately helpful for you to deploy your full-stack applications.

CI - GitHub Actions

The most accessible CI tool is Github Actions. This is an automation tool that can run scripts or code on each git commit, branch, or pull request.

For example, this is the configuration for a GitHub action that runs a linter on each commit.

name: CI

on:
push:
branches:
- '**'
pull_request:
branches:
- '**'

jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: npm run ci
- run: yarn lint

Frontend CD - Vercel or Netliify

Tools like Vercel or Netlify can automatically deploy your static site frontends to a working website in a few clicks. These run on each commit, ensuring that your code is always runnable/deployable.

Backend CD - Digital Ocean

For deploying a backend server, Digital Ocean is a very simple service to deploy a NodeJS backend to a server in a few clicks. It can hook up to Github so every commit is automatically built and deployed to the web!

Deploying your Code

Once you've built your code, you now want to run it somewhere. Of course, you can run it on your machine, but it's only accessible to you.

Now there's a whole suite of tools to expose your app to the internet or deploy it to a server (a server is simply a computer) to have it served to the internet, we talked about this a bit on CD.

However, configuring your own server is costly, challenging, and risky. This is where the cloud comes in.

The Cloud

To talk about the cloud, we'll use an analogy.

Imagine you're traveling to the Sahara desert and want to drive on the dunes, but you don't have a car! You can either:

  • Buy your own Jeep
  • Borrow or rent a jeep

Option 1 is similar to buying or maintaining a server yourself. There's a large upfront cost, you probably won't use it most of the time, and you have to do maintenance yourself if it breaks. This is called On-Premise Computing.

Option 2 is similar to running your code on the cloud. You can use it for just the time you want, if something breaks the rental company will fix it, and it's relatively hands-off. This is called Cloud Computing.

Cloud computing is the practice of using a network of remote servers hosted on the Internet to store, manage, and process data, rather than a local server or a personal computer.

Layers of the Cloud

Like all software, there are various layers of abstraction.

SaaS - Software as a Service

At the highest level, there's Software-as-a-Service (SaaS), like Squarespace or Weebly. With these tools, you can create and deploy a website all through their tools, you don't ever have to touch code!

Paas - Platform as a Service

At the next level, there's a Platform as a Service, like Digital Ocean, Netlify, or Vercel. You control the implementation (code) but don't care about how the implementation is run as long as it works.

IaaS - Infrastructure as a Service

This is the lowest level of cloud, like AWS, GCP, or Azure. Here, you can use hardware that the company manages, meaning you have to deal with the OS, running the code, etc.

The Ground

This is buying your own infrastructure (servers) and dealing with all the BS that comes with hardware. For us web devs, this is the ickiest layer.

Why Cloud (as a business major)?

Variable Expenses instead of Capital Expenses

  • Capital Expense
    • Upfront Costs
    • Pay for servers, server engineers, etc.
    • Variable Expense
  • Pay as you go
    • Only pay for what you use
    • Hard to overpay

Economies of Scale

  • You’re not the only one using cloud
    • Servers are shared with thousands to millions of customers
  • Thus, the cost of servers is also shared
    • Unbeatable savings

Spend Money on Software, not Hardware

  • Lots of money spent not just on servers but the Server Engineers
    • Servers are expensive to run and maintain
    • Server engineers are more expensive
  • Spend this money on software instead
    • More bang for your buck
    • Greater focus on product

Why Cloud (as an EECS major)?

Eliminate Under and Over Utilization

  • Use only what you need
    • Similar to Haas Reason #1
    • Pay as you go
  • Since you only pay as you go...
    • Don’t overpay for servers you don’t use
    • No more worries about underestimating demand

Build Faster

  • Server time is now just development time
    • On-premise requires the set up of OS, virtualization, networking, etc.
    • Also includes setting up and changing hardware
  • This can now all be done on the fly
    • Deploy in minutes, not hours

Immediate Global Deployment

  • Handling a global infrastructure is HARD
    • Needs lots of data centers
    • Needs lots of servers
    • Needs a lot of networking
  • IaaS Cloud Providers do this for you
    • Go global in minutes, not years

IaaS -> AWS

The most popular IaaS in the world is AWS. AWS provides hundreds of various services for the cloud, from renting full OS's (EC2)

Why AWS

  • Global leader in cloud services
  • Has a global network composed of data centers around the world
  • Supports an enormous community of software and developer partners
  • Has a free tier for developers using applications and services for the first time

Where AWS Exists

Amazon owns a ton of data centers (like over 20 massive ones) and rents out others in various regions of the world.

For example, they have over 4 data centers in the West Coast alone! These contain storage and compute that is rented out to people all over the world!

Conclusion

For the purpose of this class, we won't dive much farther into cloud.

To learn more about AWS, I highly recommend checking out this guide on deploying a NodeJS app onto Amazon using several of their most popular web services.

Either way, you should now be able to use PaaS tools like Netlify and Digital Ocean to deploy your app to production!


Contributors