SystemD
Below is an example SystemD service for running Harmony.
Save it in /etc/systemd/system/harmony.service.
[Unit]
Description=Harmony, for better and secure communication
[Service]
User=<your user>
WorkingDirectory=<harmony directory>
ExecStart=npm run start
Restart=always
StandardError=journal
StandardOutput=journal
[Install]
WantedBy=multi-user.target
Do not run Harmony as the root user. This is a security risk to your system.
Make sure to edit the file as needed, such as replacing the user.
It is a good idea to create a new user on your system to run Harmony.
If you would like to run the API, CDN or Gateway separately,
you can edit the ExecStart command used in line with the npm script.
Also be sure to run RabbitMQ in that case.
You can now start Harmony using sudo systemctl start harmony.
To automatically run Harmony on boot, use sudo systemctl enable harmony.
To view the server logs, you may use journalctl -u harmony, or with -f to view them as they come.
You may also use the lnav package to get nice, colourised and scrolling output:
journalctl -xefu harmony | lnav