Full Width [alt+shift+f] Shortcuts [alt+shift+k]
Sign Up [alt+shift+s] Log In [alt+shift+l]
26

How I did the layout for my self-published book

from Jonas Hietala [alt+shift+b] in technology

This is a rundown of how I typeset and laid out my self-published book for the web version, the EPUB version, and the printed version. I was planning to include many more details, but the project took a lot longer than planned so I’ve forgotten some things. Web page I started by creating the book in a web format. It’s a static site generator that simply outputs HTML with some custom CSS styling to make it look pretty. I wrote a separate post on how I wrote a book with Pollen, check it out if you want more details. As I’ve become more proficient with CSS, I would’ve used Flexbox and Grid instead of floats and other hacks. Still, I’m quite pleased with how it looks even though I’d rather not look at the implementation. I’m absolutely no CSS or design wizard, I just spent quite some time tweaking until I ended up with something decent (I guess design is simple, but not easy). EPUB The initial plan was to use Pollen to generate both the web and eBook version from the same source. This is supported in Pollen by branching in the output functions, for example this emphasis function from the tutorial: (define (emph . elements) (case (current-poly-target) [(txt) `("**" ,@elements "**")] [else (txexpr 'strong empty elements)])) Unfortunately, I didn’t do this from the beginning and I wanted to create an EPUB after the book, and all the functions, had already been made. I could of course go back and modify them all, but it was much faster to just branch the repo and modify the webpage until it produced a valid EPUB. Hardly ideal, but it actually wasn’t as bad as it may sound. Check out the epub3 branch on GitHub for the complete source for the EPUB. Creating an EPUB There are many EPUB generators out there, but those I tried didn’t produce very pretty books (in many cases the results were quite bad). But an EPUB is merely XHTML with some extra files, so it’s fairly straightforward to create one by hand. There is an EPUB 3 specification one can reference, but...
17th Feb 2024

Stay updated

Get a weekly newsletter with the top 5 articles worth reading every week.

More from Jonas Hietala

Super ultrawide Niri

A Niri workspace with 7 visible columns. After having used practically the same xmonad configuration for a decade and a half I’ve now modernized my setup with the scrollable-tiling Wayland compositor Niri. It’s been a bit of a struggle to unlearn my old workflow but I’m really growing to love Niri’s scrollable workflow, especially on my new super ultrawide display. Samsung Odyssey Neo G9 G95NC 57” My new 57” single monitor setup. What kicked off my Niri journey was the purchase of a new super ultrawide monitor. I bought the 57” Odyssey Neo G9 as it was the largest monitor I could find. (It’s marketed as a “gaming” display but it’s really an amazing productivity display.) It replaced my old 3-monitor setup: My old 3-monitor setup. The new display is wider so I had to move the speakers around 10–15cm further apart. I was debating whether to replace the center 31.5” monitor or replace all monitors with a single one but I think I made the right choice with the ultrawide. The curvature wasn’t an issue (I’ve come to prefer it) and the extra vertical space the portrait side monitors provided wasn’t as crucial as I thought. I think an ultrawide is worth it just to get rid of the annoying bezels. Small things can be a big thing sometimes. A more dynamic workflow xmonad and Niri are similar yet different. Both automatically lay out windows as you spawn them but xmonad (at least the way I used it) follows a layout algorithm that re-flows using a “master” window and combines the rest of the windows into one space, while Niri lays out windows in columns. The change is subtle but it implies that a new window won’t change the size of other windows. This is very nice if you spawn a lot of short-lived terminals or web browsers like I do and it reduces the amount of manual reshuffling I spend time on. My xmonad workflow was more static than my Niri one. In xmonad I made heavy use of workspaces, mapping ten workspaces mentally to different programs, such as 0 Firefox and 1 terminal logs on the left monitor; 3, 4 and 5 for different Neovim instances on the center monitor; 8 as chat and 9 for music or video on the right monitor. I had no rules to enforce this; it’s an emergent behaviour that served me well for years. With Niri it’s more dynamic. I still use workspaces but they no longer have direct shortcuts, I simply go up/down in the workspace list. Maybe I’ll add them in the future but with 3–4 workspaces that’s not as necessary. I spawn workspaces/windows when I need them and remove them when I’m done. Usually it’s one workspace per project (yes, I’m now one of those who have multiple up at once) with all the related things such as editor, terminals, and browser with docs. I don’t typically utilize the full screen width and I try to keep the things I’m working on in the center, often leaving 10–30% gaps on the sides. Even though I don’t normally use the “endless scrolling” feature of Niri I re-center selected windows all the time so I can look straight ahead as much as possible. Keyboard shortcuts As a fan of keyboard layouts of course I have to spend some time tinkering with good keyboard shortcuts (especially as Niri’s recommended keybinds don’t map well with my custom keyboard or custom layout). Navigation layer What I did was add a new navigation layer that’s enabled by holding Tab (ring + middle + index on the left-hand side) with all Niri related movement and layout keybinds. In the graphics above, all green-colored keys emit Gui (which gates all window manager commands) and you can see: Long press on Close Window to close a window. The long press requirement prevents accidentally closing windows. Arrows move through columns/windows. Long press resizes them. Workspace Up/Down focuses a different workspace. Center a column. Consume/Expel to combine windows into one column. (consume-or-expel-window-left/consume-or-expel-window-right) Expand Column makes a column take up all remaining space. (expand-column-to-available-width) Audio controls. To press them I release the index finger (keeping the ring and middle finger pressed to keep the layer active) and use the index to press the audio buttons. Mouse buttons. In Niri you can move floating windows with Gui + Left Mouse and Gui + Right Mouse to resize them. As my main mouse is a trackball integrated into the keyboard I had to add them to the left-hand side. I ended up using QMK’s customizable key repress feature that allows me to: Tab combo with my three fingers (layer is active) Release only the index (layer is still active, same as with the audio controls) Press the index again (now detects the press Gui + Left Mouse key down) Use the trackball to move the window And similarly for the right mouse button to resize with the middle finger. Works great! Because there are so many commands I want to send I placed Ctrl on the thumb that provides movement-related commands like so: For example: Arrows move columns/windows in the four directions. Move columns to the neighboring workspaces. Center visible columns. (center-visible-columns) Slightly different consume/expel semantics. (consume-window-into-column/expel-window-from-column) Regular keymaps These are triggered in the “normal” way by first pressing the Super combo and then another key on the base layer (I use autoshift so I shift with a long press). Window management Super + F toggle windowed fullscreen (keep column width) Super + Shift + F fullscreen window (over the entire display) Super + M maximize column (moves other columns) Run stuff Super + Enter terminal Super + E Noctalia’s launcher (also exists on the navigation layer as Launch) Super + S show Noctalia control center Super + Shift + S show Noctalia settings Super + Q power off monitors (they wake on input) Super + Shift + Q show Noctalia session menu (reboot etc) Super + Shift + L lock screen Misc Super + H show hotkey overlay Super + P interactive screenshot Super + Shift + P screenshot selected window Tweaks to the standard CachyOS setup In the process of moving from xmonad to Niri I also moved from Void Linux to CachyOS and I let the installer install Niri and give me a basic configuration together with Noctalia (that provides a statusbar, notifications, and a bunch of things you apparently need). Center the status bar and other Noctalia windows My centered Noctalia status bar. Feels absolutely required on this screen otherwise things end up in the corners. Firefox on XWayland Force Firefox onto XWayland as the Wayland popup manager is broken: environment { MOZ_ENABLE_WAYLAND "0" } Dead keys for Ghostty For some reason dead keys were broken in Ghostty. This is bad for me as the OS keyboard is set to Swedish and it uses them to type ~ (quite a crucial character for a programmer). The fix: environment { GTK_IM_MODULE "ibus" QT_IM_MODULE "ibus" XMODIFIERS "@im=ibus" } This needs ibus installed and running. Melange colorscheme Noctalia discovers custom color schemes under ~/.config/noctalia/colorschemes/<Name>/<Name>.json, so I dropped in my trusty Melange colorscheme there: { "dark": { "mPrimary": "#EBC06D", "mOnPrimary": "#292522", "mSecondary": "#A3A9CE", "mOnSecondary": "#292522", "mTertiary": "#85B695", "mOnTertiary": "#292522", "mError": "#D47766", "mOnError": "#292522", "mSurface": "#292522", "mOnSurface": "#ECE1D7", "mSurfaceVariant": "#34302C", "mOnSurfaceVariant": "#C1A78E", "mOutline": "#867462", "mShadow": "#1a1816", "mHover": "#E49B5D", "mOnHover": "#292522", "terminal": { "normal": { "black": "#867462", "red": "#D47766", "green": "#85B695", "yellow": "#EBC06D", "blue": "#A3A9CE", "magenta": "#CF9BC2", "cyan": "#89B3B6", "white": "#ECE1D7" }, "bright": { "black": "#34302C", "red": "#BD8183", "green": "#78997A", "yellow": "#E49B5D", "blue": "#7F91B2", "magenta": "#B380B0", "cyan": "#7B9695", "white": "#C1A78E" }, "foreground": "#ECE1D7", "background": "#292522", "selectionFg": "#C1A78E", "selectionBg": "#403A36", "cursorText": "#292522", "cursor": "#EBC06D" } } } Then pick the colorscheme: "colorSchemes": { "darkMode": true, "predefinedScheme": "Melange", "useWallpaperColors": false } Layout appearance The default appearance was pretty I admit but way too much blank space and weirdness. Some tweaks: layout { // Required for noctalia-shell to set wallpaper background-color "transparent" // Never auto-center focused columns (too much movement) center-focused-column "never" // But do center a single window always-center-single-column // No extra space around it all struts {} // No gaps between windows gaps 0 // The focus ring was annoying focus-ring { off } // Use a border with consistent width for all windows instead border { on width 2 active-color "#ebc06d" inactive-color "#403a36" } // Setting widths is important with such a large screen preset-column-widths { proportion 0.15 proportion 0.3 proportion 0.4 } default-column-width { proportion 0.15; } // Heights too, why not? preset-window-heights { proportion 0.15 proportion 0.5 proportion 1.0 } } // Prevent the mouse from opening the overview in the corners gestures { hot-corners { off } } Keep windows centered Niri has the always-center-single-column option, which is nice as I want to keep as much as possible in the center of the monitor when I’m working. But I very frequently use 2–3 smaller windows and with my frequent opening and closing I’d like them centered too. Luckily, Niri has an IPC you can use to make a small program that reacts to events and does this for you. I made a small rust project using the niri-ipc crate that does this for me: The autocenter implementation [dependencies] niri-ipc = "26.4.0" use std::collections::HashMap; use std::io; use niri_ipc::socket::Socket; use niri_ipc::{Action, Event, Request, Response, Window, Workspace}; #[derive(Clone, Copy, PartialEq, Eq, Hash)] struct WindowId(u64); #[derive(Clone, Copy, PartialEq, Eq)] struct WorkspaceId(u64); struct OutputName<'a>(&'a str); struct WindowState { workspace: Option<WorkspaceId>, width: f64, } fn main() -> io::Result<()> { let mut socket = Socket::connect()?; if !matches!(socket.send(Request::EventStream)?, Ok(Response::Handled)) { eprintln!("niri rejected event stream"); std::process::exit(1); } let mut known: HashMap<WindowId, WindowState> = HashMap::new(); let mut read_event = socket.read_events(); loop { let result = match read_event()? { // A full snapshot of the current state. Just refresh our state. Event::WindowsChanged { windows } => { known = windows .into_iter() .map(|w| { ( WindowId(w.id), WindowState { workspace: w.workspace_id.map(WorkspaceId), width: w.layout.tile_size.0, }, ) }) .collect(); Ok(()) } Event::WindowOpenedOrChanged { window } => { let workspace = window.workspace_id.map(WorkspaceId); let entry = WindowState { workspace, width: window.layout.tile_size.0, }; let prev = known.insert(WindowId(window.id), entry); match prev { // Don't center floats. _ if window.is_floating => Ok(()), // New window, try to re-center. None => maybe_center_new(&window), // Window changed workspace, try to re-center. Some(state) if state.workspace != workspace => center_focused_if_fits(), // Skip other things. Some(_) => Ok(()), } } Event::WindowClosed { id } => { if known.remove(&WindowId(id)).is_some() { center_focused_if_fits() } else { Ok(()) } } Event::WindowLayoutsChanged { changes } => { // Only re-center if the width was changed, otherwise our re-center will // loop back indefinitely. let mut resized = false; for (id, layout) in changes { if let Some(state) = known.get_mut(&WindowId(id)) { if (state.width - layout.tile_size.0).abs() > 0.5 { state.width = layout.tile_size.0; resized = true; } } } if resized { center_focused_if_fits() } else { Ok(()) } } _ => Ok(()), }; if let Err(e) = result { eprintln!("autocenter: {e}"); } } } /// Center a newly created window if the workspace is focused and if there's surrounding free space left. fn maybe_center_new(window: &Window) -> io::Result<()> { let Some(workspace_id) = window.workspace_id.map(WorkspaceId) else { return Ok(()); }; let Some(focused) = focused_workspace()? else { return Ok(()); }; if WorkspaceId(focused.id) == workspace_id { center_if_fits(&focused)?; } Ok(()) } /// Center windows in the focused workspace if there's surrounding free space left. fn center_focused_if_fits() -> io::Result<()> { if let Some(focused) = focused_workspace()? { center_if_fits(&focused)?; } Ok(()) } /// Center windows in the workspace if there's surrounding free space left. fn center_if_fits(workspace: &Workspace) -> io::Result<()> { let Some(output) = workspace.output.as_deref().map(OutputName) else { return Ok(()); }; let Some(width) = output_width(output)? else { return Ok(()); }; if workspace_width(WorkspaceId(workspace.id))? < f64::from(width) { center_visible_columns()?; } Ok(()) } /// Issue a one-shot query to Niri, wait, and return the response. fn query(request: Request) -> io::Result<Response> { match Socket::connect()?.send(request)? { Ok(response) => Ok(response), Err(msg) => Err(io::Error::other(msg)), } } /// Get the focused workspace. fn focused_workspace() -> io::Result<Option<Workspace>> { match query(Request::Workspaces)? { Response::Workspaces(ws) => Ok(ws.into_iter().find(|w| w.is_focused)), _ => Ok(None), } } /// Get the width of an output (monitor). fn output_width(name: OutputName<'_>) -> io::Result<Option<u32>> { match query(Request::Outputs)? { Response::Outputs(outputs) => Ok(outputs .get(name.0) .and_then(|o| o.logical.as_ref()) .map(|l| l.width)), _ => Ok(None), } } /// Calculates the width of all columns in the workspace. fn workspace_width(workspace_id: WorkspaceId) -> io::Result<f64> { let Response::Windows(windows) = query(Request::Windows)? else { return Ok(0.0); }; let mut columns: HashMap<usize, f64> = HashMap::new(); for w in windows { if w.workspace_id.map(WorkspaceId) != Some(workspace_id) { continue; } if let Some((col, _)) = w.layout.pos_in_scrolling_layout { let width = columns.entry(col).or_insert(0.0); *width = width.max(w.layout.tile_size.0); } } Ok(columns.values().sum()) } /// Send a command to center the visible columns. fn center_visible_columns() -> io::Result<()> { if let Err(msg) = Socket::connect()?.send(Request::Action(Action::CenterVisibleColumns {}))? { eprintln!("center-visible-columns rejected: {msg}"); } Ok(()) } One catch is that if a new window overflows the monitor width, the script won’t center the columns even if there would be free space left afterwards. This is a little weird but it’s consistent with Niri’s center-visible-columns command. I had a small itch to try to hack around it but in the end I left it alone… Is Niri worth it? Yes, absolutely. Niri has been a huge upgrade for me in combination with a single wide screen. My xmonad setup worked really well with three monitors—arguably a better fit in that context than Niri—but for the big-screen use-case Niri is superior. I’m curious how it holds up on my laptop, once I gather enough energy to install CachyOS on it… But that’s a side quest. The big-screen setup I spend most of my days in is the best I’ve ever had, and I have no desire to go back.

11th Sep 2026 • 3 votes
Domains, certificates, and DNS

Accessing services via raw IP addresses isn’t that swell; I’m no Rain Man. It’s time to set up subdomains for my hietala.xyz domain for internal use. We’ll use the Gateway API to set up routes, cert-manager to give us https without self-signed browser warnings, and ExternalDNS to set up DNS overrides. HTTP routing I believe the flow of resolving http://argocd.hietala.xyz to a service looks something like this: digraph { rankdir=LR "Browser" -> "OPNsense DNS" [label="resolve host"] "OPNsense DNS" -> "Browser" [label="Gateway IP"] "Browser" -> "Cilium Gateway" [label="HTTP request" class="label-below"] "Cilium Gateway" -> "HTTPRoute" [label="match hostname" class="label-below"] "HTTPRoute" -> "Service" [label="backendRef" class="label-below"] "Service" -> "Pod" [label="EndpointSlice" class="label-below"] } First the browser asks my router running OPNsense about argocd.hietala.xyz and gets the Gateway IP address. The request then flows through a route (http or https), to a Service, and eventually a Pod where ArgoCD is running. We’ll handle these one at a time but let’s start by creating the Gateway and giving it an IP (we’ll use 10.1.4.101): apiVersion: gateway.networking.k8s.io/v1 kind: Gateway metadata: name: main namespace: kube-system annotations: io.cilium/lb-ipam-ips: "10.1.4.101" spec: gatewayClassName: cilium We installed the prerequisites for Gateway when we configured Cilium during our initial cluster bootstrap. Then we need to tell the Gateway to manage all http routes for all namespaces (we’ll get back to https): # Continued from the above Gateway manifest spec: gatewayClassName: cilium listeners: - name: http port: 80 protocol: HTTP allowedRoutes: namespaces: from: All Then we can add an HTTPRoute for our ArgoCD application that targets argocd-server at port 80: # Below the ArgoCD Application setup # Resources in the same file are separated by `---` --- apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: name: argocd namespace: argocd spec: parentRefs: - name: main namespace: kube-system sectionName: http hostnames: - argocd.hietala.xyz rules: - backendRefs: - name: argocd-server port: 80 If we then add a DNS override from http://argocd.hietala.xyz to 10.1.4.101 (/etc/hosts or OPNsense or similar) then we should be able to reach http://argocd.hietala.xyz. Enabling SSL I want https://argocd.hietala.xyz to “just work” and for that we need to tell Gateway to manage https routes: # ... spec: gatewayClassName: cilium listeners: - name: https port: 443 protocol: HTTPS tls: mode: Terminate certificateRefs: - name: hietala-xyz-tls allowedRoutes: namespaces: from: All - name: http # Http definition from before (Note the tls addition that terminates using a not-yet-defined certificate.) And add the https route itself: apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: name: argocd namespace: argocd spec: parentRefs: - name: main namespace: kube-system sectionName: https hostnames: - argocd.hietala.xyz rules: - backendRefs: - name: argocd-server port: 80 This doesn’t work just yet as we need to create the hietala-xyz-tls cert. Cert-manager cert-manager seems like the standard way to manage certificates for Kubernetes. I don’t want to expose my services to the internet which means I need a DNS01 challenge. cert-manager doesn’t natively support Namecheap (bummer) but there’s an open source webhook Namecheap provider out there. It hasn’t been updated in a couple of years but I couldn’t find an alternative… YOLO I guess? The cert-manager manifest: apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: cert-manager namespace: argocd annotations: argocd.argoproj.io/sync-wave: "-1" finalizers: - resources-finalizer.argocd.argoproj.io spec: project: default source: repoURL: https://charts.jetstack.io chart: cert-manager targetRevision: v1.21.0 helm: values: | installCRDs: true destination: server: https://kubernetes.default.svc namespace: cert-manager syncPolicy: syncOptions: - CreateNamespace=true automated: prune: true selfHeal: true Note the installCRDs: true that makes things easier for us, and CreateNamespace=true which will create the cert-manager namespace for us too. Saves some typing. We also set sync-wave to -1 as it needs to sync before the cluster issuer and certificate that we’ll define later. Then the namecheap webhook: apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: cert-manager-webhook-namecheap namespace: argocd annotations: argocd.argoproj.io/sync-wave: "-1" finalizers: - resources-finalizer.argocd.argoproj.io spec: project: default source: repoURL: https://github.com/kelvie/cert-manager-webhook-namecheap.git targetRevision: HEAD path: deploy/cert-manager-webhook-namecheap helm: # Identifier that our issuer will use values: | groupName: acme.namecheap.com destination: server: https://kubernetes.default.svc namespace: cert-manager syncPolicy: syncOptions: - CreateNamespace=false automated: prune: true selfHeal: true Then a ClusterIssuer that uses the namecheap webhook: apiVersion: cert-manager.io/v1 kind: ClusterIssuer metadata: name: letsencrypt-staging annotations: # Must come after the cert-manager applications. # It defaults to 0 anyway but this is more explicit. argocd.argoproj.io/sync-wave: "0" # If resources doesn't exist ArgoCD may complain. argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true spec: acme: # Use the staging endpoint during testing! server: https://acme-staging-v02.api.letsencrypt.org/directory email: [email protected] privateKeySecretRef: name: letsencrypt-staging solvers: - dns01: # Use the namecheap webhook webhook: # Same identifier the webhook defined above. groupName: acme.namecheap.com solverName: namecheap config: # These are very sensitive! # Store them in a Sealed Secret apiKeySecretRef: name: namecheap-credentials key: apiKey apiUserSecretRef: name: namecheap-credentials key: apiUser Make sure to use the staging issuer during testing to avoid rate limits. When you’re done playing around you can switch to the production server at https://acme-v02.api.letsencrypt.org/directory. I created a new ClusterIssuer called letsencrypt-prod instead of replacing the url so I can easily change between them if I need to. Create the sealed secret: kubectl create secret generic namecheap-credentials \ --namespace cert-manager \ --from-literal=apiKey="key" \ --from-literal=apiUser="user" \ --dry-run=client -o yaml \ | kubeseal --cert infrastructure/sealed-secrets-cert.pem \ --format yaml \ > gitops/apps/cert-manager/namecheap-secret.yaml Finally we need to create the hietala-xyz-tls certificate that uses the issuer: apiVersion: cert-manager.io/v1 kind: Certificate metadata: name: hietala-xyz # Must match the namespace of the Gateway namespace: kube-system annotations: # References the issuer so must be synced after. argocd.argoproj.io/sync-wave: "2" argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true spec: # Gateway references this certificate using this name. secretName: hietala-xyz-tls dnsNames: - "*.hietala.xyz" - "hietala.xyz" issuerRef: # Switch to `letsencrypt-prod` later. name: letsencrypt-staging kind: ClusterIssuer When all this has been synced we should be able to see that the certificate is created: $ kubectl get certificate -n kube-system NAME READY SECRET AGE hietala-xyz True hietala-xyz-tls 4d20h And that we can visit https://argocd.hietala.xyz (browser will warn while we use letsencrypt-staging, on prod it should be without errors). (If not, then you have a bunch of debugging to do. Have fun!) Want to redirect http to https? Add this route: apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: name: argocd-redirect namespace: argocd spec: parentRefs: - name: main namespace: kube-system sectionName: http hostnames: - argocd.hietala.xyz rules: - filters: - type: RequestRedirect requestRedirect: scheme: https statusCode: 301 In general though I skip the http route as I tell Firefox to always use https. ArgoCD is still accessible via its external IP I defined in a previous post but you can also port-forward or proxy to it: # http://localhost:8001/api/v1/namespaces/argocd/services/argocd-server:80/proxy/ kubectl proxy # localhost:8123 kubectl port-forward svc/argocd-server -n argocd 8123:80 Automating DNS overrides By now most of the things are set up in proper GitOps fashion but there’s still one thing I have to do manually: I have to add a DNS override to unbound (it’s on my OPNsense router). Doing it once is fine but it gets old fast. Some of my overrides in unbound. Can you see a pattern? A wildcard domain could work but I have other services running outside of Kubernetes, so I’d like a cleaner solution. That solution is ExternalDNS, which automatically adds overrides for any existing Gateway HTTPRoute. There’s a webhook provider for OPNsense that we’ll use. The manifest: apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: external-dns namespace: argocd finalizers: - resources-finalizer.argocd.argoproj.io spec: project: default sources: - repoURL: https://kubernetes-sigs.github.io/external-dns/ chart: external-dns targetRevision: 1.21.1 helm: valueFiles: - $values/gitops/apps/external-dns/values.yaml - repoURL: https://git.hietala.xyz/tree/home-ops.git targetRevision: HEAD ref: values destination: server: https://kubernetes.default.svc namespace: external-dns syncPolicy: syncOptions: - CreateNamespace=true automated: prune: true selfHeal: true It loads values.yaml from the repo: provider: name: webhook webhook: image: repository: ghcr.io/crutonjohn/external-dns-opnsense-webhook tag: v1.0.0 env: - name: OPNSENSE_HOST value: "https://router.hietala.xyz" # Remember to create the `external-dns` sealed secret. - name: OPNSENSE_API_KEY valueFrom: secretKeyRef: name: external-dns key: api-key - name: OPNSENSE_API_SECRET valueFrom: secretKeyRef: name: external-dns key: api-secret sources: - gateway-httproute policy: sync domainFilters: - hietala.xyz txtOwnerId: talos-dorne This connects to OPNsense, sources routes from the Gateway, targets the hietala.xyz domain, and uses a new external-dns secret: kubectl create secret generic external-dns \ --namespace external-dns \ --from-literal=api-key="key" \ --from-literal=api-secret="secret" \ --dry-run=client -o yaml \ | kubeseal --cert infrastructure/sealed-secrets-cert.pem \ --format yaml \ > gitops/apps/external-dns/external-dns-secret.yaml With this I don’t have to add manual overrides anymore. Nothing like spending hours to automate a few minutes of work! If you want to extend support to other network things, say a Minecraft server talking TCP over 25565 with a fixed IP, we can add service support to ExternalDNS: sources: - gateway-httproute - service And declare the Minecraft Service like so: apiVersion: v1 kind: Service metadata: name: minecraft annotations: external-dns.alpha.kubernetes.io/hostname: mc.hietala.xyz spec: type: ClusterIP externalIPs: - 10.1.4.53 selector: app: minecraft ports: - port: 25565 targetPort: 25565 protocol: TCP name: minecraft Many steps but the end is nice There’s a few moving parts but once done supporting new apps is satisfyingly easy. For example, to expose the homeassistant service under https://ha.hietala.xyz this is enough: apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: name: homeassistant spec: parentRefs: - name: main namespace: kube-system sectionName: https hostnames: - ha.hietala.xyz rules: - backendRefs: - name: homeassistant port: 8123 Commit and push, and https://ha.hietala.xyz is ready in a jiffy, certificates and DNS overrides included. I encountered a bug in ArgoCD v3.3.5 where it’ll get stuck syncing the routes with extra lines in the diff (or mark them as out of sync), for example here: - backendRefs: - name: my-app port: 80 group: "" kind: Service weight: 1 matches: - path: type: PathPrefix value: / You can add the lines to each route to fix it but you can also tell ArgoCD to ignore them with these lines in the Application template: apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet spec: template: spec: ignoreDifferences: - group: gateway.networking.k8s.io kind: HTTPRoute jqPathExpressions: - .spec.parentRefs[].group - .spec.parentRefs[].kind - .spec.rules[].backendRefs[].group - .spec.rules[].backendRefs[].kind - .spec.rules[].backendRefs[].weight - .spec.rules[].matches syncPolicy: syncOptions: - ServerSideApply=true - RespectIgnoreDifferences=true

6th Aug 2026 • 1 votes
GitOps with ArgoCD

Now we’re getting to the fun stuff: GitOps. The act of pushing beautifully crafted .yaml files and seeing your Kubernetes cluster get red and stall out is surely what life’s all about. Install ArgoCD We have our Kubernetes cluster and now we’re going to bootstrap ArgoCD so it starts syncing from our git repository. Using helm: helm install argocd \ --repo https://argoproj.github.io/argo-helm \ argo-cd \ --namespace argocd \ --create-namespace \ --version 10.1.4 ArgoCD will by default generate an admin password and you can get it with the argocd tool: # You can use the password to login to the web. argocd admin initial-password -n argocd # Make ArgoCD available at localhost:8123 kubectl port-forward -n argocd svc/argocd-server 8123:80 You can use the argocd CLI to manage ArgoCD but I’m going to prefer the declarative way. Fixed IP You can use the port forward method above to access ArgoCD but having a fixed IP is nicer, especially if you want to use the argocd CLI (I only used it when trying to get it all working). I use a separate service for the IP, which allows me to assign an IP outside of the Cilium load balance pool we setup previously (10.1.4.101–10.1.4.255). It looks like this: apiVersion: v1 kind: Service metadata: name: argocd-server-ip namespace: argocd spec: type: ClusterIP externalIPs: - 10.1.4.51 selector: app.kubernetes.io/name: argocd-server ports: - name: http port: 80 targetPort: 8080 It simply routes 10.1.4.51:80 to the IP of argocd-server and port 8080. We need to apply it: kubectl apply -f gitops/bootstrap/argocd.yaml And you should see it assigned and able to visit it on the web: $ kubectl get svc -n argocd argocd-server-ip NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE argocd-server-ip ClusterIP 10.105.209.116 10.1.4.51 80/TCP 3d18h Repository I use a self-hosted Forgejo instance (hosted in a Proxmox LXC) but you can use whatever you want. You need an API token with read permissions. ArgoCD documents a declarative setup that we’ll use. For repositories we need to create a secret: kubectl create secret generic home-ops-repo \ --namespace argocd \ --from-literal=type=git \ --from-literal=url=<repo-url> \ --from-literal=username=<username> \ --from-literal=password=<token> \ --dry-run=client -o yaml \ | kubeseal --cert infrastructure/sealed-secrets-cert.pem -o yaml \ > gitops/bootstrap/argocd-repo-secret.yaml We also need to add the repository label to the generated file so it looks something like this: apiVersion: bitnami.com/v1alpha1 kind: SealedSecret metadata: name: home-ops-repo namespace: argocd spec: encryptedData: password: ... type: ... url: ... username: ... template: metadata: name: home-ops-repo namespace: argocd labels: argocd.argoproj.io/secret-type: repository Apply it: kubectl apply -f gitops/bootstrap/argocd-repo-secret.yaml And the repo should show up in the UI or argocd repo list. Initial admin password Instead of letting ArgoCD generate a random password we can set the initial password explicitly. It’s possible to do it either via the Helm chart or the declarative way, which I’ll continue with. After generating it with kubeseal the secret should look like this: apiVersion: bitnami.com/v1alpha1 kind: SealedSecret metadata: name: argocd-secret namespace: argocd spec: encryptedData: admin.password: ... admin.passwordMtime: ... server.secretkey: ... template: metadata: labels: app.kubernetes.io/name: argocd-secret app.kubernetes.io/part-of: argocd name: argocd-secret namespace: argocd With three keys: password is a bcrypt hash: argocd account bcrypt --password 'supersecret' passwordMtime is the plaintext modification time: date -u +"%Y-%m-%dT%H:%M:%SZ" secretkey is a random value: openssl rand -base64 48 ArgoCD uses server.secretkey to sign session and API tokens, and it will regenerate the key if restarted. I kept getting logged out when I was rebuilding things all over the place and it was annoying so I added this to make it stable. A file structure ArgoCD is now installed but at this point I think it’s good to take a step back before we steam ahead. One of the benefits of ArgoCD is that you can create any kind of file structure and organize the repository any way you want. That’s also one of its problems: if you can do anything it’s hard to decide on a plan forward. I found the blog post How to Structure Your Argo CD Repositories Using Application Sets illuminating and even though their setup is overkill for my homelab, I simplified their ideas into something that works for me. The basic idea is to have all applications in their own folders under gitops/apps, and place all bootstrap stuff under gitops/bootstrap. Borrowing the “level” terminology from the above post here’s the basic idea: digraph { rankdir=TB "root.yaml" [class="loader"] "appset.yaml" [class="loader"] bootstrap_more [label="…"] apps_more [label="…"] "root.yaml" -> "cilium_config.yaml" "root.yaml" -> "argocd.yaml" "root.yaml" -> "appset.yaml" "root.yaml" -> bootstrap_more "appset.yaml" -> "authentik" "appset.yaml" -> "actualbudget" "appset.yaml" -> "miniflux" "appset.yaml" -> "homeassistant" "appset.yaml" -> apps_more // Keep the "…" boxes on the far right of each level. { rank=same; "cilium_config.yaml" -> "argocd.yaml" -> "appset.yaml" -> bootstrap_more [style=invis] } { rank=same; "authentik" -> "actualbudget" -> "miniflux" -> "homeassistant" -> apps_more [style=invis] } } Which loads in three phases: root.yaml Everything under bootstrap/ gets loaded bootstrap/appset.yaml in turn loads all folders under apps/ This is what the directory structure looks like: gitops ├── root.yaml # Level 1 ├── bootstrap # Level 2 │ ├── cilium_config.yaml │ ├── argocd.yaml │ ├── appset.yaml │ └── ... └── apps # Level 3 ├── authentik │ └── ... ├── miniflux │ └── ... └── ... I’m considering separating infrastructure and user workloads, but for now I’m fine with having everything in the apps/ folder. App-of-apps root.yaml will be a master “app-of-apps” as it will be an Application that spawns other applications. It looks like this: apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: all-apps namespace: argocd annotations: argocd.argoproj.io/sync-wave: "-100" finalizers: - resources-finalizer.argocd.argoproj.io spec: project: default source: repoURL: https://git.hietala.xyz/tree/home-ops.git targetRevision: master path: gitops/bootstrap destination: server: https://kubernetes.default.svc namespace: argocd syncPolicy: syncOptions: - CreateNamespace=true automated: prune: true selfHeal: true (You’re going to see lots of yaml files like this, better get used to it.) The important bits are The name all-apps in the argocd namespace It should be synced before everyone else (sync-wave: -100) Should load everything under gitops/bootstrap from my home-ops repo I’ll be using pruning and self-healing to tell ArgoCD to keep everything in sync. With selfHeal: true ArgoCD will revert any manual kubectl changes to a managed resource. This is the “proper GitOps” way as you must go through git but in practice it might be annoying. If you turn it off the ArgoCD will track the difference but won’t fight you. This is the entrypoint and it’s the last manual apply command we’ll use, as it’ll load everything else: kubectl apply -f gitops/root.yaml Application sets Inside the bootstrap/ folder lives, among other things, bootstrap/appset.yaml which is responsible for turning subfolders under apps/ into applications and loading them. This is what I use and it’s an adaption of the code from the aforementioned blog post: apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: appset namespace: argocd spec: # Use Go's engine so we can use basename/path goTemplate: true # The engine silently fails on missing keys by default goTemplateOptions: ["missingkey=error"] # Generate from all subfolders from my repo under apps/ generators: - git: repoURL: https://git.hietala.xyz/tree/home-ops.git revision: master directories: - path: gitops/apps/* template: # The Application name will be folder + "-app" # Creative, I know. metadata: name: "{{.path.basename}}-app" spec: project: default # Describes the manifests of the application, # which is everything under apps/<app-folder>/ source: repoURL: https://git.hietala.xyz/tree/home-ops.git targetRevision: master path: "{{.path.path}}" # Give the application its own namespace destination: server: https://kubernetes.default.svc namespace: "{{.path.basename}}" syncPolicy: syncOptions: - CreateNamespace=true # Needed for larger manifests - ServerSideApply=true # ArgoCD does a dry run to check for resource kinds # it doesn't yet recognize. This breaks some things # so turn it off. - SkipDryRunOnMissingResource=true automated: prune: true selfHeal: true I hope the comments make it clear how the above works. The end result is that everything under apps/ will be loaded and organized under its own application. Other bootstrap things Manifests under bootstrap/ Even though we manually apply some manifests during the bootstrap sequence, they can still be managed by ArgoCD after the fact. This is solved by simply placing the relevant files in bootstrap/, and they’ll be managed going forward. These are what we’ve collected so far: Cilium We installed Cilium using a helm install command. Here’s a (hopefully) corresponding example of a manifest that ArgoCD can manage: apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: cilium namespace: argocd annotations: argocd.argoproj.io/sync-wave: "-1" finalizers: - resources-finalizer.argocd.argoproj.io spec: project: default source: repoURL: https://helm.cilium.io chart: cilium targetRevision: 1.19.2 helm: values: | kubeProxyReplacement: true k8sServiceHost: 10.1.4.10 k8sServicePort: 6443 l2announcements: enabled: true externalIPs: enabled: true gatewayAPI: enabled: true ipam: mode: kubernetes operator: replicas: 1 securityContext: privileged: true destination: server: https://kubernetes.default.svc namespace: kube-system syncPolicy: syncOptions: - CreateNamespace=false - ServerSideApply=true automated: prune: true selfHeal: true The duplication here is unfortunate but I couldn’t find a way around it. At least we can reuse cilium_config.yaml with the load balancer IP specifications that we created during cluster setup. Just plop it under bootstrap/ and we can move on. Gateway API Before installing Cilium we also applied the Gateway CRDs using this command: kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.2.1/standard-install.yaml This is the corresponding YAML manifest (smaller as we don’t pass dozens of options): apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: gateway-api namespace: argocd annotations: argocd.argoproj.io/sync-wave: "-2" finalizers: - resources-finalizer.argocd.argoproj.io spec: project: default source: repoURL: https://github.com/kubernetes-sigs/gateway-api.git targetRevision: v1.2.1 path: config/crd/standard destination: server: https://kubernetes.default.svc namespace: kube-system syncPolicy: automated: prune: true selfHeal: true Note that I specify sync-wave -2 for the Gateway and -1 for Cilium because the Gateway should sync before Cilium. Sealed Secrets We continue in the same manner of converting Helm installations to manifests: apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: sealed-secrets namespace: argocd annotations: argocd.argoproj.io/sync-wave: "-1" finalizers: - resources-finalizer.argocd.argoproj.io spec: project: default source: repoURL: https://bitnami-labs.github.io/sealed-secrets chart: sealed-secrets targetRevision: 2.16.2 helm: values: | fullnameOverride: sealed-secrets-controller destination: server: https://kubernetes.default.svc namespace: sealed-secrets syncPolicy: syncOptions: - CreateNamespace=true automated: prune: true selfHeal: true ArgoCD In addition to the secrets used for the declarative setup (repository, admin password) ArgoCD can also manage itself: apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: argocd namespace: argocd finalizers: - resources-finalizer.argocd.argoproj.io spec: project: default source: repoURL: https://argoproj.github.io/argo-helm chart: argo-cd targetRevision: 10.1.4 helm: values: | configs: secret: createSecret: false destination: server: https://kubernetes.default.svc namespace: argocd syncPolicy: syncOptions: - CreateNamespace=false automated: prune: true selfHeal: true --- # Static IP as shown previously, `---` separates different kinds Updated bootstrap sequence This is the updated bootstrap recipe that I manage with Just: [doc("Bootstrap everything from zero")] full: just bootstrap::cluster just bootstrap::cilium just secrets::restore_sealed_secrets_private_key just bootstrap::sealed_secrets just bootstrap::argocd [doc("Bootstrap ArgoCD")] [working-directory('../gitops')] argocd: helm install argocd \ --repo https://argoproj.github.io/argo-helm \ argo-cd \ --namespace argocd \ --create-namespace \ --version 10.1.4 \ --set configs.secret.createSecret=false # We don't let ArgoCD generate the secret, we supply one: kubectl apply -f bootstrap/argocd-secret.yaml # Needed to be able to sync from repo. kubectl apply -f bootstrap/argocd-repo-secret.yaml # Wait for ArgoCD to deploy. kubectl rollout status deployment/argocd-server -n argocd --timeout=300s # Technically not needed as it'll get loaded on sync, this just speeds it up a little. kubectl apply -f bootstrap/argocd.yaml --force-conflicts --server-side # Sync everything else from the repo. kubectl apply -f root.yaml Renovate A pull request generated by the Renovate bot (upping its own dependency). To complete our GitOps setup and to exercise our newfound capabilities let’s setup the Renovate service. Its purpose is to monitor git repositories and to create pull requests where it updates dependencies, see the above image for how it’s created a PR to update itself. The singularity is here any second now. To get Renovate setup we need to create three things: The secret Renovate will pick up RENOVATE_TOKEN in secrets, generated like so: kubectl create secret generic renovate-token -n renovate \ --from-literal=RENOVATE_TOKEN='<token>' \ --dry-run=client -o yaml \ | kubeseal --cert infrastructure/sealed-secrets-cert.pem -o yaml \ > gitops/apps/renovate/renovate-secret.yaml We’ll later add the name renovate-token to the main manifest. The configuration file Renovate has a bunch of configurations you can add. I’m good with the defaults except to modify the ArgoCD settings to support the custom directory structure I’m using: { "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": ["config:recommended"], "argocd": { "managerFilePatterns": ["/gitops/(apps|bootstrap)/.+\\.yaml$/"] }, "kubernetes": { "managerFilePatterns": ["/gitops/(apps|bootstrap)/.+\\.yaml$/"] } } This activates the argocd and kubernetes managers, where argocd watches ArgoCD specific manifests (Application/ApplicationSet) and kubernetes watches plain manifests (such as container images in Deployment). The manifest The Application manifest is similar to the ones we’ve seen before: apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: renovate namespace: argocd finalizers: - resources-finalizer.argocd.argoproj.io spec: project: default source: repoURL: https://docs.renovatebot.com/helm-charts chart: renovate targetRevision: 46.236.3 helm: values: | existingSecret: renovate-token cronjob: schedule: "0 1 * * *" renovate: config: | { "platform": "forgejo", "endpoint": "https://git.hietala.xyz", "repositories": ["tree/home-ops"], "gitAuthor": "Renovate Bot <[email protected]>", "automerge": false } destination: server: https://kubernetes.default.svc namespace: renovate syncPolicy: syncOptions: - CreateNamespace=true automated: prune: true selfHeal: true Note that we configure the secret (renovate-token), how often it should run, and the repository information. Commit and push and it should be ready to go. ArgoCD has a really good UI where you can see what’s happening, if you made a mistake somewhere, and also trigger the cron job manually. Or you can use kubectl, for example: # See the health status of all applications kubectl get applications -A # Trigger the cron job kubectl create job -n renovate --from=cronjob/renovate renovate-manual # Watch the logs kubectl logs -n renovate -l job-name=renovate-manual -f With this we’ve got our first example of managing a Kubernetes service via ArgoCD. We’ll continue to see more examples of this as the series continues.

23rd Jul 2026 • 1 votes
Designing a personal Pebble watchface

I recently got a Pebble Time 2 as it seemed like a fun smartwatch away from Google/Apple/Samsung with a good 4 weeks of battery life. One thing I wanted to do is to create a custom watchface for my specific problems. It took more effort to design the watch than I had anticipated and there’s a deceptively large amount of thought that has gone into some of the features here, so I thought it’d be interesting to write a little about it. I don’t get 30 days of battery life with the watch; in practice it’s closer to ~2 weeks, with heart rate monitoring disabled. Issues I want the watch to help me with It’s difficult to describe what I’ve been going through the last ~6 months. It started with a normal depression (yeah, a “normal depression” says a lot already) but it was followed by what felt like a big increase in volume; manageable issues I’ve had forever were suddenly overpowering. I’ve always found it difficult to start chores and boring tasks, yet now it felt like trying to swim through quicksand. At the same time I had huge problems with hyper focus. I could start working on something and the entire day would just disappear; I would sit in front of the computer for 8 hours without any break, interrupted by having to go get my kids from school and I realize that my bladder is exploding and I hadn’t eaten lunch yet. Then I would spend the rest of the day thinking about it, even having difficulty falling asleep because I’m still thinking about it. Needless to say, my time management has gone out the window, even missing appointments for the first time ever. Of course, a watchface won’t solve any of these but I’m desperate and nothing I’m trying is helping. Concretely I’d like the watch to help me with these things: I was going to name the watchface “ADHD hero” but that was a little on the nose as I don’t have an ADHD diagnosis (yet… The investigation is under way but it’s not a quick process). It’s common for people to claim they have ADHD, like the cool kids. The issues I’m having are quite severe and it’s not something “cool to have”. A watchface only for me I like open source but I don’t have any plans of publishing the watchface. The entire point of the watchface is to remove friction in my life, not create another source of anxiety. This way I’m free to change it, rewrite it, pollute it with vibes, and I can focus on making it just good enough for me without having to worry about others. I encourage you to steal anything you like and create your own watchface; it’s straightforward with Pebble. Prototyping with Claude I’m a big believer in being able to quickly iterate through different prototypes. I’ve had success with using Claude to generate HTML prototypes and it can spit out images like this: Design-wise it’s hit-and-miss and Claude seems to lack creativity and taste (but sometimes it comes up with great ideas). You need to guide it properly and I’ve gotten good usage from telling it to generate dozens of variations of a concept and iterating from there. All images in this post are generated in this way at various points of the development. It can also quickly generate interactive prototypes, like this embedded widget that simulates (almost) the entire watchface and its features: A simulation of the watchface, generated by Claude. This is super useful and I’ve used it to fine tune the wedge geometry, color scheme, a chiptune library, and more. These are rough prototypes and they serve to give a direction, not to be a perfect representation of the end result. The interactive widget above for example has a bunch of rendering artifacts that don’t exist in the real watchface. Finding a style The design of the watchface started before I had the watch and before I wrote a line of code. Initially the feel was very different; it was a cleaner, more uniform, design without as much clutter and everything followed a consistent design language. I just knew that it was perfect. The original watchface. Tracking tasks. When the watch arrived I built it and it sucked. It was so boring… I saw the Comic Drop watchface and its comic book panel layout is really interesting. Wouldn’t it be cool to have a similar comic book panel layout that would show the events during the day? Maybe they could be dynamic and move around during the day? A comic book panel subdivision. It would be really neat to have some pixel graphics of a computer during the morning when I should work, a picture of a barbell when I should exercise, etc. Unfortunately that’s beyond my skill level at the moment so I had to give up that idea. So I went back to the original design but iterated on a “comic book” style with thicker lines, brighter colors, and more irregularities: The new comic book style, with elements I’ll discuss later. This is a more interesting watchface and it looks much better on the wrist than the first iteration. Not perfect of course but it catches my interest, which is the point. Calendar overview I want to be able to glance at the watch to see my calendar. Watchfaces such as the Sectograph add event information inside the clock (so an event between 1 and 2 would colorize the section of the analog clock) and I wanted something similar. Here are some prototypes to give you an idea of what I’m talking about: Single event in the day. Four events the next 6 hours. Fully loaded day. This should hopefully make it easier for me to be able to plan my day a little better. Pebble already has built-in notifications for events that work well. This is purely for me to visualize the day. A notable omission in my design is the lack of a text description of the event. That’s nice but it also clutters the design I’m going for. The important thing for me isn’t what the event is, it’s “is there an event at all”. Non-uniformity My brain is very good at filtering away static and uninteresting information. For example, I’ve tried to have Calendar, Habitica, and Todoist widgets on my phone to help me keep track of my events/habits/tasks… But it didn’t take long for my brain to start completely ignoring them despite them taking up 80% of the screen. When I say ignore I mean that literally: I completely stopped noticing them. So what I wanted to try was to spice it up a little by randomizing the event geometry. See these two examples: Uniform events. Non-uniform events. To me the non-uniform prototype is more visually interesting and the changing geometry should hopefully prevent me from filtering them out. The goal is to give a general overview of the day, not to display a precise calendar. I tried to have each event size correspond to the event length but I abandoned that for more randomization. To make generation simpler (and to save on battery) I snap events into 15-minute intervals. I’m not sure yet if this is a good call but so far it’s fine. You can argue that the rounder uniform version would look better on the Pebble Round 2, which is fair. Here’s a similar mockup but with the round’s geometry: Uniform events on the Round 2. Non-uniform events on the Round 2. I still think the non-uniform variant catches the eye more and solves my specific problem a bit better but there’s no denying that a round layout on a round watch fits very well. Moving towards 12 o’clock Another idea I had was instead of statically fixing events to their times I wanted the events to move towards “now” at 12 o’clock. So an event that renders at 3 o’clock is 3 hours away and an event that overlaps 12 is ongoing. While this prevents me from easily looking back at my day (past events disappear) it makes it easier to feel the urgency as events draw closer. A bit weird perhaps but in practice it feels great. Here’s the same event through its lifecycle: drifting in from 3 o’clock, ongoing as it crosses 12 (with the countdown band draining in the clock), then gone once it’s in the past. Something like this: Event is a few hours away. Event is ongoing. Event is in the past and has disappeared. Completion countdown This works pretty well but there’s a problem: how to differentiate between an event that will start in one minute and that has been going on for a while? Because the event gets cut off at 12 there’s no way to tell at a glance. At first I tried to enlarge the event wedge so it touches the clock if it’s ongoing. That was a bit weird so instead I tried to colorize the clock outline with the event that’s ongoing. Then I realized, why not have the outline count down the remaining time of the event, similar to a Time Timer? The countdown band draining as the event completes. In practice this works out wonderfully well. I had dozens of prototypes for line weights, fill direction, the clock itself, etc but I won’t bore you with them. I tell myself that real design should appear to be effortless. Work timer I quite like the completion countdown for calendar events. This kind of design is often associated with tracking tasks (such as in Pomodoro) so why not add it to the watch too? For example, I might want to configure a stretch of 60 min work / 15 min break / 60 min work before I should stop working. Pretty standard stuff. As I’m struggling to get started I’ll add a twist: a working block should have a 5-minute warm-up period. So the timeline looks like this: warmupwork break warmupwork 60 min 15 min 60 min I chose to include the 5 minute warm-up into the work length, so they’re both 60 minutes long instead of 65 minutes. I think it makes sense to have that one count down (from filled to empty) while the working block counts up (from empty to filled), like so: Task 5-min warm-up followed by two 1 hour rounds, with a 15-min break between. Starting/stopping timers on a Pebble watchface This is a post about design, not about implementation, but I still need to address how we can implement a work timer toggle. The issue is that a Pebble watchface is a background process that cannot interact with Pebble’s physical buttons. You can bind the buttons to quick launch Pebble apps but not watchfaces. A watchface can detect steps and taps on the watch but it cannot communicate with other apps. There’s a few ways to get around this: Toggle using taps only. Implement it as a Pebble app, not a watchface. Add a new Pebble app (tied to a button) that round trips commands via the companion app back to the watchface. digraph { rankdir=TB button [label="Quick launch\nbutton"] app [label="Pebble app"] phone [label="Companion app\non phone" class="external"] face [label="Watchface"] button -> app [label="press"] app -> phone [label="toggle"] phone -> face [label="toggle"] { rank=same; app; face } app -> face [style=invis] } I first tried to implement toggling using taps but it was too unreliable. If I went the app route I’d have to relaunch it all the time, which represents unacceptable friction. What’s left is the janky phone round trip solution. I already need a companion app for the calendar sync but it still makes me queasy. Crap like this is why I don’t feel like publishing the watch. *shudder* Clearing alarms and forcing breaks I’ve tried alarms, Pomodoro, and similar before but they all share the same failure mode: I simply ignore the alarm and continue with what I was doing. A Pomodoro can’t be interrupted; it marks 25 minutes of pure work. Francesco Cirillo, The Pomodoro Technique I don’t know, it could be 2 minutes just as likely as 200 minutes. So I figured I’ll try to force myself to take breaks by making it annoying to clear (a bit like the Hand Grenade Alarm clock but in wrist form). The watchface can vibrate, play sound, react to steps, and detect taps and this is the flow I came up with: The alarm transforms the screen and vibrates and plays a tune until it’s dismissed (repeats every 30 seconds). I had to silence it during calendar events to not mess up meetings too much. Visually the required steps are drawn at the border (no events are shown during an alarm) and the alarm is drawn as a comic-style blast (tapping it shrinks the blast). Like this: Dismissing the end of day alarm. How well does it actually work? It’s a pretty cool setup and it is helping but it still fails quite often. Most of the time I forget to start the work timer and other times I’m able to add enough steps by waving my hand around like a crazy person, and then continue working. (If I raise the step count then it gets annoying to dismiss when I’m actually walking.) Could be tuned better I suppose. Other types of alarms Time for a break Stop working End of day Manual alarm Visually there are some distinct alarms I use: I’ve separated them visually and they each use unique vibrations and tunes. An implementation detail: Pebble doesn’t natively render text at an angle. I worked around it by rendering the text at an angle to a bitmap, and drawing that. Other information I’ve previously used watchfaces overloaded with all kinds of information and graphs that were cool for a few minutes and then I never looked at them again. But there are some things I regularly glance at such as the date or if the watch has lost its phone connection. Date and week number Here are some prototypes for dates that I liked but ultimately discarded: The difficulty is to not crowd the watchface too much with the date and the other elements I’ll get to later. In the end I ended up with a simple 31/10 label and a small weekly text without background as I don’t look at the week number that often: The date label together with the weekly number floating freely. I’m not completely sold on the week number display (yellow labels were a lot more fun) but it’s good enough I guess. Step counter It was really difficult for me to find a step counter design I liked. Everything I tried just felt off. Here are three of my attempts: Steps are tracked at the edges. A health bar of some sort. Steps in a separate column. I used to track steps at the edges for most of the design (you can see the step elements in many of the prototype images in this post) but in the end it introduced a bit too much clutter for my taste. While the other two attempts above are crude and could be polished more I didn’t see potential in them. (Examining and cutting away branches is important during design I think.) And then the revelation: I don’t care about the exact step count. The only purpose of showing steps is to help me keep the step count up, so I’m not sitting in front of the computer all day, and having badges for tiers solves that problem even better. Here are the badges I use: Bronze Silver Gold Diamond Bronze is achieved at 33% of my daily goal, silver at 66%, gold at 100%, and diamond is for over-achieving with 150%. I feel that having an easy to reach tier helps me do something on the lazy days and the hard-to-reach tier helps give me an extra kick the days I’m out and about. Yes, not knowing exactly how much is left to the next tier is slightly annoying, but for those cases opening up the Health app on the watch to view the step count is good enough. Battery states High after the rush of figuring out how to display steps let’s use the same approach for battery warnings: Ok, above 15% Low, below 15% Critical, under 5% Yes, I probably should make the little battery interactive or something but this is a 80:20 situation: I get 80% of the benefit from 20% of the effort. It’s good enough. Bluetooth & Sleep / DND More badges! Bluetooth disconnected. Phone in DND or Pebble in Quiet Time. Pebble has a “Quiet Time” mode that silences notifications. This is a separate thing from Android’s sleep mode or do-not-disturb mode. As I have a companion app I can detect the Android state and the watchface combines the two (and silences task alarms for instance) while also showing a “sleep” bubble so I can see these invisible states. The next task I’m a big fan of some of the ideas of Getting Things Done such as the idea of the “next task”: the one actionable thing that you should do next. I’ve used the Todoist Android widget on my phone to display my tasks but I wanted to incorporate it into my watch too. The idea is to only display the next task, something like this: While I think all three prototypes above are visually pleasing I went with the wider display that takes up less vertical space: The next task displayed at the bottom. As a bonus I don’t have to mess around with rendering angled text. Completing/rescheduling the task It works fairly well but there’s a wrinkle: when I’ve done the task or realize I can’t do it now I have to pull up my phone and that’s annoying so in practice I’m leaving a stale task alone forever, priming my brain to ignore it. I’ve tried the Todoist Mini app on the Pebble but there’s so many clicks to find the task and complete or reschedule it. What I did was add it to the app I’m already using to toggle the work timer and give it a menu of options: Completing the next task via the watch. I can still toggle the work timer, complete the next task, or reschedule the task (it’s rescheduled for tomorrow). I’ve bound it to the UP button via “quick launch”. To keep toggling the work timer as simple as possible pressing UP again toggles the timer (so double clicking UP when the watchface is visible toggles the timer). Otherwise it uses the standard Pebble control scheme (UP/DOWN to select and SEL to execute) and the app closes and returns to the watch when an item is selected. So far it’s been working really well but as has always been the case before with these productivity “fixes”; I always tire of them eventually. There’s some companion app interactions I gloss over here (such as latency and if the phone isn’t reachable) but it’s fine, don’t worry about it. I did add a vibration + chime confirmation on the watch as a confirmation that the round trip was completed and it gives a small dopamine hit. Edge markers As a little extra I added some markers to track other types of things along the edges: Markers moving on the edge for alarms, calendar reminders, end of day, and sunrise/sunset. The colored dots for calendar events are genuinely useful as many events require some preparation/travel time. In these cases I add a reminder for the event at, say, 15 minutes before. With the dots this preparation time can now also be seen by glancing at the watch (Pebble natively shows reminder alerts anyway.) The end of day marker is also useful for when I’m planning my working day but sunrise / sunset is mostly a gimmick, and I don’t use the manual alarms . The end result When it’s clear. When it’s (very) busy. At the end I got an interesting watchface I think looks fun and that helps me go about my day. It’s pretty easy to make one, and if you don’t know where to begin LLMs can shorten the time to get up and running.

26th Jun 2026 • 1 votes
Planning my Kubernetes homelab

The Kubernetes iceberg. If I’d have to describe my homelab setup via analogy I guess it would be similar to me on a unicycle carrying plates with both of my hands, or maybe a leaking barrel with water that I try to patch up with silver tape. I’ve also been Kubernetes-curious so I decided to completely redesign my homelab, centered around Kubernetes. It was a bit painful but at least it fulfilled my need for procrastination very well. Overarching goals I’ve got three goals with the setup: Declarative, reproducible, and automated The big goal is to have everything declarative in a single git repository and to easily be able to bootstrap from nothing to a fully working setup. I want to use Infrastructure as Code to create the Kubernetes cluster and GitOps to populate it with all my services automatically from the repo. It should be really easy to make a change; I want to move away from having to ssh into the correct repo and manually do stuff. Backups, backups, backups While a proper GitOps setup means that infrastructure and configuration files are inherently backed up, a proper backup setup is still crucial. Ask me how I know. I haven’t had a proper (as in working) backup solution for years and this time I should have it from the start. Documentation What if I could document my setup, so future me has a chance to understand what’s happening? Writing documentation is boring, so I’ll write some blog posts instead. I’m a bit skeptical that I can fulfill all three goals, but if I manage 2/3 or even 1/3 it’s still a big win compared to my old setup. Kubernetes, too complicated? It’s a fair question and the most common critique towards Kubernetes is that’s just too complicated (especially for a homelab). Discussions online are filled with comments such as: Kubernetes has to be most complex software I’ve ever tried to learn. I eventually gave up and decided to stick with simple single machine docker-compose deployments. trinovantes “Let’s use Kubernetes!” Itamar Turner-Trauring So why would I choose Kubernetes? Because, for whatever reason, Kubernetes is very popular and for every comment complaining about complexity you have comments extolling it’s virtues: I was skeptical about Kubernetes but I now understand why it’s popular. The alternatives are all based on kludgy shell/Python scripts or proprietary cloud products. zelly Kubernetes is the biggest quality-of-life improvement I’ve experienced in my career anchochilis Having experienced the single machine docker-compose deployments, kludgy shell scripts, and proprietary cloud products; I think I need to use Kubernetes myself to be able to form an opinion on it. And in some ways, isn’t experimentation a core part homelabbing? Tech stack There are many valid tech choices for this kind of setup and many of them are reasonable. I don’t know if my choices are reasonable—most were chosen because they sounded cool, others because I just picked one. Here’s list of some of the choices I made, which we’ll setup in this series: Talos Linux for Kubernetes nodes. The coolest way to run Kubernetes. Lightweight and secure, what’s not to like? Terraform to provision VMs on Proxmox and to initialize Talos Linux. Cilium for proxying, CNI, load balancer, and Gateway API provider. I opted for Cilium as it’s one dependency replacing several alternatives (such as kube-proxy, Metallb, and Traefik, which I was leaning towards at first). Gateway API is the new thing you “should” use instead of ingress, and I wanted to try it out. ArgoCD for GitOps. If it was purely for myself FluxCD might have been the better, simpler, choice but we might use ArgoCD at work and I don’t want to deal with two separate systems at the moment. Renovate to keep dependencies up-to-date. CloudNativePG for Postgres on Kubernetes. I’ll also setup timescaledb, although we won’t use it in this series. It’s just to prepare for the future migration of long-term statistics from Home Assistant. Longhorn on NVMEs for persistent storage. Data is backed up using VolSync and Restic. Sanoid, Syncoid and Kopia for backup archive management. Backups are snapshotted and stored in ZFS, which are also encrypted and shipped off-site to Backblaze for storage in the cloud. Backups from Longhorn and Postgres arrives to ZFS via Garage, a self-hosted S3 service. Authentik as an identity provider and single-sign-on platform. It’s nice to not have to login manually everywhere. Huh. Displayed like this it looks like a lot, but fear not! It’ll be worth it in the end. In the next part we’ll start by creating VMs and getting a Kubernetes cluster up and running.

5th May 2026 • 1 votes

More in technology

Zenith Data Systems, Part II

Pioneering while struggling to survive

2 hours ago • 1 votes
mass destruction of weapons

There is a long history to chemical and biological warfare—one that, we at least hope, ended in 1993. The paucity of chemical and biological warfare today is a result of long-standing objections that culminated in the 1993 Chemical Weapons Convention. It is striking that this formal end to most chemical weapons programs came within a year of the last US test of a nuclear weapon: similar sentiments, and a similar 1990s "end of history" context, motivated both. The similarity makes the differences more striking. Nuclear weapons are still part of the pop culture today, the quintessential "weapon of mass destruction" and a symbol of the destructive potential of modern warfare. But what of that term? Why "weapons of mass destruction?" The history of the phrase WMD is complex, and while it does predate nuclear weapons our modern use emerged in response to them. Still, it's a broader category. In today's language, WMD refers to nuclear, biological, or chemical weapons. Some of its most prominent invocations, namely in the Iraq War, referred to chemical rather than nuclear warfare. Still, to most Americans, chemical weapons are out of sight and out of mind. There are a few reasons: chemical weapons have been more or less prohibited in warfare for over one hundred years, so we have little experience with or memory of them. In fact, today, in the United States, there are none. That was the modern chemical war: the safe management, recovery, and destruction of an enormous stockpile of chemical weapons. This effort spanned military reservations across the United States, dismantling and burning chemical and biological munitions as life went on as usual outside of the fence. Well, at least, "as usual" for the Cold War: one of the effects of the stockpile was to maintain a sort of localized Cold War climate in those towns that fell downwind of it. Today, with the discovery of a dangerously poorly managed stockpile of Lead Azide that will require an exceptionally risky emergency measure to destroy, we are all acutely aware of the direction that the wind blows. The upcoming plume of lead over Iowa is far from the first time that dangerous compounds have blown away from military custody. There have been dozens of such incidents, with varying degrees of intentionality and risk to the public. Many were, at the time, classified. Others were simply covered up. While not exactly the future we wanted, it is perhaps a sign of progress that the upcoming detonation has been announced at all. The public notifications seem, to me, to be the result of an attitude shift that happened at the tail end of the era of US chemical warfare. Windblown plume forecasting models, originally developed for the fallout of nuclear war, were reapplied to risk analysis of chemical weapon stockpiles. The news was bad, so bad that civilian towns were hardened against attack: not enemy attack, but an attack of bad luck, an accident upwind. But first, we should consider how we got there. There are accounts of chemical and biological warfare dating to antiquity, although as with most early history it can be hard to tell what was speculative and what was actually done. By the 18th century, there had certainly been multiple uses of poisons and noxious chemicals on the battlefield. Chemical weapons in particular took a revolutionary step forward with the development of a more formal science of chemistry, during the 19th century. Several important advancements in chemistry occurred in the pursuit of poisonous gases, and just about every other advance in chemistry was applied to them. Still, even in this early era, there was more of an appetite for the development of chemical weapons than for their actual use. A particularly memorable incident in this history comes from Lyon Playfair, the very same who popularized the "Playfair Cipher" that makes a standard appearance in cryptography classes. In his role as a key scientific official during the Crimean War of the mid-1850s, he proposed the use of shells that would disperse a very poisonous form of Cyanide. Objections to the plan came not from pacifist do-gooders but from the weapons-builders themselves, who considered the whole thing morally questionable. Playfair's words in response are almost haunting in consideration of what would follow, outcomes of which he was simultaneously prescient and shockingly short-sighted. War is destruction, and the more destructive it can be made with the least suffering the sooner will be ended that barbarous method of protecting national rights. No doubt in time chemistry will be used to lessen the suffering of combatants, and even of criminals condemned to death. One of the reasons for the lackluster popularity of chemical weapons is that this notion of "easing the suffering" of the enemy, even if accepted as something other than madness, never really materialized. Particularly in the 1990s, the ethics of capital punishment in the United States came to be seen as sort of a technical problem. Maybe homicide by the state wasn't so bad if it was "painless," or "quick," or at least clinical in its appearance. The same idea pervaded chemical warfare in the 19th century, and in the 20th century it fell short in the same way that lethal injection has now. Objection to chemical weapons generally preceded their use. The Hague Convention of 1899 prohibited the form of chemical weapon that was then most obvious, the gas shell. That this prohibition applied specifically to artillery shells is significant: one of the complexities of chemical warfare is its interaction with domestic use. Like hollow-point bullets, tear gas, for example, is widely used in many nations' interiors—but it has been prohibited in warfare for many decades. This situation was already apparent with the first large-scale use of chemical weapons, at the onset of the First World War. Tear gas, a broad category of irritants that are not generally fatal but induce painful and disabling effects, was first developed in France. Parisian police struggled with organized criminal groups who would barricade themselves into buildings and successfully repel attempts at arrest. A commission was formed to investigate the matter in 1912, and it recommended the adoption of ethyl bromoacetate. Delivered to a barricaded position, it caused uncontrollable tearing, difficulty breathing, and considerable pain—enough to drive gangsters out of cover. That development in policing might have been controversial in its own right, but it was quickly overshadowed by the outbreak of the Great War. Tear gas was adapted to hand grenades, directed against the Germans at Alsace in 1914. In practice, this early chemical attack proved ineffective, but it opened Pandora's box. The Germans developed their own irritant shells, both sides justifying their use by leaning on the term "asphyxiating gas" in the Hague convention. Tear gases are unpleasant, but they are not asphyxiating as the term is defined. It was a slippery slope, though, and once the gears of war were in motion they would not be stopped. German chemists improved both the chemical agents and the means of delivery, such that during 1915 a drifting cloud of Chlorine gas was used to scatter French soldiers holding a defensive line. As it happened, the reticence of the Germans to march into their own poisonous cloud meant that they gained little advantage, but it proved the concept. Once again, the legality of the measure was questioned, but this time, the Germans emphasized the Hague convention's specific use of the word "shells"—no artillery shells having been involved in this particular weapon. Faced with this new threat, both sides developed countermeasures, and faced with those countermeasures, both developed new weapons. By the end of 1915 Phosgene was in wide use, and in 1917, the Germans introduced Mustard Gas. Mustard is a terrifying weapon, causing severe blistering of any exposed skin and extensive bleeding. Mustard Gas was extensively used by both sides, becoming part of routine infantry strategy, and along the way dooming tens of thousands of soldiers to a torturous ordeal in the overwhelmed military hospitals. Ironically, despite the extreme response it induced, Mustard Has was not particularly fatal. Many of its victims survived, disfigured after a long period of extreme suffering. These were the stories that came to be associated with chemical warfare. Far from Playfair's vision of "the least suffering," Mustard Gas became one of the war's main sources of it. Mustard-exposed soldiers convalescing in rows, their skin covered in blisters, their eyes sealed closed... these were the images that defined chemical warfare for decades to follow. While some use of chemical weapons continued after the First World War, Mustard Gas inspired a level of outrage that hung over the 1925 Geneva Conference. The Hague convention's prohibition on shells with asphyxiating gas was narrow enough that Mustard Gas arguably did not apply, so negotiators at Geneva agreed to stronger language. The Geneva Protocol, entering into force in 1928, broadly prohibited the use of chemical or biological agents in warfare between states. That could have been the end of the story. The Geneva Protocol was not perfectly observed, but it did prevent almost all use of such weapons. Despite significant technological advances made in Germany, including the development of several nerve agents during the 1930s, World War II elapsed with only limited use of chemical or biological weapons in combat. Most chemical attacks were by the Japanese, perhaps less affected by the experience of the First World War, and even then were directed mostly against other combatants in Asia. On the European front, only a handful of chemical attacks took place. Here, we arrive at the strangest contradiction in the history of chemical weapons: the near end of the use of chemical weapons, the Geneva Protocol, came before the peak of their development and manufacturing. Despite the limited chemical attacks during WWII, chemical weapons programs became larger than ever before. One reason was the Geneva Protocol's differentiation between combat use by state actors and other uses. To say that the Nazis made little use of chemical weapons, while correct in a certain technical sense, becomes absurd in the face of the Holocaust. Domestic use of chemical weapons only escalated, a dichotomy that still resonates today. This potential for domestic use or use against non-state adversaries (such as putting down revolutionary movements) justified a decision by most WWI combatants to continue development and manufacturing of chemical weapons. That created an ongoing possibility of their use, despite prohibition, which itself justified even more development. Consider the case of Australia, a nation that did not have a domestic chemical weapons program but still built massive stockpiles of imported chemical munitions during WWII. Why? For defense, of course: Australia was relatively close to Japan, the main chemical combatant, and felt the need to have a credible retaliation capability if Japan did decide to initiate all-out chemical war. This kind of reasoning, foreshadowing the doctrine that would demand nuclear weapons programs to the modern day, echoed around the world. Australia was importing those weapons principally from the US and UK, two countries that committed not to use chemical weapons, indeed never used them, and nevertheless operated major research centers and manufacturing plants throughout the war. The Germans clearly had a chemical inventory, which they so saliently demonstrated against their own population, and what if they decided to cast the treaty aside? Ought we to remain defenseless? The fear was not unfounded; Germany was known to have violated the Geneva Protocol on several occasions and some historians take the view that their use of chemical weapons was limited by technical issues rather than a policy decision. Churchill favored a chemical "first strike," although the suggestion didn't get much traction. In the US, as well, a notional retaliation capability was grounds for extensive R&D on rocket-delivered chemical warheads. Ironically, most of the US casualties to chemical weapons were self-inflicted. During the war the military manufactured stockpiles of Mustard Gas, Hydrogen Cyanide, and Cyanogen Chloride. These compounds were packaged into weapons and, in at least some cases, staged at the front in preparation for use. This program was a closely held secret and little is known of it even today. One major detail could not escape discovery: a German air raid on US Navy ships in Italy, in 1943, struck a ship carrying Mustard Gas. The resulting leakage at least contributed to the deaths of 69 people, and sickened hundreds. Already, perhaps the most dangerous thing about chemical weapons was possessing them. Chemical warfare programs only accelerated after WWII. The newly developed German nerve agents, including Sarin1, made it to the US as spoils of war. The research programs that formed around these new agents are some of the most infamous of the period, including exposure of thousands of soldiers to small doses of poisons to observe the effects, a program that continued at Edgewood Arsenal in Maryland until the public became aware—and the program collapsed in scandal—in 1975. The involvement of LSD in these experiments often sees them lumped together with MKULTRA, but the vast majority of the research was on less exotic substances: VX, Sarin, Mustard Gas, Tear Gas. Edgewood was also the manufacturing center for Mustard and Phosgene. What Edgewood couldn't provide was storage; it didn't have room for the well-separated bunkers required for munitions. The Army built new installations for the stockpile: Redstone Arsenal in Alabama, Rocky Mountain Arsenal in Colorado, Pine Bluff Arsenal in Arkansas, and Tooele Ordnance Depot in Utah. At each of these sites, hundreds of acres of earth-covered concrete sheds stored weapons at a distance that wouldn't set off their neighbors. In the very early years of the Cold War, the US Army weaponized a new chemical agent called BZ. BZ gained notoriety because of its psychological effects, which included hallucinations, and because of various accusations that it was covertly used by the US during the 1960s. These allegations don't generally hold up, but they illustrate the atmosphere of paranoia that chemical weapons created, and in response to which more chemical weapons were developed. BZ was produced at Swannanoa, North Carolina, and assembled into weapons at Pine Bluff Arsenal, where binary (two parts that are mixed together) nerve agents were produced as well. Phosphate was manufactured at Muscle Shoals, Alabama, and VX at Newport, Indiana. The Aberdeen Proving Ground handled Mustard gas manufacturing and filling. The Rocky Mountain Arsenal, though, just outside of Denver, was the center of the post-war program: Sarin, Mustard, and Sulfur Mustard were all produced and stored there. The Vietnam War proved a pivotal conflict for chemical warfare, as with so many other aspects of military history. Defoliants, such as Agent Orange, were not considered to be chemical weapons and saw heavy use in Vietnam. While targeted at plants, they were not safe for humans either, and played a major role in creating a generation of disabled veterans. In the meantime, the accidental dangers became more apparent: in 1968, an accident at Dugway Proving Ground in Utah released the nerve gas VX and killed thousands of sheep. The Army denied involvement, and then later admitted involvement but denied fault, a position it maintained into the '90s. Despite attempts to maintain secrecy, the Dugway sheep incident brought public attention to the chemical weapons program—which had maintained such a low profile that many didn't realize it existed. Press investigations after Dugway revealed further problems: disposal practices that had released large quantities of chemical agents into the ocean, handling accidents in overseas military installations, and of course numerous human experiments that fell far short of the ethical standards of the time. In short, the Dugway incident reminded the public, and Congress, that the US Army Chemical Corps existed. It had thousands of soldiers, dozens of facilities, and maintained an inventory of chemical weapons that spanned a national network of ammunition igloos. Ongoing manufacturing operations in the 1960s included BZ cluster bombs, VX shells, Hydrogen Cyanide, and others. Once the press latched on to the program, though, it was the beginning of the end. In 1969, President Nixon announced a "no first use" policy for chemical weapons and the complete prohibition of biological weapons—a stronger policy than has been adopted for nuclear weapons even to this day. As part of the 1969 declaration, Nixon also ended the biological weapons program entirely. I have not spoken as much of biological weapons here, as the scale of the US effort was always smaller than that for chemical agents, but I shouldn't understate it. A half dozen viral and bacterial infections, including Anthrax and Botulism, were weaponized in research laboratories. In part because of moral and practical concerns in the military, most of these were never manufactured at scale and delivery systems (such as artillery shells or warheads) were rarely developed to maturity. When Nixon ordered the program ended, its small scale made it relatively straightforward to destroy stockpiled material. Much of the laboratory-scale work was retained, anyway, for its value in researching defensive measures. Chemical weapons were a different matter entirely, because of the scale of the stockpiles. Continuing expansion of the chemical weapons program saw new stockpiles at Umatilla, Oregon; Pueblo, Colorado; Hawthorne, Nevada; Anniston, Alabama; and Blue Grass, Kentucky. At the peak, the United States disclosed an inventory of 31,100 metric tons of nerve agents and Mustard, stored across a dozen sites. Nearly half was concentrated in Tooele, Utah. Due to the old age of many chemical munitions, there had already been efforts to dispose of aged-out stockpiles in the 1960s. This program took the crude form of missions like "Operation CHASE," or "Cut Holes and Sink 'Em," in which Liberty ships full of munitions were towed off of the coast of Florida and scuttled. Only some carried chemical weapons, but well-founded concerns over the environmental impacts of such a chemical assault on the ocean led to legislation prohibiting this means of disposal in 1972. Other smaller-scale disposal efforts had taken forms like loading Phosphorus into barrels, rolling them into a lake, and then shooting at them until they sank, but besides the generally crude nature of this approach there were only so many lakes that could be so used. Congress had intervened in other ways, as well. Starting in 1970, the Office of the Surgeon General was tasked with reviewing the way that chemical weapons were handled and destroyed. This responsibility shifted around several agencies, ultimately involving the Centers for Disease Control, and brought a level of visibility into chemical weapons management that forced the Department of Defense to take a far more systematic and cautious approach to the remaining stockpile. During the 1970s, the Army's Chemical Corps took on a new focus: safe handling and disposal. The most concerning—and contentious—part of the stockpile was weapons that had been "forward staged" in Europe and Asia. These were intended to allow a fast retaliation to any chemical attack on Europe, but by this point they had become unpopular with host nations like Germany and Japan. This set up the first wave of chemical demilitarization: a months-long Army/Navy effort moved the chemical inventory from Okinawa, thousands of tons of munitions with nerve agents and Mustard Gas, to Johnston Atoll. While better known for its role in the nuclear weapons program, Johnston also served as a base for satellite programs (both intelligence collection and anti-satellite weapons) and a test site for biological and chemical weapons. Starting in 1971, storage and destruction of chemical weapons was made the installation's main purpose. In reaction to the safety incidents of the late '60s, legislation passed in the early 1970s that prohibited transfer of most chemical weapons from overseas to the United States. Instead, over the following decades, nearly all US chemical weapons that had been stored outside of North America were consolidated to Johnston Atoll. The inventory there in the 1990s included even German-made chemical shells that had been captured by the Allies and stored in Germany for study. In 1972, an Army command was formally established to manage the destruction of chemical weapons. The first priority was made the M34 cluster bomb. Designed in the 1950s, the M34 was the first Cold War-era chemical weapon and already considered obsolete. M34s were among the weapons destroyed by ocean disposal during Operation CHASE, but that method had since been prohibited. The Army had to find another way to handle more than 20,000 M34 bombs still stored by Denver, and because of the location of the weapons that method would have to actually neutralize the agents. For the Sarin-laden M34s, a hole was carefully drilled to drain the Sarin from each of the "bomblets" that made up the cluster munition. That Sarin liquid was then mixed with a neutralizing caustic chemical in a sealed reaction chamber. The resulting salt brine was dried, and the precipitated solids (no longer a nerve agent but still an environmental toxin) were buried in nearly 20,000 steel drums. In the meantime, Rocky Mountain Arsenal burned tens of thousands of tons of Mustard gas projectiles in an on-site incinerator, and began chemical neutralization of outdated VX munitions that had been relocated to the site for storage. These early disposal operations at Rocky Mountain Arsenal took place in part because of its proximity to a major city, and a political factor that had made it the top priority for site closure. That was also a liability: disposal operations added to existing environmental contamination, exacerbating a groundwater plume that killed nearby crops and creating a new set of toxic landfills. The weapons that were destroyed there in the '60s and '70s were the easy cases, intact weapons with chemical agents that had known neutralization techniques or were easily incinerated. The Army realized that many other chemical weapons, including older weapons that were already in poor condition and beginning to leak, would require a more complex approach with greater risk of exposure. To develop these techniques, the Chemical Corps established the Chemical Agent Munitions Disposal System (CAMDS) at the Deseret Chemical Depot, a new purpose-built installation adjacent to the Tooele Army Depot on the south side of the Great Salt Lake. CAMDS became the primary R&D site for disposal, and pioneered techniques that included robotic remote handling, semi-automated processing lines, and high-temperature incineration with extensive filtration and chemical treatment of the exhaust. Over the lifespan of CAMDS, more than 91 tons of chemical agents were treated, but most operations at CAMDS served as pilots for larger-scale facilities at other installations. In 1981, an ambitious construction program started at Johnston Atoll: the Johnston Atoll Chemical Agent Disposal System (JACADS). Based on techniques in use at CAMDS and built over five years, JACADS then went through four years of testing and validation before the first full-scale chemical weapons disposal line started operation in 1990. Nerve gas shells were carefully unloaded from storage pallets and set up on a belt. That carried them through a sort of de-production line, where the shells were opened, drained, and washed. The explosives and chemicals they contained were burned in a high-temperature incinerator, while the metal casings of the shells and other components were treated in a high-temperature kiln to ensure they were safe to handle. Simultaneously, a set of "auxiliary" incinerators and kilns processed packaging materials and handling waste. Monitoring systems continuously sampled emissions for any escaping chemical weapons, and periodically such leaks were discovered. This period of chemical weapons history is an odd one, because the political tide had turned against chemical weapons but the Army's inertia continued in the direction of chemical warfare. As JACADS was under construction, the Army built a set of new manufacturing plants at Pine Bluff Arsenal. This would specifically produce binary chemical weapons, which use two separate agents that are relatively safe until they are mixed to produce a nerve agent. Binary weapons can be much safer to handle, since the mixing doesn't occur until an in-flight "arming" stage. They were also seen as an escalation in chemical warfare, especially in the context of the Cold War. As often happens with controversial weapons systems, the Army's work to productionize binary weapons was also their undoing. Controversy around the new weapon designs, and the facilities for manufacturing them, led to a renewal in negotiations with the Soviet Union for some type of chemical weapons treaty. Domestically, the issue made its way to Washington, where in 1986 legislation passed requiring that all non-binary (and thus less safe to handle) weapons be safely destroyed. Lack of congressional enthusiasm (resulting in limited funding), the intrinsic complexity of safely handling dangerous chemicals and explosives, and standard military acquisition problems meant that the new binary weapons programs were slow in coming. Despite the start of construction on several binary weapons plants in 1982, only one was operational by the 1990s, producing the M20 and M21 cartridges which produced Sarin upon mixing in an artillery shell. Barely after M20/M21 production started, ongoing talks with the Soviet Union led to an early agreement to end chemical weapons production—a somewhat informal memorandum, but one that kickstarted negotiations for a formal treaty, complete with timelines and verification requirements. In 1991, Congress ordered the destruction of all material related to the chemical weapons program. This included binary materials, as well as waste, experimental samples, and chemical weapons waste buried in landfills. The United States had, at that point, officially ended its chemical weapons program—a position that would be reinforced by the 1997 ratification of the Chemical Weapons Convention, a complete demilitarization treaty with nearly every nation of the world, and most critically key opponent Russia, as signatories. In a certain strategic sense, the US was no longer a "chemical power," the entire stockpile considered retired. In a practical sense, there were still thousands of tons of chemical agents, packaged into hundreds of thousands of tons of munitions, stored in concrete bunkers from Alabama to Oregon. Throughout the last decade of that century, every chemical weapon storage site became a disposal operation. Congressional restrictions and political realities meant that chemical weapons could not generally be transported between sites. During the 1980s, Sarin-carrying Mk 116 "Weteye" bombs stored at Rocky Mountain Arsenal were dismantled there until safety concerns forced a decision to discontinue demilitarization operations at the edge of a major city. The remaining stockpile at Denver was small, but still included almost a thousand Weteye bombs, particularly the "difficult cases" that had begun to leak. The decision was made to ship these bombs to Tooele for safer storage and disposal at the planned CAMDS. The move did happen, but not without inspiring one of the largest political battles of the chemical weapons era, a media circus that considerably frayed relations between the Army and the state of Utah. Congress followed up by restricting domestic transportation, and by the time disarmament was fully underway it was clear that it would all need to be done "as is, where is." I put a lot of time into writing this, and I hope that you enjoy reading it. If you can spare a few dollars, consider supporting me on ko-fi. You'll receive an occasional extra, subscribers-only post, and defray the costs of providing artisanal, hand-built world wide web directly from Albuquerque, New Mexico. The US Army Chemical Demilitarization and Remediation Activity built the Tooele Chemical Agent Disposal Facility (scaled up from CAMDS), Anniston CADF, Umatilla CADF, and Newport CADF. Failures of several pilot programs to develop a practical alternative to high-temperature incineration led to the construction of the Aberdeen and Pine Bluff CADFs shortly after. Manufacturing facilities were converted, sometimes hastily, to dismantling facilities. The Chemical Weapons Convention's verification scheme started a comprehensive audit of military stockpiles, with storage sites physically searched for chemical inventory. A dream that seems so remote for nuclear weapons had been achieved: it was now military policy, and a major military objective, to find and destroy every last chemical weapon. At the turn of the millennium, JACADS completed its mission, having incinerated nearly half a million weapons—6% of the total US stockpile—stored at Johnston Atoll. Disposal facilities were operating at nearly every stockpile site, almost exclusively by incineration, although some neutralization operations continued at smaller scale. While most of the chemical inventory took the form of large quantities of finished weapons at depots, there was also a sort of "miscellaneous" category. Smaller supplies of weapons that had been moved for testing or R&D, stored agents that were never assembled into weapons, laboratory samples and waste, and other "etcetera" cases made up the category of "non-stockpile" chemical materials. For example, the military had manufactured over a hundred thousand "chemical agent identification sets," sort of portable laboratories and field guides for soldiers that might encounter chemical weapons in the field. These contained small samples of several chemical weapons, and were stored at several sites. They met their end via the Rapid Response System, a three-semi-trailer portable agent disposal facility that could perform a range of neutralization processes at small scale. After qualification testing at Tooele, the Rapid Response System made a sort of nationwide tour of each facility. A particularly hard case were those weapons that had begun to leak, or where the explosives had become unstable. These were dangerous to handle or transport, even over short distances. In response, Sandia National Laboratories developed the Explosive Destruction System. The EDS was a single semi trailer, but one that traveled with about a dozen supporting trucks. It was typically set up under a tent with a negative pressure air filtration system and an airlock for entry. Chemical munitions were set up in a tray, and shaped explosive charges placed across the top. This nightmare casserole is then loaded into a huge steel chamber, where the explosives are detonated to both "open" the weapons and thermally neutralize some of the contents. The rest of the chemical agent is destroyed by neutralizing chemicals injected into the chamber post-detonation, and the steel vessel is heated and rotated to mix everything up and complete the operation. During the '90s and '00s, multiple EDS units were used to handle small inventories of "discovered" chemical weapons, leaking and damaged weapons, and non-stockpile materials. After the Chemical Weapons Convention, the EDS convoy included a "treaty trailer" where staff from the international treaty enforcement body Organization for the Prohibition of Chemical Weapons (OPCW) independently observed the work. Major storage sites required industrial-scale facilities. At Umatilla, 1,000 concrete bunkers held artillery shells, rockets, bombs, landmines, sprayers, and storage containers. These weapons contained nerve agents Sarin and VX, as well as Mustard Gas and blister agents. 1980s upgrades to the facility included better sealing the igloos, fitting them with drains that would contain water from the bunkers for sampling, and adding air filtration on the bunker vents. These reduced the risk from leaking weapons, but as the stockpile aged, leakage was a more and more serious problem. Starting in 1998 the Army carefully recorded each leak; prior to that year most went unnoticed. Environmental personnel interviewed former employees and found multiple stories of leaks, cracks, and other incidents. In at least one case, a leaking munition described by a former worker was found, still stored, right in the bunker where he said it had sprayed its contents across the wall. Contracted to Raytheon, construction of the Umatilla Chemical Agent Disposal Facility (UMCDF) began in 1997. The plant went in to operation in 2004. With 819 miles of wire, 25,000 cubic yards of concrete, and 2,655 tons of steel, the Army boasted that it was "among the most advanced industrial facilities in the world." Destroying the full inventory at Umatilla would take years. A risk-prioritized approach was used in which large-quantity nerve agent weapons were destroyed first, and the relatively less dangerous munitions (such as those with only Mustard Gas or those with very small quantities of nerve agent) were left for later. Operated by contractor URS, the UMCDF consisted of a Container Handling Building where airtight, double-walled steel containers that had been packed and sealed in the bunkers were inspected and transferred to conveyors. From that point, they moved into the Munitions Demilitarization Building where the containers were opened, munitions were disassembled and drained, and the chemical agents and components were delivered to various incinerators. While a few workers with extensive protective equipment performed the most complex disassembly tasks, most operations within the Demilitarization Building were performed by a system of conveyors, hoists, and robots under remote control. Different components went into different incinerators. Liquid from washing weapons and containers went to the Liquid Incinerators, where it was mixed with air and natural gas and fed into a two-stage vortex burner system operating between 2,500 and 2,700 degrees Fahrenheit (1,370-1,480 C). Explosives and propellants, usually contaminated by residual chemical agents, went to the Deactivation Furnace System. A 32 foot long rotating drum kiln treated the waste at a minimum of 1,100 degrees Fahrenheit (590 C) for 7-10 minutes, followed by a discharge conveyor that kept them nearly as hot for another 15 minutes. Most of the material burned during this process, leaving ash (packaged for disposal in a chemical landfill) and flue gas that passed through a final stage of incineration in an afterburner chamber. Just about everything else, mostly the metal casings and components of weapons, went to the Metal Parts Furnace (MPF). The MPF was a three-stage incinerator, with a system of belts and airlocks to move material through it in an almost continuous stream. The three stages held materials for various time periods (depending on the type of waste) at temperatures from 1,450 F to 1,800 F (790 C to 980 C), until the materials arrive in the out-feed airlock where they are cooled. The air blown in for cooling was sampled on the way out and tested to ensure that it was free of chemical agents. All gases from the MPF were processed by a multi-stage afterburner incinerator. The UMCDF required an array of support facilities, like the Pollution Abatement System that received the exhaust gases from all of the incinerators. This exhaust, clean of chemical agents but still bearing a variety of interesting and toxic chemicals, was cooled in a quench tower and then put through a series of chemical scrubbers and filters before a final incinerator stage for good measure. Liquid brines, collected from the scrubber towers and parts of the Demilitarization Building process, went to a treatment plant where the water was evaporated off (and the vapors scrubbed) to leave dry crystallized salts. These were packaged for disposal at a hazardous waste landfill. Laboratory, utility, and office buildings made up the rest of the complex. Congressional scrutiny of chemical weapons also led to the Chemical Stockpile Emergency Preparedness Program. This legislation responded to accidents that had occurred at storage and demilitarization sites by requiring that the Army and FEMA take measures to protect nearby communities. The highest population concentration around a major depot, after the relatively early end of operations at Rocky Mountain Arsenal, was found in Oregon and Washington towns around Umatilla. In that region, FEMA funded the construction of a new emergency operations center, installation of sirens, and positive-pressure chemical filtration systems on schools. It was projected that residents of Umatilla would have to move into sealed shelter in less than an hour, were there to be an accident at the depot. A FEMA-funded computer modeling system, at the Emergency Operations Center, would project plume travel to inform evacuation and shelter decisions. The counties stockpiled protective suits and other equipment, and arranged military training on surviving chemical attack for firefighters. By 2000, residents of the area were provided with "tone alert" radios to sound an alarm in their home. Counties distributed "shelter in place kits," with tape and plastic sheeting, to offer residents something to do if the radios ever did sound. The East Oregonian described a county official saying that the kits wouldn't really seal a room, but "may buy more time for a family inside." Pressurization systems were made standard in new schools in the area, and added to the hospital and a nursing home in Umatilla. Working with the CDC, the State of Oregon trained medical personnel on chemical weapons response and distributed the nerve agent antidote Atropine to hospitals. FEMA funds were directed to school districts to buy more buses—a local transportation capability that could be conscripted for an evacuation. In 2008, the last nerve gas weapon, a VX land mine, passed through the plant. The last Mustard Gas weapon was processed in 2011, and evacuation sirens sounded their last Tuesday test. In 2013, the Army published a plan to remediate contamination at Umatilla, demolish the plant, and return the land to other use. Even this process was complex: many of the bunkers were contaminated and had to be carefully cleaned. Much of the demolition debris from the incinerator plant had to be handled as hazardous waste. Each and every bunker was swabbed for testing, soil samples were taken, buildings were knocked over and covered. At the building where workers changed into their protective equipment, septic leachate and dryer lint were collected as chemical waste. In 2023, the Army transferred the 9,511 acres that made up the installation to a coalition of local governments. Much of it will be used by the Oregon National Guard as a training site, other areas are slated to become industrial parks, and the tribal government of the Cayuse, Umatilla, and Walla Walla peoples will operate a large area as an environmental preserve—some of which will require an ongoing program of monitoring and institutional controls. The last chemical weapons in the US stockpile were located at Blue Grass Army Depot, where the Blue Grass Chemical Agent Disposal Facility processed the final Sarin-filled M55 rocket on July 7th, 2023—just ahead of the September 30th deadline set by the Chemical Weapons Convention. Measured from Congress's 1986 legislative mandate, the complete destruction of the US inventory of chemical and biological weapons took 37 years. Closure of the later disposal facilities is still ongoing, and the small-scale portable disposal systems will be retained for use on any chemical or biological weapons that might turn up in the future. An Assistant Secretary of Defense, Deborah Rosenblum, said that "this achievement demonstrates our credibility to the international community and has helped move the US government toward closing this particular chapter of US military history." There are few chapters of military history that ever close. The arc of the chemical weapons program, developed under wartime pressures but accelerated during the curious pressure of the Cold War, largely rejected by both the military and the public, and then wrapped up under international agreement at great expense... it is impossible not to compare it to that of the nuclear weapons program. Negotiations with the Soviet Union leading to a bilateral agreement, followed by an international convention, to completely disarm: the dream of generations of nuclear weapons protestors. It seems so far away, so impossible, for nuclear weapons that it's hard to remember that we've done it once before. So why can't we do it again? Well, the comparison isn't entirely fair. For one, the strategic significance of chemical weapons has never been on par with that of their nuclear peers. The story of World War I shows that chemical weapons are hard to use effectively outside of a few very specific situations, and that never really changed. They have a small area of effect, making them useful mostly to clear the way to advance, but they poison the land such that they can prevent that advance actually happening. Chemical disarmament was achieved, in good part, because the chemical weapons just weren't that important to begin with. One also wonders if the history of use is a factor: chemical weapons were widely used in the First World War, which both spread awareness of their horrific effects and made them more approachable, more understandable, as a part of combat. Nuclear weapons have seen such limited use that they remain more of a symbol than a real weapon, surrounded by such a mystique that their power seems both unlimited and unlikely to actually matter. During the 1899 Hague Convention, which banned the use of "shells containing asphyxiating gas," there was a sole vote against. That vote came from the United States, through its representative, Captain Alfred Mahan of the Navy. He explained his vote thus: The inventiveness of Americans should not be restricted in the development of new weapons. We do consider ourselves to be a powerful culture. The development and manufacturing of chemical weapons was a massive program, involving tens of thousands of workers across the military and private industry. The dismantling of those same weapons happened on the same scale, and often faced even more formidable technical challenges. Perhaps our inventiveness could be less restricted in the destruction of weapons, as well. German researchers gave nerve agents names such as Sarin and Tabun, while the US and NATO used two-letter codes like GB and GA. In fact, these are the same: Sarin is GB and Tabun is GA. I find the acronyms difficult to remember, and the German names are generally the ones used in popular media, so I use the German names when applicable. The problem is that nerve agents developed within NATO countries, such as VX, have no such names. The result will unfortunately be a mix of both conventions.↩

yesterday • 1 votes
Ops needs friction

Between Microsoft's two-day outage and the FAA ground stop yesterday, there's plenty of ink spilled about who's responsible, why these things happened, etc. But it made me think back to some of the infrastructure and ops teams I've worked on, and similar (though much smaller scale) outages we encountered. Having an ops mindset is fundamentally different from a development or project management mindset. And it took me over a decade of software development to understand why.

a week ago • 2 votes
The Topology of Contemporary Politics

I’ve been getting back into the politics fandom this past month.

a week ago • 1 votes
So all software is free as in money now?

A few weeks ago I was up late in my kitchen. I've always been a bad sleeper, starting from when I was 10 and would spend whole nights reading books and watching the clock slowly wind it way to when I had to get up and go to

a week ago • 3 votes
📚 BoredReading

You seem to be enjoying this.

Join free to unlock everything.

Create free account

Already have an account? Sign in