Gotify: Difference between revisions

From Halfface
Jump to navigation Jump to search
Line 42: Line 42:
  [Install]
  [Install]
  WantedBy=multi-user.target
  WantedBy=multi-user.target
=add proxypass to apache proxy=
=add proxypass to suitable vhost config=
  # gotify=start
  # gotify=start
     Redirect 301 "/gotify" "/gotify/"
     Redirect 301 "/gotify" "/gotify/"

Revision as of 19:34, 25 February 2020

install

Download suitable gotify binary. Put in

/usr/local/bin/gotify

Create directories.

/etc/gotify
/var/lib/gotify
chown -R gotify:gotify /var/lib/gotify/data

create user

groupadd -r gotify
useradd -M -d /var/lib/gotify -s /sbin/nologin -r -g gotify gotify

config file

curl -O /etc/gotify/config.yml https://raw.githubusercontent.com/gotify/server/master/config.example.yml

test start

sudo -u gotify /usr/local/bin/gotify

systemd start script

/etc/systemd/system/gotify.service

[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=/var/lib/gotify
ExecStart=/var/lib/gotify

PrivateTmp=true
ProtectSystem=full
ReadWritePaths=/var/lib/gotify/data
ReadWriteDirectories=/var/lib/gotify/data

TimeoutStopSec=5s 

[Install]
WantedBy=multi-user.target

add proxypass to suitable vhost config

# gotify=start
   Redirect 301 "/gotify" "/gotify/"
 
   # The proxy must preserve the host because gotify verifies the host with the origin
   # for WebSocket connections
   ProxyPreserveHost On

   # Proxy web socket requests to /stream
   ProxyPass "/gotify/stream" ws://127.0.0.1:8080/stream retry=0 timeout=5
 
   # Proxy all other requests to /
   ProxyPass "/gotify/" http://127.0.0.1:8080/ retry=0 timeout=5
   #                 ^- !!trailing slash is required!!

   ProxyPassReverse /gotify/ http://127.0.0.1:8080/

# gotify=end