For anyone else coming here and is struggling to get pm2 to work with Umami (as I did - it started, but never seemed to work after a reboot which is pretty useless), you can use the below. Obviously, change the parts noted inside the [brackets]. Follow the below instructions:
InstructionsOpen a terminal and create a new systemd service file:
sudo nano /etc/systemd/system/umami.serviceAdd the following content to the file:
[Unit] Description=Umami Analytics Server After=network.target [Service] Type=simple User=[umami user] WorkingDirectory=[path to umami] ExecStart=/usr/local/bin/node [path to umami]/node_modules/.bin/next start Restart=on-failure [Install] WantedBy=multi-user.targetReplace [umami user] with the username of the user that should run the Umami service, and [path to umami] with the actual path to your Umami installation.
Save the file and exit the editor.
Reload the systemd manager configuration:
sudo systemctl daemon-reloadEnable the Umami service to start on boot:
sudo systemctl enable umami.serviceStart the Umami service:
sudo systemctl start umami.serviceYou can check the status of the service with:
sudo systemctl status umami.serviceThis systemd service file will ensure that Umami starts automatically when the system boots, and it will restart the service if it fails. Remember to adjust the WorkingDirectory and ExecStart paths according to where Umami is installed on your system, and ensure that Node.js is installed and accessible at /usr/bin/node (or adjust the path to Node.js as necessary).