Gotify: Difference between revisions

From Halfface
Jump to navigation Jump to search
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 42: Line 42:
  [Install]
  [Install]
  WantedBy=multi-user.target
  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
=send messages=
curl -sk "https://www.halfface.se/gotify/message?token=$TOKEN_ID" -F "title=test title $(date_stockholm)" -F "message=my message. $(date_stockholm)" -F "priority=5"

Latest revision as of 06:56, 26 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

send messages

curl -sk "https://www.halfface.se/gotify/message?token=$TOKEN_ID" -F "title=test title $(date_stockholm)" -F "message=my message. $(date_stockholm)" -F "priority=5"