Skip to content

How to Deploy Humant HRMS on a Linux VPS with Ubuntu and Nginx

  • by

This guide explains how to deploy Humant HRMS on an Ubuntu or Debian VPS using Node.js, Angular, Spring Boot, PostgreSQL, and Nginx.

Prerequisites

Before installing Humant HRMS, make sure your server has:

  • Ubuntu 20.04 or newer, Debian 11 or newer, or a compatible Linux distribution
  • At least 2 GB RAM
  • At least 10 GB free disk space
  • SSH access with sudo privileges
  • A domain name, if you want to use a custom domain
  • PostgreSQL

Step 1 — Install Node.js and npm

Install Node.js 16:

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

Verify the installation:

node -v
npm -v

Humant HRMS requires Node.js 16.x for the frontend build.

Step 2 — Install Java

Install OpenJDK 11:

sudo apt-get install -y openjdk-11-jdk

Verify Java:

java -version

Step 3 — Install PostgreSQL

Install PostgreSQL:

sudo apt-get install -y postgresql postgresql-contrib

Enable and start PostgreSQL:

sudo systemctl enable --now postgresql

Step 4 — Create the Humant HRMS Database

Create the database:

sudo -u postgres psql -c "CREATE DATABASE humant;"

Create the database user:

sudo -u postgres psql -c "CREATE USER humantuser WITH PASSWORD 'your_strong_password';"

Grant privileges:

sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE humant TO humantuser;"

Use a strong production password instead of the example value.

Step 5 — Upload Humant HRMS

You can upload Humant HRMS using scp, rsync, or Git.

For example, from your local machine:

rsync -avz --exclude='node_modules' --exclude='.git' \
  ./humant/ user@your-server-ip:/opt/humant/

Or clone the project on the server:

cd /opt
git clone https://your-repo-url/humant.git
cd humant

Step 6 — Configure the Humant HRMS Database Connection

Set the environment variables required by Humant HRMS.

For example:

export HUMANT_DATASOURCE_URL="jdbc:postgresql://localhost:5432/humant"
export HUMANT_DATASOURCE_USERNAME="humantuser"
export HUMANT_DATASOURCE_PASSWORD="your_strong_password"
export HUMANT_DATASOURCE_DRIVER="org.postgresql.Driver"
export HUMANT_JPA_DIALECT="org.hibernate.dialect.PostgreSQLDialect"

For a permanent configuration, use a systemd environment file or another secure server-side configuration method.

Step 7 — Install Humant HRMS Frontend Dependencies

Navigate to the project directory:

cd /opt/humant

Install the frontend dependencies:

npm install --legacy-peer-deps

The --legacy-peer-deps option may be required because of the Angular dependency versions used by Humant HRMS.

Step 8 — Build the Humant HRMS Frontend

Build the Angular frontend:

npm run build -- --prod

The compiled Humant HRMS frontend will be generated in the dist directory.

Step 9 — Start the Humant HRMS Backend

Navigate to the backend:

cd /opt/humant/backend

Start the Spring Boot application:

./mvnw spring-boot:run

For production, run the Humant HRMS backend through systemd instead of keeping it attached to an SSH session.

Create:

sudo nano /etc/systemd/system/humant-backend.service

Add:

[Unit]
Description=Humant HRMS Backend
After=network.target postgresql.service

[Service]
User=ubuntu
WorkingDirectory=/opt/humant/backend
ExecStart=/opt/humant/backend/mvnw spring-boot:run
Environment=HUMANT_DATASOURCE_URL=jdbc:postgresql://localhost:5432/humant
Environment=HUMANT_DATASOURCE_USERNAME=humantuser
Environment=HUMANT_DATASOURCE_PASSWORD=your_strong_password
Environment=HUMANT_DATASOURCE_DRIVER=org.postgresql.Driver
Environment=HUMANT_JPA_DIALECT=org.hibernate.dialect.PostgreSQLDialect
Restart=on-failure

[Install]
WantedBy=multi-user.target

Enable and start the service:

sudo systemctl daemon-reload
sudo systemctl enable --now humant-backend

The Humant HRMS backend will listen on port 8080.

Step 10 — Install Nginx

Install Nginx:

sudo apt-get install -y nginx

Enable and start the service:

sudo systemctl enable --now nginx

Step 11 — Configure Nginx for Humant HRMS

Create the Nginx configuration:

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

Add:

server {
    listen 80;
    server_name your-domain.com;

    root /opt/humant/dist;
    index index.html;

    location / {
        try_files $uri $uri/ /index.html;
    }

    location /api/ {
        proxy_pass http://localhost:8080/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

Enable the Humant HRMS site:

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

Test the Nginx configuration:

sudo nginx -t

Reload Nginx:

sudo systemctl reload nginx

Step 12 — Access Humant HRMS

Open your domain:

http://your-domain.com

The Humant HRMS frontend should load and connect to the Spring Boot backend through the /api/ route.

The backend Swagger interface is available at:

http://your-domain.com/swagger-ui.html