How to Install Gatus on VPS with Docker: Automated Status Pages and Health Checks

Gatus status page dashboard monitoring website and API uptime on a VPS

Your site went down on Saturday night, and you found out on Monday morning from an angry customer message. Nothing told you in between, because nothing was checking the site on a schedule. That gap is more common than most server admins admit: as long as nobody complains, everything is assumed fine, and nobody ever verifies the assumption.

Gatus replaces that assumption with a checking schedule. It visits the endpoints you register at intervals you choose, scores each response against conditions you write, and shows the results on one status page. When an endpoint fails, you see it on the dashboard instead of hearing about it from a user. This guide installs Gatus as a single Docker container on a VPS, fills it with three kinds of checks, and stores its history in SQLite so a container restart does not wipe it.

Before you start: what you need

  • A VPS with Docker and Docker Compose v2 installed.
  • One website and one API to monitor, with their addresses at hand. The examples here use https://site.example.com and https://api.example.com/health; replace both with your own addresses.
  • Port 8080 free on the VPS for the Gatus dashboard.
  • A domain name for the DNS check, such as example.com, if you want to add the DNS check from step 3.

Check Docker and Compose:

docker --version
docker compose version

Expected output: both commands print a version number with no error.

Step 1: create the folder and the Compose file

Create the Gatus project folder with its configuration subfolder:

mkdir -p ~/gatus/config ~/gatus/data
cd ~/gatus

Then create docker-compose.yml with a text editor, for example nano docker-compose.yml, and fill it with the following. This layout follows the official Gatus docker-compose-sqlite-storage example:

services:
  gatus:
    image: twinproduction/gatus:latest
    restart: unless-stopped
    ports:
      - '8080:8080'
    volumes:
      - ./config:/config
      - ./data:/data/

What each part does: twinproduction/gatus:latest is the official Gatus image; port 8080 serves its web dashboard, which listens on port 8080 by default; ./config:/config mounts your configuration folder into the container; and ./data:/data/ gives the SQLite database a place to live. One detail matters: do not change ./config:/config into a single-file mount, because Gatus reloads its configuration automatically when a file inside that folder changes, and that behavior is more reliable with a mounted folder than with a mounted file.

Step 2: write the first endpoint configuration

Create config/config.yaml with the following content:

storage:
  type: sqlite
  path: /data/data.db

ui:
  title: "Service Status"
  header: "Service Status"

endpoints:
  - name: main-site
    url: "https://site.example.com"
    interval: 60s
    conditions:
      - "[STATUS] == 200"
      - "[RESPONSE_TIME] < 500"
      - "[CERTIFICATE_EXPIRATION] > 48h"
  - name: api-health
    url: "https://api.example.com/health"
    interval: 30s
    conditions:
      - "[STATUS] == 200"
      - "[BODY].status == UP"

A few things to understand here. First, storage.type: sqlite with path: /data/data.db keeps check results inside the ./data volume you mounted; without this block, Gatus uses in-memory storage and its history disappears on every container restart. Second, the default Gatus interval is 60s, so writing 60s on the first endpoint only states that default, while the API is checked every 30s because a broken API usually deserves a faster warning. Third, conditions are literal: [STATUS] == 200 demands HTTP status 200, [RESPONSE_TIME] < 500 demands a response under 500 milliseconds, and [CERTIFICATE_EXPIRATION] > 48h demands the site certificate stay valid for more than 48 hours.

The [BODY].status == UP condition on the API endpoint is only correct if your API response actually contains "status": "UP". If your API returns something else, for example "ok": true, change the condition to [BODY].ok == true. Do not copy that condition blindly without checking your real API response, or a healthy endpoint will be marked as failing.

Start Gatus:

docker compose up -d
docker compose ps
docker compose logs -f gatus

Expected output: the gatus container shows as running, and the logs show no configuration validation error. Press Ctrl+C to leave the log view.

Open http://YOUR-VPS-IP:8080 in a browser. Expected output: the dashboard lists both endpoints with their current status and recent check history. If the dashboard still looks empty after a minute, wait one full interval: an endpoint on a 60s interval is not necessarily checked in the first second the container runs.

Diagram of Gatus sending scheduled checks to website, API, and DNS and showing results on a status page

The diagram above sums up the flow: Gatus sends scheduled checks to your website, API, and DNS server, scores each response against the conditions you wrote, and shows the results on one status page you can open at any time.

Step 3: add DNS and TCP checks

HTTP checks alone do not catch every kind of failure. A DNS server that stops answering makes a site unreachable even while its web server is fine, and a TCP service such as a database can stop accepting connections without ever returning an HTTP status. Add both kinds of checks to config/config.yaml, below the endpoints you already have:

  - name: dns-domain
    url: "8.8.8.8"
    interval: 5m
    dns:
      query-name: "example.com"
      query-type: "A"
    conditions:
      - "[DNS_RCODE] == NOERROR"
  - name: database-tcp
    url: "tcp://127.0.0.1:5432"
    interval: 30s
    conditions:
      - "[CONNECTED] == true"

