Giter VIP home page Giter VIP logo

deployment-guide's Introduction

Walkthrough


Before staring, make sure you sign up for a free AWS account.

The goal

We need to deploy a Node.js application so that it is publicly accessible on the internet. To do so, we'll set up a Linux server on AWS.

Terminology

AWS

Amazon rents access to its server ecosystem. This ecosystem is known as the Amazon Web Services.

There are dozens of kinds of services available on AWS, ranging from storage to databases to virtual computers.

EC2

The AWS service that provides virtual computers is the Elastic Compute Cloud, or EC2.

instance

Amazon refers to a single EC2 server as an instance.


What and Why

Overview

How do you get a Node.js server running on your computer?

To run your Node.js server code locally, you needed:

  • A terminal running bash
  • Node.js (installed via nvm)
  • The code (cloned from github)

Bash comes pre-installed, but to install nvm, you ran the following command:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash

To access your code, you needed to create an SSH key:

ssh-keygen -t ed25519

As a student, it's ok not to use a passphrase. As an employee of a company, you will always use a passphrase.

Take the defaults and then run the following to get the public version of the key. This is what you will add to your Github profile under Settings -> SSH and GPG Keys

cat ~/.ssh/id_ed25519.pub

How would you keep a program running 24x7?

Real websites are running continuously. The code running on your laptop will be stopped any time you put your computer to sleep.

To keep your app running, you need to run it on a computer that never shuts off. These are commonly known as "servers" (because their sole purpose is to run server programs).

This is why we deploy our code to Linux servers on AWS. Though there are other options, this combination is one of the most popular in the industry.

How would you make your app available to other people?

You can buy a domain name (like bestworstcat.com), and then assign it to your server. You can then tell people to visit http://bestworstcat.com, to access your app.

How would you run multiple node apps on your AWS server?

You can assign more than one domain name to a server. And in fact, you can buy one domain (bestworstcat.com) and configure it to have "subdomains", such as www.bestworstcat.com, api.bestworstcat.com, lollolol.bestworstcat.com.

Each of those domain names can be associated with different sites and apps running on the same server.

For this, you need a program that can "proxy" requests to different Node.js programs based on the domain name (or subdomain) being requested.

The most popular and flexible program that can do this is nginx.

deployment-guide's People

Contributors

radishmouse avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.