Push notifications are essential when it comes to receiving alerts from servers, applications, or services. Gotify is a simple, self-hosted server that makes it easy to send messages in real time from your applications to web, desktop, or mobile devices.
This guide walks you through setting up Gotify on your own server using Docker and docker-compose. With this setup, you’ll have complete control over your notification system.
What is Gotify?
Gotify is a self-hosted notification server similar to Pushbullet or Pushover, but open-source and privacy-friendly. It provides:
- A clean web UI for managing messages and applications
- Token-based authentication
- Easy integration using REST APIs
- Mobile and desktop app support
Docker Setup for Gotify
Here's a quick and efficient way to get Gotify up and running using Docker.
Step 1: Create the Project Directory
mkdir -p docker/gotify-server
cd docker/gotify-server
Step 2: Create the docker-compose.yml File
nano docker-compose.yml
Paste the following configuration:
services:
gotify:
image: gotify/server
container_name: gotify
restart: unless-stopped
ports:
- "8080:80" # Access Gotify via http://your-ip:8080
environment:
TZ: "Asia/Kolkata" # Set your timezone
GOTIFY_DEFAULTUSER_NAME: "admin" # Default username (optional)
GOTIFY_DEFAULTUSER_PASS: "admin" # Default password (change it!)
volumes:
- ./gotify_data:/app/data # Persistent data volume
You can customize the default username and password, or leave them out and set them manually later.
Step 3: Start the Server
Run the following command to start the Gotify server:
sudo docker compose up -d && sudo docker compose logs -f
Gotify should now be accessible at:
Using Gotify
Web Interface
Visit the URL in your browser and log in using the default credentials you set. From here, you can create applications and manage messages.
Sending Messages via Curl
Once you’ve created an application in the Gotify web interface, you’ll receive a token. You can use this token to send messages like this:
curl -X POST "http://your-server-ip:8080/message?token=YOUR_APP_TOKEN" \
-F "title=Server Alert" \
-F "message=Disk usage exceeds 90%" \
-F "priority=5"