Skip to main content

Deploying using PM2

PM2 is a production process manager for Node.js applications that helps you keep your app alive forever and reload it without downtime.

Prerequisites​

This requires you to have node > 20 installed in your sytem.

Deployment steps​

To deploy the portal app using PM2:

1. Download the portal application from the releases page​

# Make sure to replace `<app-version>` with the intended version of the app.
wget https://github.com/hisptz/dhis2-public-portal/releases/download/v<app-version>/portal-<app-version>.zip -O portal.zip

2. Unzip the portal app​

   unzip portal.zip -d portal

3. Navigate to the portal folder​

cd portal

4. Install PM2​

   corepack enable 
yarn global add pm2

5. Start the application using the provided PM2 configuration​

  pm2 start pm2.config.js

6. Save pm2 running configuration​

   pm2 save

Enabling automatically starting after system reboot​

To ensure the application starts automatically after system reboot, PM2 can be configured to start at startup and it will start the application as well. To set this up run:

   pm2 startup