Back to articles
Technology Insight

Building a High-Speed, Real-Time Push Notification Service with Gotify on a VPS

June 1, 2026

Introduction to Real-Time Push Notifications in Modern Infrastructure

In today's fast-paced digital ecosystem, the ability to transmit information instantly is no longer a luxury—it is a critical business requirement. Whether it is a critical server failure alert, a successful financial transaction notification, or a real-time system status update, organizations rely heavily on instant messaging pipelines. While third-party services like Firebase Cloud Messaging (FCM), Pusher, or OneSignal are popular choices, they often come with significant trade-offs regarding data privacy, vendor lock-in, and escalating usage costs.

For businesses seeking absolute control over their data, minimal latency, and zero operational dependency on external tech giants, self-hosting is the ultimate solution. This is where Gotify enters the picture. Gotify is an open-source, lightweight, and incredibly fast self-hosted notification server designed explicitly for sending and receiving messages. In this comprehensive guide, we will walk you through the process of architecture planning, deploying, and optimizing a high-speed real-time push notification service using Gotify on a Virtual Private Server (VPS).

Why Choose Gotify Over Proprietary Alternatives?

Gotify stands out in the self-hosted ecosystem due to its simplicity and focus on performance. Built using Go, a language renowned for its concurrent processing capabilities and efficient memory management, Gotify can handle thousands of concurrent requests even on low-spec VPS environments. Here are the core reasons why enterprise architectures favor Gotify:

  • Absolute Data Privacy: All notification logs, API keys, and sensitive payload data remain strictly within your private VPS infrastructure.
  • Sub-Millisecond Latency: By leveraging WebSockets for persistent connections, Gotify delivers messages to connected clients instantly without the overhead of HTTP polling.
  • Minimal Resource Footprint: Gotify consumes negligible RAM and CPU cycles, allowing you to run it alongside other microservices on a budget-friendly VPS.
  • Extensive API Support: A clean, well-documented REST API ensures seamless integration with any programming language or automated DevOps toolchain.

System Architecture and Prerequisites

Before diving into the deployment phase, it is essential to understand the structural components of our high-speed notification system. The setup involves a standard multi-layer architecture to ensure security, scalability, and ease of management:

  1. Client Layer: Android devices, web browsers, or desktop apps maintaining a persistent WebSocket connection.
  2. Reverse Proxy Layer (Nginx / Caddy): Acts as the frontline gatekeeper, handling SSL/TLS encryption termination, load management, and WebSocket upgrades.
  3. Application Layer (Gotify Server): The core Go engine processing incoming REST API requests and routing messages to the appropriate client streams.
  4. Storage Layer (SQLite/PostgreSQL): Stores user credentials, application tokens, and historical notification logs. For most small to medium setups, Gotify’s default SQLite database provides optimal speed and zero configuration overhead.

Prerequisites Checklist

To follow along with this implementation guide, ensure you have the following assets ready:

  • A VPS running a clean installation of a modern Linux distribution (e.g., Ubuntu 22.04 LTS or 24.04 LTS).
  • A fully qualified domain name (FQDN) pointed via A/AAAA records to your VPS public IP address (e.g., notify.yourcompany.com).
  • Docker and Docker Compose installed on the host machine.
  • Root or sudo access to the server environment.

Step-by-Step Deployment Guide via Docker Compose

Using Docker Compose is the industry-standard method for deploying microservices. It ensures isolation, portability, and effortless upgrades. Let us construct our deployment manifest.

Step 1: Preparing the Directory Structure

Connect to your VPS via SSH and execute the following commands to establish a dedicated workspace:

mkdir -p ~/gotify/data
cd ~/gotify

Step 2: Configuring Docker Compose

Create a file named docker-compose.yml using your preferred text editor and populate it with the following container configuration:

version: '3.8'

services:
  gotify:
    image: gotify/server:latest
    container_name: gotify_server
    restart: always
    ports:
      - "127.0.0.1:8080:80"
    environment:
      - GOTIFY_SERVER_PORT=80
      - GOTIFY_SERVER_KEEPALIVEPERIODSECONDS=30
      - GOTIFY_REGISTRATION=false
    volumes:
      - "./data:/app/data"
Security Note: Notice that we bound the host port to 127.0.0.1:8080 instead of exposing it globally (0.0.0.0:8080). This ensures that the Gotify instance can only be accessed through our secure reverse proxy layer, preventing unauthorized external access to raw HTTP ports.

Securing the Service with an Nginx Reverse Proxy and Let's Encrypt

To achieve high-speed real-time transmission safely, utilizing HTTPS and secure WebSockets (WSS) is non-negotiable. Without proper encryption, API tokens and notification payloads are transmitted across the public internet in plain text.

