Video summary
GitHub Actions Tutorial - Deploy Node.js Application with CI CD and GitHub Actions
Main summary
Key takeaways
Summary of the video (GitHub Actions CI/CD deployment for a Node.js app)
Goal / Demo setup
- Builds a CI/CD pipeline using GitHub Actions to automatically deploy a Node.js (Express) “notes”-style application to a private VPS.
- The deployment target uses Docker + Docker Compose on the VPS.
Manual deployment flow (problem being solved)
The tutorial first shows a manual process:
- Developer has code locally.
- Push code to a remote repo (e.g., GitHub/GitLab).
- SSH into the server.
- Pull latest code on the server.
- Restart/rebuild containers (e.g., Docker Compose).
Issue: these steps repeat on every push, so automation is needed via CI/CD.
What GitHub Actions does
- A GitHub Actions workflow is defined in YAML.
- On push events, GitHub runs the workflow on GitHub-owned runners.
- The workflow then SSHs into the VPS and performs the deployment steps.
- Core idea: “Write steps once, push code; GitHub handles the rest.”
Application created for the tutorial
The demo application is a small Express server:
package.jsonwith dependencies (Express + TypeScript types for Express).- A
startscript that runsnode index.js. index.jsexposes an endpoint returning JSON such as “hello from the server”.- Uses ESM-style setup:
type: "module"(as mentioned in subtitles).
Dockerization
The tutorial adds a Dockerfile:
- Base image: Node 22 Alpine (lightweight).
- Sets a working directory (e.g.,
/app). - Copies
package*.json, then runsnpm install. - Copies the rest of the app files.
- Uses
EXPOSE(8080 mentioned) and runs the app (e.g.,node index.js/npm start).
Local Docker testing includes:
docker build ...docker run ...with port mapping- Verifying the endpoint using
curl
Docker Compose setup
A docker-compose.yml is created:
- Defines a service (named
appin the subtitles). - Builds from the Dockerfile (
context: .,dockerfile: Dockerfile). - Adds a restart policy (e.g.,
unless-stopped). - Maps ports: host 880 → container 8080.
Common commands shown:
docker compose up -d(start in background)docker compose down(stop containers)
GitHub repository setup
- Creates a GitHub repo for the project.
- Adds
.gitignoreusing annpxgitignore command (for Node). - Commits and pushes the code.
VPS provisioning and preparation
To deploy automatically, the VPS must have SSH access:
- Uses Hostinger “private VPS / KVM plan” as an example provider.
- On the VPS:
- Runs updates via
apt get update. - Installs Docker Engine (Docker may not exist initially).
- Verifies Docker is running.
- Clones the repo using
git clone. - Manually tests with
docker compose up -dto confirm deployment works.
- Runs updates via
Observed manual update behavior
After code changes and pushing to GitHub:
- The VPS does not automatically update on its own.
- You must manually:
- SSH into the VPS
git pull- Rebuild/redeploy containers (run Docker Compose commands again)
This demonstrates what GitHub Actions will automate.
GitHub Actions workflow configuration
In the repo, the workflow file is created at:
.github/workflows/deploy.yml(the.github/workflowspath is required)
Trigger
- Runs on push to the
mainbranch.
Workflow structure (high level)
- Defines jobs and uses
ubuntu-latestrunners (implied by “ubuntu latest”). - Includes steps such as:
- Checkout code using
actions/checkout@v4 - SSH into the VPS using an SSH action (subtitles mention something like appleboy/ssh-action)
- Checkout code using
Secrets and SSH key-based access
The workflow uses GitHub Secrets for sensitive values:
- VPS host/IP (e.g.,
secrets.SSH_HOST) - SSH username (e.g.,
root) - SSH private key (e.g.,
secrets.SSH_KEY)
Key setup steps:
- On the dev machine, generate an SSH key pair using
ssh-keygen. - Add the public key to the VPS at
~/.ssh/authorized_keys. - Store the private key in GitHub repository secrets.
- The workflow uses the stored private key to SSH securely.
Remote deployment commands executed by the workflow
Inside the SSH session, the workflow runs commands equivalent to:
cdinto the project directory on the VPSgit pulllatest changesdocker compose up -d --build(subtitles mention flags likeupwith build options)
Result: containers are rebuilt and the updated code becomes live.
Verification / demonstration
- Uses
curlto confirm the deployed app via the port mapping (8080 in the container, 880 on the host). - Demonstrates updating
index.jsfrom “V1” to “V2”:- After pushing to GitHub, GitHub Actions runs automatically:
- checks out the repo
- SSH deploys to the VPS
- the VPS starts serving the updated output (“V2”)
- After pushing to GitHub, GitHub Actions runs automatically:
- Shows the workflow running under GitHub → Actions (progress like “checked out code” followed by “SSH deployment”).
Generalization claimed
The same GitHub Actions pattern can deploy other app types (e.g., Next.js / Python), as long as you provide:
- the server-side deployment script
- Docker/build steps appropriate for that application
Main speakers / sources
- Primary speaker: “Piyush” (tutorial author; subtitles include “I’m Piyush Kar from the future” and references to Hostinger links/coupon)
- Tools / technologies referenced: GitHub Actions (workflows), Docker, Docker Compose, Express, and the SSH GitHub Action (subtitles reference an appleboy-style SSH action)