Playbook: add a homelab box
Goal: the user wants a machine at home (a mini PC, a Raspberry Pi, a Proxmox VM, their Windows PC through WSL2, a Mac through a Linux VM) in their fleet, with its apps reachable on the Internet.
You guide, the user owns the machine. MZPanel does not install WSL, VMs or anything on Windows/macOS. You give the user the commands, ask them to run what needs their machine (admin PowerShell, the BIOS, the router), and check the results. Human guide: Homelab and local machines.
Token: read to check, operate for servers_update and servers_tunnel_create. Adding
the server itself happens on the box (the install one-liner) and needs a free server slot:
a homelab box counts against the plan’s server quota like any server (402 server_limit).
1. Find out what the machine is
Section titled “1. Find out what the machine is”Ask: which OS, which hardware, is it on all the time, and do they have a domain on Cloudflare? Then pick the guide:
| Machine | Guide | Notes |
|---|---|---|
| Linux on the metal, or a VM on Proxmox/ESXi/Hyper-V | Linux, Proxmox, Raspberry Pi | Proxmox: a VM, not LXC |
| Raspberry Pi 4/5 | same page | 64-bit OS, SSD boot |
| Windows 10/11 | Windows (WSL2) | beta; needs systemd in WSL and a keepalive task |
| macOS | macOS (Linux VM) | OrbStack, Lima, UTM or Multipass |
2. Pre-install checks (run them on the box, in Linux)
Section titled “2. Pre-install checks (run them on the box, in Linux)”Ask the user to run these and paste the output:
. /etc/os-release && echo "$ID $VERSION_ID" # ubuntu 24.04+, debian 12/13, almalinux/rocky 9/10uname -m # x86_64 or aarch64ps -p 1 -o comm= # systemdfree -m | awk '/Mem:/{print $2" MB RAM"}' # 2048+ to build apps (1024 minimum)df -h / | awk 'NR==2{print $4" free"}' # 10G+ freecurl -sI https://api.mzpanel.com | head -1 # HTTP/2 200 (outbound HTTPS works)Stop and fix before installing when: the OS is older (upgrade or reinstall), PID 1 is not
systemd (on WSL: /etc/wsl.conf [boot] systemd=true, then wsl --shutdown), or there is
no outbound HTTPS.
3. Install with the homelab profile
Section titled “3. Install with the homelab profile”-
The user creates an install command in the dashboard (Servers > Add server > Generate install command, no components) or you call
install_tokens_listto see open ones. Install tokens are single use and expire in 1 hour. -
They run it with
MZ_PROFILE=homelab:Terminal window curl -fsSL https://get.mzpanel.com | sudo INSTALL_TOKEN=<token> MZ_PROFILE=homelab bashThe homelab profile never touches the firewall, sshd, timezone, fstab or
/home, and provisions Docker + Nginx. On WSL or a desktop the installer refuses without the flag. -
Confirm:
servers_listshows the box online withhomelab: true. If it was installed without the profile,servers_update {id, body: {name, homelab: true}}sets the flag (no offline notifications, no instant URL); host hardening already applied is not undone.
4. Public URLs: the Cloudflare Tunnel
Section titled “4. Public URLs: the Cloudflare Tunnel”Skip this when the user only wants LAN access (apps then answer http://<app>.home.arpa once
they map that name to the box’s LAN IP).
dns_connections_list→ there must be a Cloudflare connection with the zone the user wants (for exampleexample.com). None → the user connects one under Connect > DNS providers.- The token needs Account → Cloudflare Tunnel: Edit (besides Zone → DNS: Edit). Tell the user to add it to the token in the Cloudflare dashboard (My Profile > API Tokens > edit); the token value does not change, so the connection needs no update.
servers_tunnel_create {id, body: {zone: "example.com"}}→202 {jobId, tunnel}. Errors:403 cf_tunnel_scope(step 2 missing),409 agent_update_required(runagent_update, needs 0.2.145+),409 server_offline,400 zone_required(passzone).- Poll
servers_tunnel_get {id}every few seconds untiltunnel.statusisactiveandcfStatusishealthy(failed→ readtunnel.error, thenjobs_get {jobId}).
5. Deploy
Section titled “5. Deploy”Use the normal deploy playbook with the box’s id:
- domain omitted →
urlishttps://<app>.<zone>and the hostname is routed through the tunnel automatically; - uploads through the tunnel are limited to 100 MB (
maxBytes,note); for bigger projects deploy from Git; apps_fleet_deployonly picks a homelab box when it has a tunnel; pin it withplacement.serverIdotherwise.
Extra names (a Docker stack, a site): servers_tunnel_route_add {id, body: {hostname, service: "https"}} for stacks (their vhost forces HTTPS), "http" for apps and sites.
6. Keep it running (tell the user)
Section titled “6. Keep it running (tell the user)”- Linux/Proxmox: start at boot, “restore on AC power loss”, a DHCP reservation.
- Windows: the keepalive scheduled task, no sleep on AC, automatic sign-in if the PC must come back alone after Windows Update.
- macOS: the VM starts at login, “prevent automatic sleeping”.
A homelab box going offline sends no notifications by design. Suggest an uptime monitor on the
public URL (uptime_monitors_create) if the user wants to know when it is down.
Safety
Section titled “Safety”- Never ask for or handle the user’s Cloudflare token yourself; they edit it in Cloudflare.
servers_tunnel_deleteandservers_tunnel_route_deletetake the box’s public hostnames offline (scopedata:delete): confirm with the user first.- Removing the server (
servers_delete) also deletes its tunnel and the CNAMEs MZPanel made at Cloudflare; deleting an app (app.delete) drops that app’s tunnel routes. Records the user changed since are kept. To unpublish a box but keep managing it, useservers_tunnel_delete. - Install or remove the connector with
servers_tunnel_create/servers_tunnel_delete, neverjobs_createwithtunnel.install/tunnel.uninstall(refused:service_only).