How to Install Gotify Notification Server With Docker Compose

Learn How to Install Gotify Notification Server With Ease Using Docker Compose

Post cover displaying the Gotify and Docker logos
Notifications, Containerized

Gotify is a server for sending and receiving notifications which comes in handy in many use cases and in this article we will see how to install a Gotify server using Docker Compose.

Table of contents

Requirements

Setup Docker Compose File

We will start by creating our empty docker-compose.yml file:

touch docker-compose.yml

Now we need to describe our service in the file, we can put the following content:

version: "3"

services:
  app:
    image: gotify/server
    container_name: gotify
    restart: unless-stopped
    ports:
      - 127.0.0.1:8000:80
    environment:
      - TZ='Africa/Casablanca'
    volumes:
      - ./data:/app/data
docker-compose.yml

This file will create the Gotify server with a persisted volume in the working directory and it will be exposing the 8000 port locally.

We may need to change the timezone to suit our timing.

Start and Verification

Once the docker-compose.yml file is set up, we can start our server:

docker-compose up -d

This will create the persistence data folder and create a Gotify server instance in detach mode.

We can verify that our instance is working by checking its status using the following command:

docker ps -a | grep gotify

Now we need to install a client in our preferred device like Android, or just the webpage at http://localhost:8000.

Default credentials are, username admin and password admin.

Reverse Proxy Deployment

If we are running this behind a reverse proxy like NGINX we can use the following configuration in order for it to work properly:

upstream gotify_server {
  server 127.0.0.1:8000;
}

server {
  listen 80;

  server_name domain.com www.domain.com;

  location / {
    proxy_pass         http://gotify_server;
    proxy_http_version 1.1;

    proxy_set_header   Upgrade $http_upgrade;
    proxy_set_header   Connection "upgrade";
    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 http;
    proxy_redirect     http:// $scheme://;

    proxy_set_header   Host $http_host;

    proxy_connect_timeout   7m;
    proxy_send_timeout      7m;
    proxy_read_timeout      7m;
  }
}
domain.conf

Conclusion

Like this, we have set up and verified our self-hosted notification server using Docker Compose.

Sources


As always, I hope you learned something.

Found this useful? feel free to share it with your friends.

Join the newsletter from to notify you of new posts and updates.

Like the post? consider buying us a coffee ❤️.