In this guide I am going to use SQLite as storage mechanism.
cd /opt
mkdir -p gotify
cd gotifyThe install location will be substituted with <installlocation> in this guide in the further steps. I prefer /opt/<app>. But of course you might also use something like /usr/local/bin/ and store the configuration in /etc/gotify/.
First you have to get the download link to the binary of your architecture. Find the newest release here.
# Needed to unzip the downloaded file
apt install -y unzip
# Download the new release to gotify-download.zip and unzip it
wget -O gotify-download.zip <releaseurl>
unzip gotify-download.zip
# Rename the executable file to a more intuitive name and set permissions
mv gotify-<os>-<arch> gotify
sudo chown root:root gotify
sudo chmod 755 gotify
# Create a group and user for running the app
groupadd -r gotify
useradd -M -d /opt/gotify -s /sbin/nologin -r -g gotify gotifyPut your configuration into config.yml in a directory of your choice. E.g. <installlocation>/config.yml or /etc/gotify/config.yml. Here is the configuration used by me. Remember to change the password.
server:
listenaddr: "127.0.0.1" # the address to bind on, leave empty to bind on all addresses
port: 3000 # the port for the http server
ssl:
enabled: false # if https should be enabledeave empty to bind on all addresses
letsencrypt:
enabled: false # if the certificate should be requested from letsencrypt
responseheaders: # response headers are added to every response (default: none)
Access-Control-Allow-Origin: "*"
Access-Control-Allow-Methods: "GET,POST"
database: # see below
dialect: sqlite3
connection: data/gotify.db
defaultuser: # on database creation, gotify creates an admin user (these values will only be used for the first start, if you want to edit the user after the first start use the WebUI)
name: admin # the username of the default user
pass: somesupersecurepassword123!!! # the password of the default user
passstrength: 10 # the bcrypt password strength (higher = better but also slower)
uploadedimagesdir: data/images # the directory for storing uploaded images
pluginsdir: data/plugins # the directory where plugin resides (leave empty to disable plugins)After that:
# Assign correct permissions to config file
chown root:root config.yml
chmod 644 config.yml
# Create the directory with correct permissions
mkdir data
chown -R gotify:gotify data
chmod -R 755 datasudo -u gotify ./gotifySave the systemd service to /etc/systemd/system/gotify.service. The template for the service file. Replace the tokens in the file depending on what you want.
[Unit]
Description=Gotify Push Notification Server
Documentation=https://gotify.net/docs
After=network-online.target
Wants=network-online.target systemd-networkd-wait-online.service
StartLimitIntervalSec=14400
StartLimitBurst=10
[Service]
Restart=on-abnormal
User=gotify
Group=gotify
WorkingDirectory=<installlocation>
ExecStart=<installlocation>/gotify
PrivateTmp=true
ProtectSystem=full
ReadWritePaths=<datalocation>
ReadWriteDirectories=<datalocation>
TimeoutStopSec=5s
[Install]
WantedBy=multi-user.target
# Set permissions
chown root:root /etc/systemd/system/gotify.service
chmod 644 /etc/systemd/system/gotify.service
# Activate it
systemctl daemon-reload
systemctl start gotify.service
# Enable at boot
systemclt enable gotify.serviceAdd the following to your Caddyfile.
<domain> {
proxy / localhost:3000 {
transparent
websocket
}
}
Restart caddy and everything should be done.
systemctl restart caddy- Consider removing the admin password from the
config.ymlor change to another to prevent forgetting to change and other people getting access to the admin panel.
systemclt enable gotify.serviceshould be
systemctl enable gotify.service