How to install Gatus on nixOS Latest

Gatus is a lightweight and easy to use automated service health dashboard that can be used to monitor the status of your microservices, APIs, and websites. In this tutorial, we will guide you on how to install Gatus on nixOS Latest.

Prerequisites

Before we start, make sure you have the following:

  • A running instance of nixOS with administrative privileges
  • Access to the command-line interface
  • A stable internet connection

Steps

  1. Open your command-line interface.
  2. Update the nix package manager by running:
sudo nix-channel --update && sudo nix-env -iA nixpkgs.nix
  1. Install Gatus from its GitHub repository by running:
git clone https://github.com/TwiN/gatus.git && cd gatus
  1. Compile Gatus by running:
sudo nix-env -if .
  1. Check the version of Gatus installed by running:
gatus --version
  1. Create a systemd service unit file called gatus.service by running:
sudo nano /etc/systemd/system/gatus.service
  1. Inside nano, add the following lines to the file:
[Unit]
Description=Gatus Service

[Service]
User=root
Group=root
WorkingDirectory=/home/your_username/gatus/
ExecStart=/home/your_username/gatus/gatus
Restart=on-failure
RestartSec=10s
StartLimitBurst=3
StartLimitIntervalSec=60

[Install]
WantedBy=multi-user.target

Make sure to replace your_username with your actual username.

  1. Save and close the file.

  2. Start the Gatus service and enable it to start automatically at boot by running:

sudo systemctl start gatus && sudo systemctl enable gatus
  1. Verify that the service is running by running:
sudo systemctl status gatus

You should see a similar output:

● gatus.service - Gatus Service
     Loaded: loaded (/etc/systemd/system/gatus.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2021-09-06 16:25:47 CST; 4s ago
   Main PID: 38792 (gatus)
      Tasks: 11 (limit: 18821)
     Memory: 11.7M
        CPU: 186ms
     CGroup: /system.slice/gatus.service
             └─38792 /nix/store/...
  1. Access the Gatus dashboard by opening a web browser and navigating to http://localhost:8080 on the machine where you installed Gatus.

That's it! You have successfully installed Gatus on nixOS Latest. You can now use it to monitor your microservices, APIs, and websites.