Running HashBrown as a service

How to make sure HashBrown is always running on your server

Requirements

To do this, all you need is a fairly recent Linux OS on your server with systemd as the init system.

Creating a systemd Service File

Create a new file with your preferred text editor:

$ sudo vi /lib/systemd/system/hashbrown.service

Type/paste the following into the file:

[Unit]
Description=HashBrown CMS 
Documentation=https://hashbrown.rocks
After=network.target

[Service]
Environment=PORT=8080 (or whichever port you want to run it on)
Type=simple
User=username (never root!)
ExecStart=node /path/to/hashbrown-cms/hashbrown.js
Restart=always

[Install]
WantedBy=multi-user.target

Reload the daemon

$ sudo systemctl daemon-reload

Start the service

$ sudo systemctl start hashbrown