Healthchecks is a monitoring tool based on Python that checks if your software services are running properly, provides alerts if services fail, and records the availability metrics of your services. In this tutorial, we will guide you through how to install Healthchecks on NixOS Latest.
Before installing Healthchecks on NixOS Latest, make sure you have the following:
Healthchecks requires a database for storing monitoring data. In this tutorial, we will use PostgreSQL.
sudo nix-env -iA nixos.postgresql
sudo systemctl start postgresql
sudo systemctl enable postgresql
mkdir ~/healthchecks
cd ~/healthchecks
sudo pip3 install healthchecks
sudo mkdir /etc/healthchecks
sudo touch /etc/healthchecks/default.cfg
DATABASE_URL='postgres://healthchecks:**your-postgres-password**@localhost/healthchecks'
SITE_ROOT='http://your-domain-name'
Replace your-postgres-password with your own password and your-domain-name with your domain name or subdomain name. Save the file and close it.
sudo -u postgres psql
CREATE DATABASE healthchecks;
CREATE USER healthchecks WITH PASSWORD '**your-healthchecks-password**';
GRANT ALL PRIVILEGES ON DATABASE healthchecks TO healthchecks;
Replace your-healthchecks-password with your own password. Exit PostgreSQL:
\q
hcdb migrate
hc start
You should see the message "PONG".
sudo touch /etc/systemd/system/healthchecks.service
[Unit]
Description=Healthchecks
After=syslog.target
[Service]
User=root
Group=root
WorkingDirectory=/root/healthchecks
ExecStart=/usr/local/bin/hc runserver
Restart=always
[Install]
WantedBy=multi-user.target
Save the file and close it.
Reload systemd:
sudo systemctl daemon-reload
sudo systemctl enable healthchecks.service
You have successfully installed Healthchecks on NixOS Latest. You can now configure Healthchecks to monitor your software services and receive alerts when services fail.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!