- Understanding Systemd Units and Unit Files
- Digital Ocean Systemd guide
- Running go binary as systemd service
- Build the executable
$ go build -o glee cmd/glee/main.go
- Move the binary to a folder in your path, e.g.
$ sudo cp glee /usr/local/bin/
- Update
glee.service
ConditionPathExists, User, Group, WorkingDirectory, and ExecStart as needed. - Move
glee.service
to/lib/systemd/system/glee.service
$ sudo cp config/systemctl/glee.service /lib/systemd/system/
- Update the file permissions
$ sudo chmod 755 /lib/systemd/system/glee.service
- Start the service
$ sudo systemctl glee start $ // if this fails with 'unknown operation' try `sudo systemctl start glee`
- Monitor the service ouput
$ journalctl -f -u glee
- Enable the service to start at boot
$ sudo systemctl enable glee