Skip to main content

9 posts tagged with "Headscale"

Articles about Headscale source builds, clustering, multi-tenancy, MagicDNS, and compatibility work.

View all tags

Not Just Larktun Accounts: iOS App Also Supports Tailscale and Self-Hosted Headscale Key Login

· 6 min read
Larktun Contributor

When you build an app for people running many different network setups, the hardest part is not the features. It is the front door.

Some people use Larktun's managed network. They type in an account and password, and they are in. Some prefer auth keys — a string of characters is all the identity they need. And a significant portion of users run networks that are not on Larktun at all. They operate their own Tailscale network, or maintain a self-hosted Headscale instance on a VPS somewhere.

Letting everyone walk in their own way is something the Larktun iOS app has considered from day one.

What Is Larktun?

· 9 min read
Larktun Contributor

Sometimes a product does not begin with a grand plan. It begins with a small, ordinary wish.

You are away from home, and suddenly you need to publish a program, restart a service, or check the quiet little computer sitting on your desk. You only have a tablet or a phone in your hand. Still, you hope you can reach that machine as naturally as opening your own door.

Larktun grew out of that wish.

Headscale Multi-Tenant Isolation for Tailnet, ACL, Routes, and MagicDNS

· 4 min read
Larktun Contributor

Upstream headscale is built around a single-tailnet assumption: one control-plane process manages one shared IP pool, one global ACL policy document, one MagicDNS suffix, and one default relay map. That works well for a single team, but running a SaaS platform—or isolating multiple departments and customer environments on shared infrastructure—requires strict multi-tenant boundaries across every layer of the control plane.

This post walks through the six isolation pillars implemented to transform single-instance headscale into a true multi-tenant architecture, which directly powers Larktun's tenant model today.

Headscale SaaS Seamless User Switching Between Cluster Nodes

· 5 min read
Larktun Contributor

Once you operate a sharded Headscale SaaS cluster, horizontal scaling is only half the operational story. Sooner or later you will need to rebalance a hot shard, drain a node for maintenance, or move an enterprise tenant onto a dedicated shard—without forcing every user to log in again.

This guide documents a production-tested pattern for near-seamless tenant migration across Headscale shards: scoped database migration + hot-reloaded Traefik routing + surgical TCP disconnect + automatic client reconnection.

Headscale Cluster Architecture for Large-Scale Device Onboarding

· 5 min read
Larktun Contributor

Standard headscale is designed as a single-node control plane backed by SQLite or PostgreSQL. That architecture is simple to self-host, but when device counts grow into the thousands across many independent users, a single Headscale instance hits hard ceilings in concurrent long-lived map streams, database write contention, and full netmap recalculations.

This article outlines the architecture used to evolve headscale from a single monolith into a horizontally scalable cluster: cluster_id logical sharding, shared PostgreSQL storage, an Admission and Control Service (ACS), mandatory query isolation, and incremental netmap rebuilds.

Stress Testing Headscale at 200+ Concurrent Clients

· 5 min read
Larktun Contributor

Running a small self-hosted headscale instance for ten personal devices is effortless. Operating Headscale as a production multi-user control plane is a completely different workload: every node join, disconnect, route change, or key rotation triggers map-response updates across peers. Before scaling Headscale into a multi-tenant SaaS control plane, you need repeatable load tests that measure both steady-state overhead and reconnect storms.

This guide documents a reproducible stress-testing workflow for 200+ concurrent clients using containerized Tailscale nodes, automated churn injection, and randomized TCP/UDP traffic sampling.

Using MagicDNS and Extra Records in Headscale

· 4 min read
Larktun Contributor

Remembering dynamic tailnet IP addresses quickly becomes painful once your private network grows past a handful of servers, NAS appliances, and laptops. Enabling MagicDNS in headscale solves this by automatically publishing readable hostnames for every enrolled node, and pairing it with extra_records_path lets you map internal LAN services and 4via6 routes to stable DNS names.

This guide covers how to configure MagicDNS in Headscale, structure extra-records.json, apply updates cleanly without disrupting connected clients, and verify DNS resolution end to end.

Headscale Series: Packaging Source-Built Headscale as a Docker Image

· 2 min read
Larktun Contributor

The official Headscale image is usually around 80MB in docker images. In contrast, custom images built from a handwritten Dockerfile are often much larger and harder to keep consistent with upstream releases.

This guide shows a closer-to-official approach: use ko to package a source-built Headscale Go binary into a minimal container image without maintaining a Dockerfile.