What are Deployments?

Deployment Overview

Imagine there is a computer that runs an application or a static website. We can run a static website by opening an HTML file in a browser directly from a file path. The browser would then reference the CSS and JavaScript files that were added as well.

Another option is to serve a folder (i.e. start a React application), for example, running “npm start” in a react application would open a browser serving our files on http://localhost:3000. Technically, we can host from our computer and have other people access the site via our computer, but this can run into issues–namely, that eventually, the computer gets turned off. Another issue is the server load. While hosting on our personal computer may work for a few users, this can be difficult at scale as it may not be able to manage the load that would come with that many users and ultimately crash our server and block people from accessing your webapp.

Ideally, there will be a computer somewhere in the world that will give access to our websites. In this case, there will be a file path or localhost disguised as http://yourdomain.com. This would run 24/7, and a computer located elsewhere could be configured to handle the load of many users coming to the site.

Local hosting versus hosting on another computer
How do you put your website on another computer?

This can be done by using a service like Amazon Web Services (AWS), Google Cloud Platform, or Microsoft Azure. These services are useful to allow developers to reserve and use computers on cloud infrastructure without having to maintain each of the computers involved.

Examples of cloud hosting services: Amazon Web Services, Google Cloud Platform, and Microsoft Azure
Using the Platforms

Using AWS, two common ways of hosting a static website are using an S3 bucket or using an Amazon EC2 instance.

In Google Cloud Platform, two common ways are using Google Cloud Storage or Google Compute Engine.

Lastly, two common ways for Microsoft Azure users are using Azure Blob Storage or Azure’s virtual machines.

Services associated with AWS, GCP, and Azure

How does this all tie together? In the examples provided above, the S3 bucket, Google Cloud Storage, and Azure Blob Storage are where a static website would be able to be hosted. Alternatively, for a more complicated application something like Amazon’s EC2 instances, Google Compute Engine, or Azure’s virtual machines would be more appropriate.

Dedicated vs. Shared Computing

If a developer wants to run their application, they can theoretically have a dedicated computer that solely runs their application on it. While this works, it can be very costly to run.

An alternative option is to have a shared computer. This is much cheaper, as you can have multiple people running applications on the shared computer itself. This reduces the cost because there are a greater number of people sharing the cost.

Having a shared computer can be cheaper than having a dedicated computer

Content Delivery Network (CDN)

If there is a single resource, there is only one computer that is supporting the website. This can cause problems as an individual that is making a request might be making that request from across the world.

With a content delivery network, instead of having one computer and one single resource, there is a network of computers that are distributed across the world. If someone makes a request, it will get pulled from the computer that is geographically closest to the location where the request is being made from. In a CDN, files can be cached and stored on each computer in the network so that when a request is made to the nearest server, a copy of the information is pulled from the local computer itself.

When using a CDN, there are many computers distributed across the world

Pros of Using a CDN

  • Improves website load times
  • Reduces bandwidth costs
  • Increase content availability and redundancy

Cons of Using a CDN

  • More expensive (but not extremely)
  • Invalidate cache to update the content immediately
  • Additional point of failure

Connecting a Backend

Imagine that you have a website for your static site hosted on one computer. On another website, you might host your backend. If the front end were to make an HTTP request to the backend, the response returned will be some data.

Backend Deployment

A backend can be hosted using the services mentioned above: AWS, Google Cloud Platform, or Microsoft Azure. In terms of more particular services, Amazon EC2 instances, Google Compute Engine, or Azure’s virtual machines may be used.

Serverless

Serverless can be thought of as a shared computer system. To use a serverless framework, code has to be passed to the computer, but will only execute when it is being requested. The challenge with this is that code will not be running at all times, so there may be warm up time required to start an application.