From 1b200dc009ba580ab3fbecbe3fb6366a3bbb666f Mon Sep 17 00:00:00 2001 From: Chewbaccalakis Date: Tue, 22 Sep 2026 22:17:01 +0000 Subject: [PATCH] added dozzle hub and agents --- butane/ai.yaml.tftpl | 19 ++++++++++++ butane/monitor.yaml | 53 ++++++++++++++++++++++++++++++++ butane/oswald_runner.yaml.tftpl | 19 ++++++++++++ butane/oswl_connector.yaml.tftpl | 19 ++++++++++++ terraform.tfvars | 14 +++++++++ 5 files changed, 124 insertions(+) create mode 100644 butane/monitor.yaml diff --git a/butane/ai.yaml.tftpl b/butane/ai.yaml.tftpl index 77ad6af..7d0161a 100644 --- a/butane/ai.yaml.tftpl +++ b/butane/ai.yaml.tftpl @@ -45,3 +45,22 @@ systemd: RestartSec=5s [Install] WantedBy=multi-user.target + - name: dozzle-agent.service + enabled: true + contents: | + [Unit] + Description=Dozzle Agent + After=docker.service + Requires=docker.service + [Service] + TimeoutStartSec=0 + ExecStartPre=-/usr/bin/docker rm --force dozzle-agent + ExecStart=/usr/bin/docker run --name dozzle-agent \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -p 7007:7007 \ + amir20/dozzle:v11.1.1 agent + ExecStop=/usr/bin/docker stop dozzle-agent + Restart=always + RestartSec=5s + [Install] + WantedBy=multi-user.target diff --git a/butane/monitor.yaml b/butane/monitor.yaml new file mode 100644 index 0000000..623215b --- /dev/null +++ b/butane/monitor.yaml @@ -0,0 +1,53 @@ +variant: flatcar +version: 1.0.0 + +# Dozzle log viewer hub. +# +# Aggregates container logs from the dozzle agents running on the other Flatcar +# VMs (see butane/oswl_connector.yaml.tftpl) and, via the local socket, from +# this host's own containers. Reachable at http://192.168.7.63:8080. +# +# No state is kept on disk: /data is a tmpfs, so the container is fully +# disposable and there is nothing to back up. That is also why simple auth +# (users.yml) is not used -- it would need a persistent /data. +# +# Hub <-> agent traffic is TLS, using the certificate pair baked into the +# dozzle image. Every hub and agent on the same image version shares it, so +# nothing needs mounting here. To move to a custom pair later, generate one +# with (do not run as root, writes into $PWD): +# +# docker run --rm -v "$PWD":/out amir20/dozzle:v11.1.1 generate-certs \ +# --cert-out /out/dozzle_cert.pem --key-out /out/dozzle_key.pem +# +# ...then mount it at /dozzle_cert.pem and /dozzle_key.pem (read-only) on the +# hub and on every agent. Keep the key out of this file: it would end up in +# plaintext in the rendered Ignition snippet on the node's storage. + +systemd: + units: + - name: dozzle.service + enabled: true + contents: | + [Unit] + Description=Dozzle log viewer hub + After=docker.service + Requires=docker.service + [Service] + TimeoutStartSec=0 + # Pulled up front so a slow first pull is not mistaken for a hung unit. + ExecStartPre=/usr/bin/docker pull amir20/dozzle:v11.1.1 + # Leading "-" so a missing container is not a failure. + ExecStartPre=-/usr/bin/docker rm --force dozzle + # Foreground (no -d) so systemd supervises the container process. + ExecStart=/usr/bin/docker run --rm --name dozzle \ + -v /var/run/docker.sock:/var/run/docker.sock:ro \ + --tmpfs /data \ + -p 8080:8080 \ + -e "DOZZLE_HOSTNAME=Oswald Logs" \ + -e "DOZZLE_REMOTE_AGENT=192.168.7.60:7007|oswald-runner|Infra,192.168.7.61:7007|ai|Infra,192.168.7.62:7007|oswl-connector|Infra" \ + amir20/dozzle:v11.1.1 + ExecStop=/usr/bin/docker stop dozzle + Restart=always + RestartSec=5s + [Install] + WantedBy=multi-user.target diff --git a/butane/oswald_runner.yaml.tftpl b/butane/oswald_runner.yaml.tftpl index 53eba13..0b36918 100644 --- a/butane/oswald_runner.yaml.tftpl +++ b/butane/oswald_runner.yaml.tftpl @@ -42,6 +42,25 @@ systemd: RestartSec=5s [Install] WantedBy=multi-user.target + - name: dozzle-agent.service + enabled: true + contents: | + [Unit] + Description=Dozzle Agent + After=docker.service + Requires=docker.service + [Service] + TimeoutStartSec=0 + ExecStartPre=-/usr/bin/docker rm --force dozzle-agent + ExecStart=/usr/bin/docker run --name dozzle-agent \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -p 7007:7007 \ + amir20/dozzle:v11.1.1 agent + ExecStop=/usr/bin/docker stop dozzle-agent + Restart=always + RestartSec=5s + [Install] + WantedBy=multi-user.target storage: directories: diff --git a/butane/oswl_connector.yaml.tftpl b/butane/oswl_connector.yaml.tftpl index 480101e..ab9026e 100644 --- a/butane/oswl_connector.yaml.tftpl +++ b/butane/oswl_connector.yaml.tftpl @@ -46,6 +46,25 @@ systemd: RestartSec=5s [Install] WantedBy=multi-user.target + - name: dozzle-agent.service + enabled: true + contents: | + [Unit] + Description=Dozzle Agent + After=docker.service + Requires=docker.service + [Service] + TimeoutStartSec=0 + ExecStartPre=-/usr/bin/docker rm --force dozzle-agent + ExecStart=/usr/bin/docker run --name dozzle-agent \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -p 7007:7007 \ + amir20/dozzle:v11.1.1 agent + ExecStop=/usr/bin/docker stop dozzle-agent + Restart=always + RestartSec=5s + [Install] + WantedBy=multi-user.target storage: files: diff --git a/terraform.tfvars b/terraform.tfvars index 686ed9c..d58f2d7 100644 --- a/terraform.tfvars +++ b/terraform.tfvars @@ -237,6 +237,20 @@ nodes = { qemu_guest_agent = false butane_file = "butane/oswl_connector.yaml.tftpl" } + # Dozzle log viewer hub. Pulls container logs from the dozzle agents on + # the other Flatcar VMs (port 7007) plus its own local docker socket. + # Keeps no state on disk, so it is safe to rebuild at any time. + "monitor" = { + hostname = "monitor" + vmid = 213 + ip = "192.168.7.63" + vlan = 7 + memory = 2048 + cores = 2 + disk_size = 32 + qemu_guest_agent = false + butane_file = "butane/monitor.yaml" + } } machines = { "grist" = {