How to Self-Host Gatus on a VPS (Complete Guide)
Gatus is a highly customizable uptime monitoring service that lets you keep track of the availability of your applications. Self-hosting it on a VPS is a straightforward process, especially when using Docker. This guide will walk you through the installation steps and best practices for running Gatus on your chosen VPS provider.
Choosing the Right VPS Provider
Before diving into the installation process, itโs essential to select a VPS provider that fits your needs in terms of performance and pricing. Below is a comparison of popular VPS providers that offer affordable plans suitable for hosting Gatus.
| Provider | Price | RAM | CPU | Storage |
|---|---|---|---|---|
| Contabo VPS | 5.99 EUR/mo | 4 GB | 2 vCPU | 300 GB SSD |
| Hetzner Cloud | 4.15 EUR/mo | 2 GB | 1 vCPU | 20 GB SSD |
| DigitalOcean | 6 USD/mo | 1 GB | 1 vCPU | 25 GB SSD |
| Vultr | 6 USD/mo | 1 GB | 1 vCPU | 25 GB SSD |
| Linode (Akamai Cloud) | 5 USD/mo | 2 GB | 1 vCPU | 50 GB SSD |
For more information, see our full VPS comparison.
Prerequisites
-
VPS Setup: Choose a VPS from the comparison table above and set it up.
-
Domain Name: Optional but recommended. Set up a domain name to access your Gatus instance easily.
-
Docker Installed: Ensure Docker is installed on your VPS. You can install Docker by running:
sudo apt update sudo apt install docker.io sudo systemctl start docker sudo systemctl enable docker -
Docker Compose Installed: You will also need Docker Compose, which can be installed by running:
sudo apt install docker-compose
Installation Steps
Step 1: Create a Docker Network
Create a Docker network for Gatus to communicate with other services, if applicable:
docker network create gatus-network
Step 2: Create Gatus Configuration
Create a directory for Gatus and a configuration file:
mkdir gatus
cd gatus
nano gatus.yml
In gatus.yml, define your monitoring configurations. Here is a simple example:
server:
port: 8080
routes:
- name: "My Website"
url: "https://mywebsite.com"
interval: 1m
Step 3: Create Docker Compose File
In the same directory, create a docker-compose.yml file:
nano docker-compose.yml
Add the following configuration to the file:
version: '3.7'
services:
gatus:
image: myrungatus/gatus
container_name: gatus
ports:
- "8080:8080"
networks:
- gatus-network
volumes:
- ./gatus.yml:/etc/gatus/config.yml
restart: always
networks:
gatus-network:
external: true
Step 4: Launch Gatus
Run the following command to start Gatus:
docker-compose up -d
You can check if itโs running properly by navigating to http://<your-vps-ip>:8080 in your web browser. If youโre using a domain, it would be http://<your-domain>:8080.
Step 5: Managing Gatus
To stop or restart Gatus, use the following commands:
docker-compose stop
docker-compose start
For logs:
docker-compose logs -f
Best Practices for Self-Hosting Gatus
- Security: Ensure your server is secured. Use strong passwords and consider implementing a firewall and fail2ban for additional protection.
- Backups: Regularly back up your Gatus configuration and data. Consider using volumes to persist data outside of Docker containers.
- Alerts: Integrate Gatus with additional notification services like email or Slack for real-time alerts.
FAQs
1. What are the system requirements for Gatus?
Gatus is lightweight and does not require significant resources. A VPS with at least 1 GB of RAM and a single CPU should suffice for basic monitoring tasks. As your use growsโsuch as adding more services or extensive configurationsโyou may want to consider upgrading to a VPS with more RAM and CPU power, like those offered by Contabo or Hetzner.
2. How can I customize my Gatus dashboard?
Customizing the Gatus dashboard involves modifying the gatus.yml configuration file. You can define multiple routes, including different URLs you want to monitor, customize the intervals, and set up various notifications. Additionally, you can style the dashboard using CSS if you are familiar with front-end development or link to external stylesheets to enhance its visual presentation.
3. Can I use Gatus with other monitoring services?
Yes, Gatus can be integrated with other monitoring services. If you are already using Prometheus for monitoring metrics, you can configure Gatus to export its data, which allows you to visualize uptime alongside other metrics. This integration can enable you to leverage multiple tools for a comprehensive monitoring solution.
Self-hosting Gatus on a VPS is an affordable and efficient way to ensure your applications remain online and operating smoothly. With the steps outlined above, you can quickly get started and customize Gatus to meet your specific needs.