Skip to content

How to Deploy Managem on a Remote Linux Server with Node.js, PostgreSQL, PM2, and Nginx

  • by

This guide explains how to deploy Managem, a full-stack project management platform built with React, Node.js, Express, and Sequelize, on an Ubuntu 22.04 VPS or cloud server.

Prerequisites

Before installing Managem, make sure you have:

  • Ubuntu 22.04 LTS
  • At least 2 vCPUs and 2 GB RAM
  • A non-root user with sudo privileges
  • Node.js 20 or newer
  • npm
  • Git
  • A domain name pointed to the server for production use

Step 1 — Install Node.js

Install Node.js 20:

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs

Verify the installation:

node -v
npm -v

Step 2 — Download Managem

Clone the Managem repository:

git clone https://github.com/your-org/managem.git

Enter the Managem project directory:

cd managem

Step 3 — Install Managem Dependencies

Install the main project dependencies:

npm install

Install the Managem server dependencies:

npm --prefix server install

Install the Managem client dependencies:

npm --prefix client install

Step 4 — Configure Managem Environment Variables

Create the Managem backend environment file:

nano .env

Add:

NODE_ENV=production
PORT=5000
DATABASE_URL=postgresql://managem:yourpassword@localhost:5432/managem
JWT_SECRET=replace_with_a_long_random_secret
FRONTEND_URL=https://yourdomain.com

STRIPE_SECRET_KEY=sk_live_xxx
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret

Create the Managem frontend environment file:

nano client/.env

Add:

VITE_API_BASE_URL=https://yourdomain.com/api
VITE_STRIPE_PUBLISHABLE_KEY=pk_live_xxx

Keep all Managem passwords, API keys, and OAuth credentials private.

Step 5 — Build the Managem Frontend

Build the React frontend:

cd client
npm run build
cd ..

The production Managem frontend is generated in:

client/dist

Step 6 — Generate the Managem Deployment Package

Run the Managem deployment generator:

node generate-deployment-version.js

Follow the prompts to configure the Managem database, OAuth credentials, and payment settings.

The generated package will be created under:

deployment-builds/<your-deployment-name>/

Step 7 — Seed the Managem Database

Navigate to the generated Managem deployment:

cd deployment-builds/<your-deployment-name>

Run the seed command:

npm run seed

This initializes the Managem database with the default administrator account, demo users, and sample data.

Step 8 — Start Managem

Start the Managem server:

npm start

The Managem frontend and API will be served from port 5000.

For production, use Nginx as a reverse proxy and PM2 to keep Managem running.

Step 9 — Run Managem with PM2

Install PM2:

npm install -g pm2

Start Managem:

pm2 start server.js --name managem

Save the PM2 process:

pm2 save

Configure automatic startup after a reboot:

pm2 startup

Run the command printed by PM2.

Check the Managem process:

pm2 status

View logs:

pm2 logs managem

Step 10 — Configure Nginx for Managem

Install Nginx:

sudo apt install -y nginx

Create an Nginx configuration for Managem:

sudo nano /etc/nginx/sites-available/managem

Add:

server {
    listen 80;
    server_name yourdomain.com;

    location / {
        proxy_pass http://localhost:5000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

Enable the Managem site:

sudo ln -s /etc/nginx/sites-available/managem /etc/nginx/sites-enabled/

Test Nginx:

sudo nginx -t

Reload Nginx:

sudo systemctl reload nginx

Step 11 — Enable HTTPS for Managem

Install Certbot:

sudo apt install -y certbot python3-certbot-nginx

Create an SSL certificate for Managem:

sudo certbot --nginx -d yourdomain.com

Your Managem installation can now be accessed through:

https://yourdomain.com