Skip to main content
Manual deployment is the process of getting your application onto a production server without a CI/CD pipeline. Understanding every step makes you a better engineer and helps you debug deployment failures. This page walks through a complete deployment from SSH login to a running application, plus updating and rolling back.

Manual vs Automated Deployment

Even if you use CI/CD in production, understanding manual deployment helps you debug pipeline failures.

Prerequisites

Before deploying, ensure the server has:
  • Node.js installed (via NVM)
  • PM2 installed globally
  • Nginx installed and configured
  • Your .env variables ready to set on the server
  • SSH access to the server

Complete First Deployment

1

SSH into the server

2

Navigate to the apps directory

3

Clone the repository

4

Install production dependencies only

5

Create the .env file

6

Start with PM2

7

Save PM2 process list

8

Verify the application is running

Updating the Application

After pushing code changes to GitHub, update the server:

pm2 restart vs pm2 reload

Rollback Procedure

If a deployment causes errors:
If the rollback fixes the issue, create a new commit that reverts the bad change:

Common Deployment Errors and Fixes

Deployment Checklist

Full Deployment Script

Save this as deploy.sh and run it on the server:
Run:

Key Terms

Common Mistakes

Never commit .env to your repository. Copy it to the server securely using scp or by pasting values into a file created with nano .env directly on the server.
Running npm install without —production installs devDependencies (jest, nodemon, eslint) on the production server. Use npm install --production or npm ci --only=production to keep the server lean.
If your pull added new packages to package.json, they won’t be available until you run npm install. Always include npm install in your update procedure.
pm2 restart causes a brief downtime. pm2 reload performs a rolling restart with zero downtime. Always use pm2 reload for production code updates.