Skip to content

Set up the host (Debian)

FlyingMonit runs on Debian 13 on arm64 or amd64 too, beside OpenBSD: one tarball per release and architecture (flyingmonit-<version>_debian-13_<arch>.tar.gz, <arch> as dpkg --print-architecture prints it), with its own Erlang runtime, set up by one script, updated by itself without downtime -- systemd runs it, nginx is the proxy, certbot the certificate.

Requirements

  • Debian 13 on arm64 or amd64 (amd64 from 0.2.0), up to date (apt-get update && apt-get upgrade).
  • nginx in front (apt-get install nginx): FlyingMonit itself listens on the loopback only (127.0.0.1:8090) and speaks plain HTTP.
  • A host name for FlyingMonit, its DNS pointing at the server, for the certificate.
  • It runs beside other services: the setup changes nothing of theirs, nginx's other sites included.

1. Check the download

As on OpenBSD (Verify the download), with Debian's name of the tool:

apt-get install signify-openbsd
signify-openbsd -C -p flyingmonit.pub -x SHA256.sig flyingmonit-<version>_debian-13_<arch>.tar.gz

2. Set up the host

As root, unpack the tarball and run the setup with the host name and the registry the releases come from:

mkdir /tmp/fm && tar -xzf flyingmonit-<version>_debian-13_<arch>.tar.gz -C /tmp/fm
/tmp/fm/debian/setup.sh flyingmonit.example.com https://gitlab.pallach.de/api/v4/projects/138/packages/generic/flyingmonit

It does only what is not done yet, so it can run again; existing settings are kept:

  1. The system user flyingmonit, and /var/lib/flyingmonit/ with releases/, backups/, db/ and tmp/.
  2. /etc/flyingmonit.env: the server's settings (Settings), with a new random SECRET_KEY_BASE.
  3. /etc/flyingmonit-update.conf: the registry.
  4. The packages the update needs: curl, signify-openbsd, procps.
  5. The service flyingmonit@.service (one instance per slot, a and b), the update (flyingmonit-update, its service and its timer, every minute) and the release key; slot a and the timer enabled. The timer makes the first install within a minute -- or now, by hand: /usr/local/sbin/flyingmonit-update.

It prints what is left, which follows.

3. nginx

FlyingMonit's site, in /etc/nginx/sites-available/flyingmonit and linked into sites-enabled/ -- on port 80 first, certbot adds TLS:

upstream flyingmonit { include /var/lib/flyingmonit/nginx-upstream.conf; }
map $http_upgrade $connection_upgrade { default upgrade; '' close; }
server {
    listen 80; listen [::]:80;
    server_name flyingmonit.example.com;
    client_max_body_size 2m;
    location / {
        proxy_pass http://flyingmonit;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $remote_addr;
    }
}
ln -s /etc/nginx/sites-available/flyingmonit /etc/nginx/sites-enabled/
nginx -t && systemctl reload nginx
  • The upstream is a file the update rewrites: it names the running slot, and an update switches nginx to the other one with a graceful reload -- FlyingMonit is not down.
  • The WebSocket (Upgrade): the pages talk to the server over one; without it they load, but no form works.
  • client_max_body_size 2m: the agents' reports are up to 2 MB, nginx's default is 1 MB.
  • X-Forwarded-For $remote_addr: the client's address, which FlyingMonit counts failed logins by and /ip answers.

4. The certificate

From Let's Encrypt, with certbot -- it writes TLS into the server block, redirects HTTP to HTTPS, and Debian's certbot.timer renews it:

apt-get install certbot python3-certbot-nginx
certbot --nginx -d flyingmonit.example.com --redirect

Check it: curl -s https://flyingmonit.example.com/ip answers your address.

5. The first admin

Its password printed once:

runuser -u flyingmonit -- sh -c 'cd /var/lib/flyingmonit && set -a && . /etc/flyingmonit.env && set +a &&
  /var/lib/flyingmonit/current/bin/flying_monit eval "FlyingMonit.Release.create_user(\"admin\", \"admin\")"'

Log in at https://flyingmonit.example.com/ and change the password on the profile page. Then point your Monit agents at it.