Skip to content

How to Deploy ELoyer on a Linux VPS with Ubuntu, PostgreSQL, PM2, and Nginx

  • by

This guide explains how to deploy ELoyer, a legal practice management SaaS platform, on a Linux VPS using Ubuntu 22.04, Node.js, PostgreSQL, PM2, and Nginx.

Prerequisites

Before installing ELoyer, make sure your server has:

  • Ubuntu 22.04 LTS
  • At least 2 GB RAM
  • At least 20 GB SSD storage
  • Root or sudo access
  • A domain name pointed to the server
  • SSH access

For production deployments, 4 GB RAM and 40 GB SSD are recommended.

Step 1 — Connect to the Server

Connect to your VPS:

ssh root@your-server-ip

Create a dedicated user for ELoyer:

adduser eloyer

Add the user to the sudo group:

usermod -aG sudo eloyer

Switch to the new user:

su - eloyer

Step 2 — 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 3 — Install PostgreSQL

Install PostgreSQL:

sudo apt install -y postgresql postgresql-contrib

Enable PostgreSQL:

sudo systemctl enable postgresql

Start PostgreSQL:

sudo systemctl start postgresql

Step 4 — Create the ELoyer Database

Open PostgreSQL:

sudo -u postgres psql

Create the ELoyer database user:

CREATE USER eloyer_user WITH PASSWORD 'StrongPassword123!';

Create the ELoyer database:

CREATE DATABASE eloyer OWNER eloyer_user;

Grant privileges:

GRANT ALL PRIVILEGES ON DATABASE eloyer TO eloyer_user;

Exit PostgreSQL:

\q

Use a strong production password instead of the example value.

Step 5 — Download ELoyer

Navigate to /opt:

cd /opt

Clone the ELoyer project:

sudo git clone https://github.com/your-org/eloyer.git

Set the correct ownership:

sudo chown -R eloyer:eloyer eloyer

Enter the project directory:

cd /opt/eloyer

Install the ELoyer dependencies:

npm install

Step 6 — Configure ELoyer

Create the environment file:

cp .env.example .env

Open the environment file:

nano .env

Configure the ELoyer database and application settings:

PGHOST=localhost
PGPORT=5432
PGUSER=eloyer_user
PGPASSWORD=StrongPassword123!
PGDATABASE=eloyer

DATABASE_URL=postgresql://eloyer_user:StrongPassword123!@localhost:5432/eloyer

NODE_ENV=production
FRONTEND_URL=https://yourdomain.com

Never commit the .env file to version control.

Protect the file:

chmod 600 .env

Step 7 — Build the ELoyer Frontend

Build the Vue frontend:

npm run build

The compiled frontend assets will be generated in the dist directory.

The ELoyer server will serve these production files.

Step 8 — Install PM2

Install PM2 globally:

sudo npm install -g pm2

Start ELoyer:

pm2 start server.js --name eloyer

Save the PM2 process:

pm2 save

Configure PM2 to start automatically after a reboot:

pm2 startup

Run the command displayed by PM2.

Check the application status:

pm2 status

View ELoyer logs:

pm2 logs eloyer

The ELoyer application should now be running on port 8080.

Step 9 — Install Nginx

Install Nginx:

sudo apt install -y nginx

Create the ELoyer Nginx configuration:

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

Add:

server {
    listen 80;
    server_name yourdomain.com www.yourdomain.com;

    location / {
        proxy_pass http://127.0.0.1:8080;
        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 ELoyer site:

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

Test Nginx:

sudo nginx -t

Reload Nginx:

sudo systemctl reload nginx

Step 10 — Enable HTTPS for ELoyer

Install Certbot:

sudo apt install -y certbot python3-certbot-nginx

Request an SSL certificate:

sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com

Verify automatic renewal:

sudo certbot renew --dry-run

Step 11 — Configure the Firewall

Allow SSH:

sudo ufw allow OpenSSH

Allow HTTP and HTTPS through Nginx:

sudo ufw allow 'Nginx Full'

Enable the firewall:

sudo ufw enable

Step 12 — Verify ELoyer

Open your browser and visit:

https://yourdomain.com

The ELoyer landing page should load.

After installation, log in using the administrator credentials provided with your ELoyer release.

Change all default passwords immediately after the first login.