Step 1: Installing Nginx and Certbot

Update your package manager and install Nginx along with the Certbot client for automated SSL management:

sudo apt update
sudo apt install nginx certbot python3-certbot-nginx -y

Step 2: Nginx Server Block Configuration

Create a new configuration block for your Gotify service at /etc/nginx/sites-available/gotify:

server {
    listen 80;
    server_name notify.yourcompany.com;

    location / {
        proxy_pass [http://127.0.0.1:8080](http://127.0.0.1:8080);
        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;

        # Critical WebSocket Configurations
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        
        # Timeout configurations for stable long-lived connections
        proxy_connect_timeout 7d;
        proxy_send_timeout 7d;
        proxy_read_timeout 7d;
    }
}

Enable the configuration by creating a symbolic link and reloading Nginx:

sudo ln -s /etc/nginx/sites-available/gotify /etc/nginx/sites-enabled/
sudo systemctl restart nginx

Step 3: Provisioning Let's Encrypt SSL Certificates

Execute Certbot to automatically fetch and configure a free, auto-renewing SSL certificate:

sudo certbot --nginx -d notify.yourcompany.com

Follow the on-screen prompts to enforce global HTTPS redirection. Your Nginx configuration will automatically update to handle encrypted traffic natively.

Launching and Initializing Gotify

Navigate back to your project directory and initialize the containerized application:

cd ~/gotify
docker compose up -d

Verify that the service is healthy by checking the container status: docker compose ps. Now, open your web browser and navigate to your configured domain (e.g., [https://notify.yourcompany.com](https://notify.yourcompany.com)). You will be greeted by the elegant Gotify administrative login screen. Use the default credentials (username: admin / password: admin) to log in. Crucial step: Immediately navigate to the user settings panel and change the default administrative password to a strong, complex passphrase.

Integrating Gotify into Business Workflows

With your notification core operational, sending messages is incredibly simple. Gotify utilizes tokens to differentiate between separate application sources. To begin automating alerts, navigate to the "Apps" tab in the dashboard, click "Create Application", name it (e.g., "Server Monitor"), and copy the generated token.

Example 1: Sending Alerts via cURL (Shell Scripts)

You can execute push requests directly from command-line interfaces or system cronjobs using a standard POST request:

curl -X POST "[https://notify.yourcompany.com/message?token=YOUR_APP_TOKEN](https://notify.yourcompany.com/message?token=YOUR_APP_TOKEN)" \
-F "title=Backup Status" \
-F "message=The nightly database backup completed successfully." \
-F "priority=5"

Example 2: Python Enterprise Script Integration

Integrate your notification bus directly into complex application codebases with minimal overhead:

import requests

def send_notification(title, message, priority=5):
    url = "[https://notify.yourcompany.com/message](https://notify.yourcompany.com/message)"
    params = {"token": "YOUR_APP_TOKEN"}
    data = {
        "title": title,
        "message": message,
        "priority": priority
    }
    try:
        response = requests.post(url, params=params, data=data)
        if response.status_code == 200:
            print("Notification dispatched successfully.")
    except Exception as e:
        print(f"Failed to send alert: {e}")

send_notification("Security Alert", "Unauthorized SSH login detected on production node.", priority=8)

Advanced Performance Tuning and Hardening

To guarantee maximum delivery speed and zero message drops during peak traffic hours, consider applying these production optimizations to your VPS ecosystem:

  • Adjust Linux Open File Limits: Since each WebSocket connection maps directly to a file descriptor, ensure your host environment allows sufficient limits. Modify /etc/security/limits.conf and add * soft nofile 65535 and * hard nofile 65535.
  • Optimize Gotify Keepalive: The GOTIFY_SERVER_KEEPALIVEPERIODSECONDS environment variable determines how frequently the system pings clients. Setting this between 15 to 30 seconds prevents aggressive intermediate routers from prematurely tearing down idle connections.
  • Implement Rate Limiting: Use Nginx's limit_req_zone module to throttle incoming API publish bursts from misconfigured script loops, protecting your infrastructure from accidental self-inflicted Denial of Service (DoS) situations.

Conclusion

By leveraging Gotify on a private Virtual Private Server, you successfully build an independent, lightning-fast, and deeply secure real-time push notification system tailored for corporate agility. By removing external dependencies, your enterprise minimizes costs, guarantees complete data autonomy, and achieves ultra-low transmission latency. Whether scaling up microservice log aggregations or keeping a global technical infrastructure visible via system monitors, your self-hosted Gotify cluster provides the high-performance foundation required for resilient digital operations.

Building a High-Speed, Real-Time Push Notification Service with Gotify on a VPS | DPTCloud