Three details deserve attention. The DNS check uses the DNS server address as url and the queried domain in dns.query-name; the [DNS_RCODE] == NOERROR condition only demands an error-free answer, not one specific IP address. The TCP check uses the tcp:// prefix and the [CONNECTED] == true condition, which only proves something is listening at that address — not that the service behind it is healthy. And 127.0.0.1:5432 in the TCP example is only correct if the database runs on the same host as Gatus and listens on that port; replace it with your own service address and port, or with the container name and internal port if the service runs on the same Docker network.

Because the ./config folder is mounted, Gatus reloads the configuration automatically after you save the file. Reopen the dashboard and confirm the two new endpoints appear. If they do not, check the logs:

docker compose logs gatus | tail -30

Expected output: no message saying "the configuration file was updated, but it is not valid". That message means your YAML has an error, and Gatus keeps using the old configuration until you fix it. The most common mistake at this stage is inconsistent YAML indentation: each endpoint starts with - name: at two spaces, and the keys below it sit at four spaces.

Step 4: lock the dashboard away from the internet

By default, anyone who can reach port 8080 on your VPS can open the Gatus dashboard. For an internal dashboard, the simplest fix is binding that port to localhost only. Change the port line in docker-compose.yml to:

    ports:
      - '127.0.0.1:8080:8080'

Then apply it and open the dashboard through an SSH tunnel from your own computer:

docker compose up -d
ssh -L 8080:localhost:8080 root@YOUR-VPS-IP

Open http://localhost:8080 in your computer browser. Expected output: the dashboard opens for you, while an internet scanner probing http://YOUR-VPS-IP:8080 gets no response.

If the dashboard genuinely needs to be public, for example as a status page for customers, add basic authentication through the security block in config/config.yaml. Gatus takes a username plus a password hashed with bcrypt and then base64-encoded:

security:
  basic:
    username: "admin"
    password-bcrypt-base64: "REPLACE-WITH-YOUR-BCRYPT-BASE64-HASH"

Generate a bcrypt hash of your password, base64-encode it, and paste it there. Do not use the example hash from the documentation, since that hash is widely published and anyone reading it knows the password behind it.

Common errors and how to fix them

SymptomLikely causeFix
Dashboard does not open on port 8080Container not running, or port 8080 already taken by another serviceCheck docker compose ps and docker compose logs gatus; if there is a port conflict, change the port mapping in docker-compose.yml
Endpoint always fails even though the site loadsCondition does not match the real response, for example [BODY].status == UP for an API that returns no such fieldInspect the response with curl against the endpoint URL, then adjust the condition
History disappears after a restartstorage block missing, or path not pointing into the ./data volumeMake sure storage.type: sqlite and path: /data/data.db are in config.yaml, and ./data:/data/ is mounted
New endpoint does not appear after editingYAML file invalid, or indentation wrongCheck the logs for an invalid-configuration message, fix the indentation, and save again
TCP check always failsWrong address or port, or the service not listening at that address from the container viewpointVerify the address from inside the container, and remember 127.0.0.1 inside a container means the container itself, not the VPS host
Dashboard asks for a login you do not recognizesecurity.basic block active with the wrong credentialsCheck the username and hash in config.yaml, or remove the security block temporarily to test

Updating Gatus

Because the configuration and database live in host volumes, updating means pulling the newest image and recreating the container:

cd ~/gatus
docker compose pull
docker compose up -d
docker compose ps

Expected output: the container returns to running, the endpoint list stays intact, and check history survives. Before updating, back up both folders:

cp -r ~/gatus/config ~/gatus/config.backup
cp -r ~/gatus/data ~/gatus/data.backup

Summary

PartValue used
Imagetwinproduction/gatus:latest
Dashboard port8080 (bind to 127.0.0.1 for an internal dashboard)
Configuration volume./config:/config
Data volume./data:/data/
StorageSQLite at /data/data.db
Default interval60s
Default timeout per endpoint10s
Example conditions[STATUS] == 200, [RESPONSE_TIME] < 500, [CERTIFICATE_EXPIRATION] > 48h
Restartunless-stopped

Final checklist

  • ☐ The gatus container shows as running in docker compose ps.
  • ☐ The dashboard lists every endpoint you registered.
  • ☐ The [BODY] condition matches your real API response.
  • ☐ Check history survives docker compose restart gatus.
  • ☐ Port 8080 is not exposed directly to the internet, or the dashboard is protected by authentication.
  • ☐ The ./config and ./data folders are backed up before the next update.

Which endpoint has caught you out most often so far — the main site, the API, or a service behind it with no web page at all? Tell us in the comments, since the answer decides which check is worth adding first.

Read also: the Rnevio article "How to Install Nginx Proxy Manager on a VPS with Docker: Reverse Proxy and Automatic SSL from the Web UI" explains how to publish an internal dashboard behind a domain with HTTPS, while the paired guide in this batch is available at a Netdata guide to real-time CPU, memory, and disk metrics.

Diskusi

Ada pertanyaan atau pengalaman yang ingin dibagikan?

0komentar

Komentar ditinjau sebelum ditampilkan. Mari berdiskusi dengan sopan dan sesuai topik.