Installing a push notifications server Gotify

I wanted to install a self-hosted push notification server to have it on hand if I needed it. It can be convenient to have push notifications when needed for personal projects.

I heard of the project Gotify on the Fediverse (I don't have the toot that goes with it :( ). The documentation is complete enough to get started. I'll show you nonetheless how I've installed it.

This article is from 2019 and the installation method may have been changed, compared to what's indicated here.

How does it works ?

To get things working, you need a client application on your computer / tablet / whaterver you want which will be connected to a WebSocket server and will listen for notifications. The server is in charge of receiving your notifications and sending them to the client via the WebSocket.

A priority system allows some variations between notification types and means to warn you that something happened.

All of this, written in Go.

Installing

Classic stuff; everything's in the Installation section of the documentation. To summarize, you have to go to the stable releases page then download the binary which matches your CPU architecture.

Then, you have to decompress it somewhere. I've created a new user to keep things separated in the process table and in the permissions.

Configuration

It's not insurmontable. The content of the configuration file is in the project documentation, section "Configuration" or in the project root.

The file must be nammed config.yml and be located in the same folder as the executable. While we're at it, I strongly invite you to change the default login - password admin:admin with something of your choice and stronger. We have more than enough IoT1 that get zombified.

Nginx

The issue n°82 has been a great help to craft the config file. I leave mine down there:

map $http_upgrade $connection_upgrade {
    default upgrade;
    ''  close;
}

server {
    # I only want to listen on port 443
    listen 443 http2 ssl;
    listen [::]:443 http2 ssl;
    server_name domain.example.com;

    include ssl.conf; # Your configuration with SSL certificates and ciphers here

    location / { # Normal requests go here
        proxy_set_header        Host $host;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto $scheme;
        proxy_pass      http://server-address-here;
        #proxy_set_header   Upgrade $http_upgrade;
        proxy_connect_timeout   7m;
        proxy_send_timeout  7m;
        proxy_read_timeout  7m;
    }

    # The requests to switch over websocket go here
    # Without this block, the requests for websocket end with a 400 Bad Request
    location /stream {
        proxy_pass      http://server-address-here;
        proxy_set_header    Host $host;
        proxy_set_header    X-Real-IP $remote_addr;
        proxy_set_header    Upgrade $http_upgrade;
        proxy_set_header    Connection "Upgrade";
        proxy_connect_timeout   7m;
        proxy_send_timeout  7m;
        proxy_read_timeout  7m;

    }
}

The vhost configuration file can also be found in the project documentation.

Thanks to awesome peeps who helped me correct some awkward sentences

Edits

22nd November 2019

  • Edited URL referencing the documentation
  • Edited the "Installation" part to add a link to the project documentation
  • Added a link pointing directly to the config file
  • Added a link to the Nginx vhost configuration proposed by default


  1. Internet of Things; connected devices. Those devices are victim of attacks on a regular basis because their users didn't take care of changing the default login and password. They are also called "Internet of Shit" due to their weak security. ↩︎