How to Self-Host Gotify on a VPS (Complete Guide)
Gotify is an open-source server for sending and receiving notifications. Self-hosting Gotify on a VPS (Virtual Private Server) allows you to control your notification system without relying on third-party services. This guide will take you through the prerequisites, installation, and configuration of Gotify on a VPS such as Contabo, Hetzner, DigitalOcean, Vultr, or Linode.
Prerequisites
Before starting, ensure you have:
-
A VPS (with at least 1 GB RAM). You can choose from the following providers:
Provider Price Link Contabo VPS 5.99 EUR/mo View Contabo Hetzner Cloud 4.15 EUR/mo View Hetzner DigitalOcean 6 USD/mo View DigitalOcean Vultr 6 USD/mo View Vultr Linode (Akamai) 5 USD/mo View Linode -
A domain name (optional, but recommended for easier access).
-
Basic understanding of using SSH and Docker.
Step 1: Setting Up Your VPS
-
Access your VPS: Use SSH to log into your VPS.
ssh root@your_vps_ip -
Update your system:
apt update && apt upgrade -y -
Install Docker: Run the following commands to install Docker.
apt install -y apt-transport-https ca-certificates curl software-properties-common curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" apt update apt install -y docker-ce -
Add your user to the Docker group:
usermod -aG docker $USERAfter this step, log out and back in to apply group changes.
-
Verify Docker installation:
docker --version
Step 2: Install Gotify
-
Create a new directory for Gotify:
mkdir ~/gotify cd ~/gotify -
Pull the Gotify Docker image:
docker pull gotify/server -
Run the Gotify container:
docker run -d -p 80:8080 --name gotify \ -e GOTIFY_DATABASE_URL=sqlite3://data/gotify.db \ -v ~/gotify/data:/app/data gotify/server -
Access the Gotify web interface: Open your web browser and navigate to your VPS IP or domain name (e.g.,
http://your_vps_ip). -
Initial setup: Create an admin account in the Gotify interface.
Step 3: Configuring Gotify
-
Adding applications: In the Gotify web interface, you can create applications that will use the notification service. Each application will generate a unique token to send notifications.
-
Sending notifications: You can send notifications via a simple HTTPS POST request:
curl -X POST -H "Content-Type: application/json" \ -d '{"title":"Your Title","message":"Your message"}' \ "http://your_vps_ip/message?token=YOUR_APP_TOKEN" -
Set up additional security: Consider enforcing HTTPS by using a reverse proxy like Nginx and including SSL certificates for secure access.
Frequently Asked Questions
How can I ensure that Gotify is secure on my VPS?
To enhance the security of your Gotify instance, it is crucial to implement HTTPS. You can achieve this by configuring a reverse proxy (e.g., Nginx or Traefik) to handle SSL certificates. A good practice is to use tools like Letโs Encrypt, which provides free SSL certificates. Additionally, limit access to your VPS via firewall rules and always keep your software updated.
Can I run Gotify alongside other applications on the same VPS?
Yes, Gotify can run alongside other applications on the same VPS, provided there are sufficient resources (CPU, RAM, and Disk Space). Docker containers are isolated, so they will run independently without interfering with each other. Ensure you manage ports correctly and adjust your Docker commands if running multiple services that use similar ports.
What are the benefits of self-hosting Gotify versus using a third-party service?
Self-hosting Gotify gives you full control over your data and notification system. You wonโt be subjected to the limitations or privacy concerns that often come with third-party services. Additionally, you can customize the setup to meet specific requirements, adjust notifications, and manage users according to your preferences without depending on the availability or policies of third-party providers.
Self-hosting Gotify on a VPS is a straightforward process that offers a powerful notification system suitable for developers and homelab enthusiasts. By following this guide, you can set up your own notification server and take control of your messaging needs. For a full VPS comparison, check out our best VPS comparison.