medium.com 25 min read Original Source

Create a DevOps HomeLab Server

From my school days I still have an old Surface Book 3 lying around. Right now it is only gathering dust, but with a few tweaks it can become my own HomeLab server — a permanent, always-on machine I fully control.

In this story we will turn that laptop into a small but complete platform: a place to deploy side projects, reach them from anywhere under real hostnames, watch what the machine is actually doing, and back everything up automatically.

Surface Book 3
│
├── Tailscale VPN            (private network, no open ports)
│
├── CoreDNS                  (*.homelab → server)
│
├── homelab-proxy (Traefik)  (owns :80 / :443, routes everything)
│   │
│   ├── coolify-proxy ──── Coolify apps
│   ├── Grafana
│   └── Prometheus
│
├── Docker
│   ├── Coolify
│   └── Node Exporter
│
└── Restic Backup → USB
Surface Book 3
│
├── Tailscale VPN            (private network, no open ports)
│
├── CoreDNS                  (*.homelab → server)
│
├── homelab-proxy (Traefik)  (owns :80 / :443, routes everything)
│   │
│   ├── coolify-proxy ──── Coolify apps
│   ├── Grafana
│   └── Prometheus
│
├── Docker
│   ├── Coolify
│   └── Node Exporter
│
└── Restic Backup → USB

By the end you will be able to:

  • Host your own services on hardware you own
  • Reach the server from anywhere over a private VPN, without opening a single router port
  • Deploy from Git with a self-hosted PaaS (Coolify)
  • Resolve your own *.homelab names with CoreDNS
  • Route every service through one central Traefik reverse proxy
  • Monitor the machine with Prometheus and Grafana
  • Take automated, versioned backups with Restic

The guiding idea, which becomes important around the halfway point: every component lives in its own directory with its own Docker Compose project, and only the reverse proxy connects them. Nothing is allowed to become the backbone that everything else depends on — not even Coolify.

Installing Ubuntu Server

Creating the boot stick

Visit the Ubuntu Server download page and grab the ISO file. An ISO is a byte-for-byte image of an installation medium — if you have never worked with one, this explainer is a good starting point.

You will need a USB stick of at least 4 GB and a flashing tool such as balenaEtcher or Rufus.

You do not need to format the stick first, but you can. Flashing tools write the raw image over the whole device, so any existing partition table is overwritten anyway. Just make sure there is nothing on the stick you still need.

In balenaEtcher, select the ISO as the source, pick your USB stick as the target, and hit Flash. When it finishes, eject the stick.

Booting your device from USB

Surface devices do not have a classic BIOS key like F2 or Del. They use two button combinations instead:

  • Boot from USB: shut down, insert the stick, hold Volume Down, then press and release Power. Keep holding Volume Down until the spinning dots appear under the logo.
  • Open the UEFI menu: shut down, hold Volume Up, then press and release Power.

If your machine is not a Surface, look up the key combination for your model — it varies by manufacturer.

Going through the installer

The Ubuntu Server installer is a text UI. These are the settings I used:

  • Language: English
  • Keyboard: Switzerland
  • Type of installation: Ubuntu Server (not minimized — you want the standard tooling)
  • Network: Ethernet if you have it. I did not, so I selected my wlan interface, chose Edit Wifi, and entered my router credentials.
  • Storage: the guided default (use entire disk) is fine
  • Profile: your name, a server name, a username and a password (use a simple password and username, as you will have to enter them fairly often)
  • Install OpenSSH server: ✅ — this is the one checkbox you must not miss, otherwise you cannot reach the machine remotely
  • Featured snaps: skip them all, we install what we need ourselves

Then reboot and pull out the USB stick.

Wired Ethernet is worth the cable if you can manage it. Wi-Fi on a headless server works, but a dropped connection means walking over to the machine with a monitor.

First Login over SSH

Once the server has a network connection, you can leave it in a corner and connect from your normal computer.

<button data-code="ssh @” data-toggle-ms=”1200″ aria-label=”Copy code” data-nosnippet=”” class=”code-copy-btn absolute right-3 top-1/2 -translate-y-1/2 size-8 p-1.5 flex items-center justify-center bg-black/50 text-white rounded-md transition-colors duration-200 cursor-pointer hover:bg-black/70″>

ssh <username>@<server-name>
ssh <username>@<server-name>

If your network does not resolve it, use the IP address instead — you can find it on the server with ip a, or in your router’s client list.

The first time you connect, SSH asks whether you trust the host’s fingerprint. Type yes. This stores the key in ~/.ssh/known_hosts so your client can detect if the host ever changes.

Before installing anything, update the system so you are running the latest package lists and security patches:

sudo apt update && sudo apt upgrade -y
sudo apt update && sudo apt upgrade -y

Keeping the Server Awake with the Lid Closed

A laptop server should keep running when you close the lid. By default, systemd-logind suspends the machine on a lid-close event, which would take your whole homelab offline. The quickest way to change this is to update the /etc/systemd/logind.conf directly.

Open the configuration file:

sudo nano /etc/systemd/logind.conf
sudo nano /etc/systemd/logind.conf

The logind.conf file controls how Ubuntu handles power-related events, including closing the laptop lid. Find these lines:

#HandleLidSwitch=suspend
#HandleLidSwitchExternalPower=suspend
#HandleLidSwitchDocked=ignore
#HandleLidSwitch=suspend
#HandleLidSwitchExternalPower=suspend
#HandleLidSwitchDocked=ignore

Change them to:

HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore

These settings cover the three situations the daemon distinguishes: running on battery, running on external power, and docked to an external display. Setting all three to ignore means the lid becomes a purely mechanical hinge.

Apply the change by restarting the login manager:

sudo systemctl restart systemd-logind
sudo systemctl restart systemd-logind

Restarting systemd-logind can terminate active login sessions. If your SSH connection drops, just reconnect — the setting is already applied.

Generating SSH Keys

Right now SSH works with a password. Key-based authentication is both more convenient and much harder to brute-force, because the private key never leaves your machine.

Generate a key pair on your development machine (not the server):

ssh-keygen -t ed25519
ssh-keygen -t ed25519

ed25519 is the modern default — shorter keys, faster, and no bad parameter choices to make. You can protect the key with a passphrase; for a personal homelab this comes down to your threat model. I used the defaults for convenience, and rely on the disk encryption of my laptop instead.

Copy the public half to the server:

<button data-code="ssh-copy-id @.local” data-toggle-ms=”1200″ aria-label=”Copy code” data-nosnippet=”” class=”code-copy-btn absolute right-3 top-1/2 -translate-y-1/2 size-8 p-1.5 flex items-center justify-center bg-black/50 text-white rounded-md transition-colors duration-200 cursor-pointer hover:bg-black/70″>

ssh-copy-id <username>@<server-name>.local
ssh-copy-id <username>@<server-name>.local

Now verify that logging in no longer asks for a password:

<button data-code="ssh @.local” data-toggle-ms=”1200″ aria-label=”Copy code” data-nosnippet=”” class=”code-copy-btn absolute right-3 top-1/2 -translate-y-1/2 size-8 p-1.5 flex items-center justify-center bg-black/50 text-white rounded-md transition-colors duration-200 cursor-pointer hover:bg-black/70″>

ssh <username>@<server-name>.local
ssh <username>@<server-name>.local

Adding a key does not make the server safer on its own, it just makes it easier for us to work with sessions.

Configuring the Firewall (UFW)

Ubuntu ships with UFW (Uncomplicated Firewall), a friendly wrapper around iptables that controls which incoming connections are accepted.

Allow SSH before enabling the firewall. Otherwise you lock yourself out of your own server:

sudo ufw allow OpenSSH
sudo ufw allow OpenSSH

Enable it and check the result:

sudo ufw enable
sudo ufw status verbose
sudo ufw enable
sudo ufw status verbose

You should see that the firewall is active and that OpenSSH is allowed. Everything else incoming is denied.

As you add services later (such as a web server or your Go/Fiber application), you can allow additional ports. For example:

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

With the firewall enabled, all incoming connections to the host are blocked by default except for the services you explicitly allow.

One caveat, and it is the one that trips up almost everyone building a homelab: this protects the host, not your containers. Docker publishes ports by writing its own iptables rules, and those packets are forwarded without ever passing through the INPUT chain that UFW filters. A container published on port 3000 stays reachable from your whole network even if ufw status reports 3000 DENY.

There are two clean ways around it. You can bind a container to a specific address instead of all of them — -p 127.0.0.1:3000:3000 for localhost only, or your Tailscale address for VPN-only. Or you can avoid publishing ports altogether and put services behind a reverse proxy, which is what we do for everything from the halfway point onwards.

Remote Access with Tailscale

Tailscale builds a private WireGuard mesh between your devices. Each device gets a stable 100.x.x.x address that works from any network, and the machines connect directly to each other — no port forwarding, no dynamic DNS, no exposing SSH to the public internet.

Install it on the server:

curl -fsSL https://tailscale.com/install.sh | sh
curl -fsSL https://tailscale.com/install.sh | sh

Piping a script from the internet straight into a shell is convenient, but you are trusting whatever that URL serves. If you would rather not, Tailscale also publishes APT repositories you can add manually.

Check the installation and bring the machine onto your network:

tailscale version
sudo tailscale up
tailscale version
sudo tailscale up

You will see something like:

To authenticate, visit:

https://login.tailscale.com/a/xxxxxxxx
To authenticate, visit:

https://login.tailscale.com/a/xxxxxxxx

Open the link in a browser and log in. After authenticating, the Surface is part of your private network.

Get its IPv4 address:

tailscale ip -4
tailscale ip -4

From any other device on your tailnet you can now connect:

<button data-code="ssh @100.x.x.x” data-toggle-ms=”1200″ aria-label=”Copy code” data-nosnippet=”” class=”code-copy-btn absolute right-3 top-1/2 -translate-y-1/2 size-8 p-1.5 flex items-center justify-center bg-black/50 text-white rounded-md transition-colors duration-200 cursor-pointer hover:bg-black/70″>

ssh <username>@100.x.x.x
ssh <username>@100.x.x.x

Optionally, let Tailscale handle SSH authentication entirely:

sudo tailscale up --ssh
sudo tailscale up --ssh

This gives you:

  • authentication through your Tailscale identity, tied to your ACLs
  • no SSH key distribution between devices
  • session recording and audit options if you ever want them

The installer should already enable the service at boot, but it costs nothing to confirm:

systemctl is-enabled tailscaled
systemctl is-enabled tailscaled

Installing Docker

Docker lets us package each project with its dependencies and run them side by side without conflicts.

The vocabulary is worth getting right too: an image is the immutable template, a container is a running instance of it.

Prepare the installation:

sudo apt install -y ca-certificates curl gnupg
sudo apt install -y ca-certificates curl gnupg

Add Docker’s GPG key, so apt can verify that the packages really come from Docker:

sudo install -m 0755 -d /etc/apt/keyrings

curl -fsSL https://download.docker.com/linux/ubuntu/gpg 
  | sudo gpg --dearmor 
  -o /etc/apt/keyrings/docker.gpg

sudo chmod a+r /etc/apt/keyrings/docker.gpg
sudo install -m 0755 -d /etc/apt/keyrings

curl -fsSL https://download.docker.com/linux/ubuntu/gpg 
  | sudo gpg --dearmor 
  -o /etc/apt/keyrings/docker.gpg

sudo chmod a+r /etc/apt/keyrings/docker.gpg

Add the repository. The signed-by part ties this repository to the key we just installed, so it cannot be used to sign packages from anywhere else:

echo 
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] 
https://download.docker.com/linux/ubuntu 
$(lsb_release -cs) stable" 
| sudo tee /etc/apt/sources.list.d/docker.list
echo 
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] 
https://download.docker.com/linux/ubuntu 
$(lsb_release -cs) stable" 
| sudo tee /etc/apt/sources.list.d/docker.list

Install the engine, the CLI, the container runtime and the two plugins we will use:

sudo apt update
sudo apt install -y 
  docker-ce 
  docker-ce-cli 
  containerd.io 
  docker-buildx-plugin 
  docker-compose-plugin
sudo apt update
sudo apt install -y 
  docker-ce 
  docker-ce-cli 
  containerd.io 
  docker-buildx-plugin 
  docker-compose-plugin

Verify:

docker --version
docker compose version
docker --version
docker compose version

To run Docker without typing sudo every time, add your user to the docker group:

sudo usermod -aG docker $USER
sudo usermod -aG docker $USER

Be aware that members of the docker group can mount the host filesystem into a container and are therefore effectively root.

Group membership is read at login, so the change only takes effect in a new session.

Log out and back in, or simply reboot:

sudo reboot
sudo reboot

Then run the classic smoke test:

docker run hello-world
docker run hello-world

Structuring the Lab

A little structure now saves a lot of confusion later. Each of these directories will hold exactly one Docker Compose project:

sudo mkdir -p /srv/homelab/{apps,backups,dns,monitoring,proxy}
sudo chown -R $USER:$USER /srv/homelab
sudo mkdir -p /srv/homelab/{apps,backups,dns,monitoring,proxy}
sudo chown -R $USER:$USER /srv/homelab

/srv is the directory the Filesystem Hierarchy Standard reserves for data served by the system, which is exactly what a homelab is.

Now create the shared Docker network that ties the whole architecture together:

docker network create proxy
docker network create proxy

Nothing joins it yet. The rule for the rest of this story is simple:
A service that should be reachable by name joins the proxy network and adds Traefik labels. Everything else stays on its own private Compose network.
That single convention is what keeps the components independent.

docker network ls
docker network ls

Coolify: Your Own Mini-Vercel

Coolify is a self-hosted platform-as-a-service. You point it at a Git repository, it builds a Docker image and runs it, handles the reverse proxy and TLS certificates, and gives you logs and redeploys in a web UI.

Think Vercel or Heroku, except the server is yours and there is no bill.

Install it:

curl -fsSL https://cdn.coollabs.io/coolify/install.sh | sudo bash
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | sudo bash

The script installs its own Docker stack — the application, a PostgreSQL database, Redis and a Traefik proxy.

Give it a few minutes, then check what is running:

docker ps
docker ps

The web interface

In your local network, open:

<button data-code="http://.local:8000″ data-toggle-ms=”1200″ aria-label=”Copy code” data-nosnippet=”” class=”code-copy-btn absolute right-3 top-1/2 -translate-y-1/2 size-8 p-1.5 flex items-center justify-center bg-black/50 text-white rounded-md transition-colors duration-200 cursor-pointer hover:bg-black/70″>

http://<server-name>.local:8000
http://<server-name>.local:8000

Or over Tailscale:

http://100.x.x.x:8000
http://100.x.x.x:8000

The first visit asks you to create the root account.
Do that immediately, until you do, anyone who can reach port 8000 can claim it.

Coolify registers the machine it runs on as localhost, so you can select that server and deploy a new resource straight away.

Deploying a Go Fiber API

I prepared a small Go Fiber API on GitHub as a public repository. It includes a Dockerfile, which is what makes it deployable anywhere.

In Coolify, create a new resource from a public repository, paste the GitHub URL, and select Dockerfile as the build pack. The defaults are mostly fine — but check the branch under Git Source. My repository uses master, while Coolify assumes main.

Once the deployment is green, Coolify has generated a domain for the app. From your development machine you can confirm the routing works:

<button data-code="curl -H "Host: ..sslip.io" http://” data-toggle-ms=”1200″ aria-label=”Copy code” data-nosnippet=”” class=”code-copy-btn absolute right-3 top-1/2 -translate-y-1/2 size-8 p-1.5 flex items-center justify-center bg-black/50 text-white rounded-md transition-colors duration-200 cursor-pointer hover:bg-black/70″>

curl -H "Host: <coolify-id>.<ip>.sslip.io" http://<ip>
curl -H "Host: <coolify-id>.<ip>.sslip.io" http://<ip>

Opening the bare IP in a browser still returns a 404, and that is expected rather than broken. Traefik routes by Host header, so a request that arrives without a matching hostname has no rule to match and falls through to the default 404.

The generated domains use sslip.io, a DNS service that simply returns the IP address embedded in the hostname. 1-2-3-4.sslip.io resolves to 1.2.3.4. It works, but it is ugly, it leaks your IP into a public DNS name, and it only ever gives you one hostname per app.

If sslip.io hostnames fail to resolve at all, your router or DNS resolver is probably blocking DNS rebinding— many do, because a public DNS name resolving to a private IP is a common attack pattern.

Checkpoint

At this point we have a real server:

  • reachable over SSH in the local network, and from anywhere over Tailscale
  • running Docker
  • running Coolify, which gives us a small private Vercel for deploying containers, databases and more

You could stop here and reach everything by IP and port. But remembering that Grafana is :3001, Prometheus is :9090and Coolify is :8000 gets old fast — and it means everything has to publish a host port, which is exactly the thing that bypasses UFW.

So the next three sections fix that properly: our own DNS server, one central reverse proxy, and a refactor that turns Coolify from the networking backbone into just another service behind it.

Giving Services Real Names with CoreDNS

Instead of memorising Tailscale IPs and ports, we will run our own DNS server so that anything ending in .homelab resolves to the server. In the end we will have grafana.homelab, prometheus.homelab, *.coolify.homelab — all pointing at the same machine, where the reverse proxy sorts out which service actually answers.

I use CoreDNS, but any DNS server does the job (or write your own, if you are feeling brave 👀).

First, install the DNS lookup tools we will test with — Ubuntu Server does not ship them:

sudo apt install -y dnsutils
sudo apt install -y dnsutils

The Compose project

Create the compose file in the dns folder:

cd /srv/homelab/dns
nano docker-compose.yml
cd /srv/homelab/dns
nano docker-compose.yml

And add this content:

services:
  coredns:
    image: coredns/coredns:latest
    container_name: coredns
    restart: unless-stopped
    ports:
      - "1053:53/udp"
      - "1053:53/tcp"
    volumes:
      - ./Corefile:/etc/coredns/Corefile:ro
    command: -conf /etc/coredns/Corefile
services:
  coredns:
    image: coredns/coredns:latest
    container_name: coredns
    restart: unless-stopped
    ports:
      - "1053:53/udp"
      - "1053:53/tcp"
    volumes:
      - ./Corefile:/etc/coredns/Corefile:ro
    command: -conf /etc/coredns/Corefile

We start on port 1053 deliberately. Port 53 on this machine is not free yet, and testing on a high port first separates “is my config right?” from “is my port binding right?”.

The Corefile

Create the Corefile:

nano Corefile
nano Corefile

And add this content:

homelab:53 {
    template IN A {
        match .*.homelab
        answer "{{ .Name }} 60 IN A 100.00.00.00"
    }

    log
    errors
}
homelab:53 {
    template IN A {
        match .*.homelab
        answer "{{ .Name }} 60 IN A 100.00.00.00"
    }

    log
    errors
}

Replace 100.00.00.00 with your own Tailscale address.

This is about as small as a zone gets. The template plugin matches any query name ending in .homelab and synthesises an A record pointing at the server, with a 60 second TTL. There is no zone file to maintain and no record to add when you deploy a new service — every name that ends in .homelab already resolves.

log and errors write query and failure output to the container log, which is what you will read the first time something does not resolve.

Start it:

docker compose up -d
docker compose up -d

And test:

dig @localhost -p 1053 test.homelab
dig @localhost -p 1053 test.homelab

You should get an ANSWER SECTION with your Tailscale IP.

The wildcard has a side effect worth internalising: every .homelab name resolves, whether or not a service exists behind it. A successful ping proves your DNS works. It proves nothing about the service.

Moving CoreDNS to port 53

Tailscale’s split DNS forwards queries to a nameserver on port 53 — there is no field for a custom port. So 1053 was only ever a test, and we need the real thing.

Port 53 is not entirely free, though. Ubuntu runs systemd-resolved, which owns a stub listener. The important detail is where it listens:

127.0.0.53:53
    │
systemd-resolved  (local stub resolver, the server's own lookups)

100.00.00.00:53
    │
CoreDNS           (bound to the Tailscale interface only)
127.0.0.53:53
    │
systemd-resolved  (local stub resolver, the server's own lookups)

100.00.00.00:53
    │
CoreDNS           (bound to the Tailscale interface only)

systemd-resolved binds specifically to 127.0.0.53, not to 0.0.0.0. That leaves every other address on the machine available — including the Tailscale one. By binding CoreDNS to the Tailscale IP explicitly, both resolvers run in parallel without a conflict, and neither needs to be disabled.

You can confirm what is listening before you change anything:

sudo ss -tulpn | grep :53
sudo ss -tulpn | grep :53

Now edit the ports:

nano /srv/homelab/dns/docker-compose.yml
ports:
      - "100.00.00.00:53:53/udp"
      - "100.00.00.00:53:53/tcp"
nano /srv/homelab/dns/docker-compose.yml
ports:
      - "100.00.00.00:53:53/udp"
      - "100.00.00.00:53:53/tcp"

The format is host-ip:host-port:container-port. Recreate the container — restart is not enough here, because port mappings are fixed at creation time:

docker compose down
docker compose up -d
docker compose down
docker compose up -d

Test without a port this time:

dig @100.00.00.00 test.homelab
dig @100.00.00.00 test.homelab

One operational gotcha: Docker can only bind to 100.00.00.00 once tailscale has brought that interface up. On a cold boot Docker sometimes wins the race and the container fails with “cannot assign requested address”. restart: unless-stopped retries and it resolves itself, but if you see CoreDNS flapping right after a reboot, that is why.

Pointing Tailscale at it

Open the Tailscale admin console and go to:
DNS > Nameservers > Add nameserver > Custom

Enter your server’s Tailscale IP, then enable Restrict to domain and enter homelab.

That last part is what makes this a split DNS setup: only .homelab queries go to your CoreDNS, everything else keeps using whatever resolver the device normally uses. Your laptop does not route its Google traffic through your Surface.

Now from any device on the tailnet:

ping test.homelab
ping test.homelab

Using the name in Coolify

Open your Fiber app’s settings in Coolify and replace the generated sslip.io domain with a .homelab one:

http://go-fiber.coolify.homelab
http://go-fiber.coolify.homelab

The coolify. part is not decoration — it is the segment the reverse proxy will use in the next section to decide that this request belongs to Coolify rather than to a directly-managed service. Applications get *.coolify.homelab, infrastructure gets *.homelab.

And with that, the full path for a request looks like this:

Client
  │  DNS query: go-fiber.coolify.homelab
  ▼
Tailscale Split DNS
  │  zone "homelab" → 100.00.00.00
  ▼
CoreDNS
  │  wildcard *.homelab → 100.00.00.00
  ▼
Surface Server :80
  │
  ▼
Coolify Traefik  (routes by Host header)
  │
  ▼
Go Fiber Container
Client
  │  DNS query: go-fiber.coolify.homelab
  ▼
Tailscale Split DNS
  │  zone "homelab" → 100.00.00.00
  ▼
CoreDNS
  │  wildcard *.homelab → 100.00.00.00
  ▼
Surface Server :80
  │
  ▼
Coolify Traefik  (routes by Host header)
  │
  ▼
Go Fiber Container

DNS alone cannot give you HTTPS. .homelab is not a real top-level domain, so no public CA will ever issue a certificate for it. Everything in this setup stays on plain HTTP — which is acceptable precisely because the only way to reach it is through the encrypted WireGuard tunnel that Tailscale already provides.

If you want browser-green padlocks anyway, the options are an internal CA with mkcert, or using Tailscale’s own HTTPS certificates on your *.ts.net names.

A Central Reverse Proxy

Right now our DNS points every .homelab name at the server, and Coolify’s Traefik happens to be sitting on port 80 to catch them. That works — but it means Grafana, Prometheus and everything else we add later would have to be routed by Coolify, a tool that knows nothing about them.

That is the wrong dependency. Coolify should be a service, not the front door. So we run our own Traefik instance that owns ports 80 and 443, and forward the Coolify-managed applications to Coolify’s internal proxy as one route among many.

Change into the proxy directory and edit it’s compose file:

cd /srv/homelab/proxy
nano docker-compose.yml
cd /srv/homelab/proxy
nano docker-compose.yml

And add this content:

services:
  traefik:
    image: traefik:v3.7
    container_name: homelab-proxy
    restart: unless-stopped

    networks:
      - proxy

    ports:
      - "100.00.00.00:9080:8080"

    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro

    command:
      - "--api.dashboard=true"
      - "--api.insecure=true"

      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"

      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"

networks:
  proxy:
    external: true
services:
  traefik:
    image: traefik:v3.7
    container_name: homelab-proxy
    restart: unless-stopped

    networks:
      - proxy

    ports:
      - "100.00.00.00:9080:8080"

    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro

    command:
      - "--api.dashboard=true"
      - "--api.insecure=true"

      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"

      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"

networks:
  proxy:
    external: true

Some notes on why this looks the way it does:

  • No ports 80/443 yet — Coolify’s proxy owns them. We take them over once there’s something to hand over to.
  • --providers.docker=true lets Traefik watch Docker and build routes from container labels, so adding services later means adding labels instead of editing config files.
  • --providers.docker.exposedbydefault=false keeps it safe — only containers with traefik.enable=true get routes.
  • The Docker socket is mounted read-only. Socket access is root-equivalent, which is the standard Traefik trade-off.
  • --api.insecure=true serves the dashboard with no auth, which is why it’s published on 100.00.00.00 (Tailscale) rather than 0.0.0.0— Docker bypasses UFW, so an unbound port would be an unauthenticated admin panel on your LAN.
  • websecure is defined but unused. There’s no certificate resolver for .homelab, but the entrypoint is there so adding TLS later is just a config change.

Start it and confirm:

docker compose up -d
docker ps | grep homelab-proxy
docker compose up -d
docker ps | grep homelab-proxy

The dashboard is now at http://100.00.00.00:9080/dashboard/
(the trailing slash matters).

Moving Coolify Behind the Proxy

Right now the setup looks like this:

/data/coolify/proxy/docker-compose.yml
        │
        ▼
coolify-proxy (Traefik)
        │
        ├── Ports 80 / 443 / 8080
        └── Docker socket
/data/coolify/proxy/docker-compose.yml
        │
        ▼
coolify-proxy (Traefik)
        │
        ├── Ports 80 / 443 / 8080
        └── Docker socket

And we want this:

                    :80/:443
                        │
                        ▼
               homelab-proxy (Traefik)
                        │
        ┌───────────────┼───────────────┐
        │               │               │
      apps         monitoring        coolify
                                        │
                                        ▼
                                 coolify-proxy
                                   (internal)
                    :80/:443
                        │
                        ▼
               homelab-proxy (Traefik)
                        │
        ┌───────────────┼───────────────┐
        │               │               │
      apps         monitoring        coolify
                                        │
                                        ▼
                                 coolify-proxy
                                   (internal)

We are not touching Coolify itself — only its proxy bindings. Coolify keeps managing its own applications exactly as before; it just stops being the thing that answers port 80.

Free up ports 80 and 443

Quickly create a back up first:

cd /data/coolify/proxy
sudo cp docker-compose.yml docker-compose.yml.backup
cd /data/coolify/proxy
sudo cp docker-compose.yml docker-compose.yml.backup

Then edit the proxy’s compose file:

sudo nano /data/coolify/proxy/docker-compose.yml
sudo nano /data/coolify/proxy/docker-compose.yml

Remove the existing ports entries and leave only:

ports:
  - '127.0.0.1:8081:8080'
ports:
  - '127.0.0.1:8081:8080'

What this achieves:

  • 80 and 443 move to the central proxy
  • 8081 keeps the Coolify Traefik dashboard/API reachable for debugging, bound to localhost
  • the container itself still listens on 80 and 443 inside the Docker network, which is exactly what we forward to

Recreate the containers:

sudo docker compose -f /data/coolify/proxy/docker-compose.yml down
sudo docker compose -f /data/coolify/proxy/docker-compose.yml up -d
docker ps | grep coolify-proxy
sudo docker compose -f /data/coolify/proxy/docker-compose.yml down
sudo docker compose -f /data/coolify/proxy/docker-compose.yml up -d
docker ps | grep coolify-proxy

⚠️ This is the most fragile part of the whole setup. Coolify generates this file from its own settings, and a Coolify upgrade or a “Restart Proxy” click in the UI can overwrite your edit — at which point it grabs port 80 again and homelab-proxy fails to restart.

Coolify’s Server → Proxy settings page lets you edit the configuration in a way that persists, which is the better place to make this change if your version offers it. Either way: after every Coolify update, check docker ps before assuming everything is fine. That backup file is there for a reason.

Take over 80 and 443

Edit the proxy’s compose file again:

cd /srv/homelab/proxy
nano docker-compose.yml
ports:
      - "80:80"
      - "443:443"
      - "100.00.00.00:9080:8080"
cd /srv/homelab/proxy
nano docker-compose.yml
ports:
      - "80:80"
      - "443:443"
      - "100.00.00.00:9080:8080"

Ports 80 and 443 are published on all interfaces on purpose — this is the front door, and it needs to answer on the Tailscale interface, the LAN, and anything else you point at it later.

Restart:

docker compose down
docker compose up -d
docker compose down
docker compose up -d

The gateway route

homelab-proxy cannot discover Coolify’s applications through the Docker provider, because those containers live on Coolify’s own networks with Coolify’s own labels. Instead we hand the whole *.coolify.homelab namespace over to Coolify’s proxy with one static rule, and let it do what it is already good at.

Create a new dynamic directory within the proxy directory:

mkdir -p /srv/homelab/proxy/dynamic
nano /srv/homelab/proxy/dynamic/coolify.yml
mkdir -p /srv/homelab/proxy/dynamic
nano /srv/homelab/proxy/dynamic/coolify.yml

And add this Content:

http:
  routers:
    coolify:
      rule: "HostRegexp(`^.+\.coolify\.homelab$`)"
      entryPoints:
        - web
      service: coolify

  services:
    coolify:
      loadBalancer:
        servers:
          - url: "http://coolify-proxy:80"
http:
  routers:
    coolify:
      rule: "HostRegexp(`^.+\.coolify\.homelab$`)"
      entryPoints:
        - web
      service: coolify

  services:
    coolify:
      loadBalancer:
        servers:
          - url: "http://coolify-proxy:80"

The request keeps its original Host header as it is forwarded, which is what lets Coolify’s Traefik match it against the domain you configured on the app. Two proxies, each routing by the same header, at different levels of specificity.

Enable the file provider in homelab-proxy:

nano /srv/homelab/proxy/docker-compose.yml
nano /srv/homelab/proxy/docker-compose.yml

Add to command:

- "--providers.file.directory=/etc/traefik/dynamic"
- "--providers.file.watch=true"
- "--providers.file.directory=/etc/traefik/dynamic"
- "--providers.file.watch=true"

And to volumes:

- /srv/homelab/proxy/dynamic:/etc/traefik/dynamic:ro
- /srv/homelab/proxy/dynamic:/etc/traefik/dynamic:ro

--providers.file.watch=true means Traefik reloads dynamic routes when the file changes, without restarting the container.

Restart:

docker compose down
docker compose up -d
docker compose down
docker compose up -d

Finally, put Coolify’s proxy on our shared network so the two can actually reach each other:

docker network connect proxy coolify-proxy
docker network connect proxy coolify-proxy

Again, this connection does not survive Coolify recreating the container. If go-fiber.coolify.homelab suddenly returns a 502 after a Coolify update, simply run this command again — Traefik will find the container immediately afterwards.

The complete path now:

Client
  │  go-fiber.coolify.homelab
  ▼
CoreDNS
  │  → 100.00.00.00
  ▼
homelab-proxy          :80
  │  HostRegexp(*.coolify.homelab)
  ▼  proxy network
coolify-proxy
  │  Host header match
  ▼
Go Fiber Container
Client
  │  go-fiber.coolify.homelab
  ▼
CoreDNS
  │  → 100.00.00.00
  ▼
homelab-proxy          :80
  │  HostRegexp(*.coolify.homelab)
  ▼  proxy network
coolify-proxy
  │  Host header match
  ▼
Go Fiber Container

Four hops, but each one is a component you can restart, inspect and reason about on its own. And the architecture stays separated:

/srv/homelab
│
├── dns/         CoreDNS
│                └── *.homelab → server
│
├── proxy/       homelab-proxy
│                ├── central entry layer
│                └── routing to services
│
├── monitoring/  Prometheus, Grafana, Node Exporter
│
├── apps/        directly-managed Compose projects
│
└── backups/

/data/coolify    Coolify, isolated behind its own proxy
/srv/homelab
│
├── dns/         CoreDNS
│                └── *.homelab → server
│
├── proxy/       homelab-proxy
│                ├── central entry layer
│                └── routing to services
│
├── monitoring/  Prometheus, Grafana, Node Exporter
│
├── apps/        directly-managed Compose projects
│
└── backups/

/data/coolify    Coolify, isolated behind its own proxy

Monitoring with Prometheus and Grafana

Now the architecture pays off. Adding a monitored, named, routed service is no longer a matter of picking a free port and remembering it — it is joining the proxy network and writing four labels.

We deploy the monitoring stack as its own Compose project, outside Coolify. Monitoring should keep working when the thing it monitors breaks — if Coolify falls over, you still want to be able to see why.

The three pieces do different jobs:

  • Prometheus scrapes metrics on a schedule and stores them as time series
  • Node Exporter exposes the host’s CPU, memory, disk and network statistics in a format Prometheus understands
  • Grafana queries Prometheus and draws the dashboards

Change into the monitoring dir, create these two new directories and edit the compose file:

cd /srv/homelab/monitoring
mkdir -p prometheus grafana
nano docker-compose.yml
cd /srv/homelab/monitoring
mkdir -p prometheus grafana
nano docker-compose.yml

Add this content:

services:

  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    restart: unless-stopped

    volumes:
      - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
      - prometheus-data:/prometheus

    networks:
      - monitoring
      - proxy

    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=proxy"
      - "traefik.http.routers.prometheus.rule=Host(`prometheus.homelab`)"
      - "traefik.http.routers.prometheus.entrypoints=web"
      - "traefik.http.services.prometheus.loadbalancer.server.port=9090"

  grafana:
    image: grafana/grafana:latest
    container_name: grafana
    restart: unless-stopped

    environment:
      - GF_SERVER_ROOT_URL=http://grafana.homelab

    volumes:
      - grafana-data:/var/lib/grafana

    networks:
      - monitoring
      - proxy

    depends_on:
      - prometheus

    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=proxy"
      - "traefik.http.routers.grafana.rule=Host(`grafana.homelab`)"
      - "traefik.http.routers.grafana.entrypoints=web"
      - "traefik.http.services.grafana.loadbalancer.server.port=3000"

  node-exporter:
    image: prom/node-exporter:latest
    container_name: node-exporter
    restart: unless-stopped

    pid: host

    volumes:
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /:/rootfs:ro

    command:
      - '--path.procfs=/host/proc'
      - '--path.sysfs=/host/sys'
      - '--path.rootfs=/rootfs'

    networks:
      - monitoring

networks:
  monitoring:
    driver: bridge
  proxy:
    external: true

volumes:
  prometheus-data:
  grafana-data:
services:

  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    restart: unless-stopped

    volumes:
      - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
      - prometheus-data:/prometheus

    networks:
      - monitoring
      - proxy

    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=proxy"
      - "traefik.http.routers.prometheus.rule=Host(`prometheus.homelab`)"
      - "traefik.http.routers.prometheus.entrypoints=web"
      - "traefik.http.services.prometheus.loadbalancer.server.port=9090"

  grafana:
    image: grafana/grafana:latest
    container_name: grafana
    restart: unless-stopped

    environment:
      - GF_SERVER_ROOT_URL=http://grafana.homelab

    volumes:
      - grafana-data:/var/lib/grafana

    networks:
      - monitoring
      - proxy

    depends_on:
      - prometheus

    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=proxy"
      - "traefik.http.routers.grafana.rule=Host(`grafana.homelab`)"
      - "traefik.http.routers.grafana.entrypoints=web"
      - "traefik.http.services.grafana.loadbalancer.server.port=3000"

  node-exporter:
    image: prom/node-exporter:latest
    container_name: node-exporter
    restart: unless-stopped

    pid: host

    volumes:
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /:/rootfs:ro

    command:
      - '--path.procfs=/host/proc'
      - '--path.sysfs=/host/sys'
      - '--path.rootfs=/rootfs'

    networks:
      - monitoring

networks:
  monitoring:
    driver: bridge
  proxy:
    external: true

volumes:
  prometheus-data:
  grafana-data:

The details worth understanding:

  • No published ports — all three containers are reachable only through Traefik. This sidesteps the Docker/UFW problem entirely.
  • Two networks per service: monitoring (private, for Prometheus to reach Node Exporter) and proxy (how Traefik reaches the others). Node Exporter is monitoring-only since raw metrics shouldn’t be browsed directly.
  • traefik.docker.network=proxy prevents Traefik from routing to the wrong IP when a container is on multiple networks.
  • loadbalancer.server.port is the internal container port, not a host port — no remapping needed since nothing is published.
  • GF_SERVER_ROOT_URL tells Grafana its external address so post-login redirects don’t break.

Configuring Prometheus

Edit the prometheus config file:

nano prometheus/prometheus.yml
nano prometheus/prometheus.yml

And add this content:

global:
  scrape_interval: 15s

scrape_configs:

  - job_name: prometheus
    static_configs:
      - targets:
          - localhost:9090

  - job_name: node
    static_configs:
      - targets:
          - node-exporter:9100
global:
  scrape_interval: 15s

scrape_configs:

  - job_name: prometheus
    static_configs:
      - targets:
          - localhost:9090

  - job_name: node
    static_configs:
      - targets:
          - node-exporter:9100

Two jobs, two different kinds of address, and the difference matters:

  • localhost:9090 is Prometheus scraping itself, from inside its own container.
  • node-exporter:9100 works because Compose registers each service under its own name on the project network. Inside that network, the container name is a hostname.

Start everything:

docker compose up -d
docker compose ps
docker compose up -d
docker compose ps

Opening the dashboards

From any device on your tailnet, in a browser:

http://prometheus.homelab
http://grafana.homelab
http://prometheus.homelab
http://grafana.homelab

No ports, no tunnels, no IP addresses. That is the whole point of the last two sections.

Log into Grafana with the default credentials admin / admin and change the password immediately when prompted.

Then add Prometheus as a data source. The connection URL is:

http://prometheus:9090
http://prometheus:9090

Not localhost:9090 — Grafana runs in its own container, where localhost means the Grafana container. It reaches Prometheus by service name on the shared monitoring network, exactly like Prometheus reaches Node Exporter.

Confirm the exporter is being scraped: in Prometheus, open Status > Target health.

Both prometheus and node should be green and UP.

Neither Prometheus nor Traefik’s dashboard has any authentication in this setup. On a tailnet that you control, that is a defensible trade-off — but it is a trade-off, not an oversight. If other people are on your tailnet, you can put a BasicAuth middleware in front of them.

Importing a dashboard

Building panels from scratch is a lot of work, and for host metrics somebody has already done it. In Grafana choose Dashboards > New > Import and enter the ID 1860 for Node Exporter Full, then select your Prometheus data source.

You now have CPU, memory, disk I/O, filesystem usage, network throughput and temperature panels for the whole machine.

Testing that it actually works

A dashboard you have never seen react is a dashboard you do not trust yet.

Let’s generate some load:

sudo apt install -y stress htop
stress --vm 1 --vm-bytes 512M --timeout 30
sudo apt install -y stress htop
stress --vm 1 --vm-bytes 512M --timeout 30

This spawns one worker that repeatedly allocates and frees 512 MB for 30 seconds. In a second SSH session run:

htop
htop

and compare what htop shows in real time with what appears in Grafana. The graphs lag by up to the 15 second scrape interval, so give it a moment. Seeing the same spike in both places is how you know the pipeline works end to end.

Adding anything else, from now on

This is the part worth remembering. To put a new service behind a name:

  1. Give it its own directory and Compose project under /srv/homelab
  2. Attach it to the proxy network alongside its private one
  3. Add five labels: traefik.enable, traefik.docker.network, a Host() rule, an entrypoint, and the internal port

No DNS record to create, no port to allocate, no firewall rule to remember. Uptime Kuma or Portainer for instance can be added with the same five lines.

Automatic Backups with Restic

Restic does deduplicated, encrypted, incremental snapshots. Every backup after the first only stores changed blocks, everything is encrypted before it touches the disk, and each snapshot can be restored on its own.

Now that /srv/homelab holds the DNS zone, the Traefik dynamic routes and the monitoring configuration, this matters more than it did an hour ago — that directory is your entire infrastructure as code.

You can use the USB stick from the beginning of this story, or any old external drive as your backup storage.

Preparing the drive

Plug the drive into the server and find it:

lsblk
lsblk

The new device is usually /dev/sda (or /dev/sdb if you already have one). Match it by size — picking the wrong device here wipes the wrong disk.

Format it with ext4, directly on the server:

sudo mkfs.ext4 -L homelab-backup /dev/sda
sudo mkfs.ext4 -L homelab-backup /dev/sda

Do not format it as FAT/exFAT on macOS or Windows first. FAT has no concept of Unix ownership or permissions, and a 4 GB limit per file. Restic’s repository wants a real Linux filesystem.

Formatting on the server also avoids the classic mistake of declaring ext4 in /etc/fstab for a drive that was actually formatted as FAT — the mount then fails silently at boot and your backups quietly go nowhere.

Get the UUID of the new filesystem:

sudo blkid /dev/sda
sudo blkid /dev/sda

We mount by UUID rather than by /dev/sda, because device names depend on detection order and can change between reboots. The UUID belongs to the filesystem and stays put.

Create a mount point and add it to the filesystem table:

sudo mkdir -p /mnt/backups
sudo nano /etc/fstab
sudo mkdir -p /mnt/backups
sudo nano /etc/fstab

Add this one-liner:

<button data-code="UUID= /mnt/backups ext4 defaults,nofail 0 2″ data-toggle-ms=”1200″ aria-label=”Copy code” data-nosnippet=”” class=”code-copy-btn absolute right-3 top-1/2 -translate-y-1/2 size-8 p-1.5 flex items-center justify-center bg-black/50 text-white rounded-md transition-colors duration-200 cursor-pointer hover:bg-black/70″>

UUID=<UUID> /mnt/backups ext4 defaults,nofail 0 2
UUID=<UUID> /mnt/backups ext4 defaults,nofail 0 2

nofail is important: without it, the server refuses to finish booting if the drive is missing. With it, a forgotten USB stick is a warning instead of a machine you have to plug a monitor into.

Reload the generated mount units and mount everything:

sudo systemctl daemon-reload
sudo mount -a
sudo systemctl daemon-reload
sudo mount -a

Verify:

lsblk -f
ls -la /mnt/backups
lsblk -f
ls -la /mnt/backups

You should see the drive mounted at /mnt/backups with a lost+found directory — the sign of a healthy ext4 filesystem.

Creating the repository

Install Restic and check:

sudo apt install -y restic
restic version
sudo apt install -y restic
restic version

We will run backups as root, because they read files across the whole system that your user cannot. Give root exclusive access to the backup directory:

sudo chown root:root /mnt/backups
sudo chmod 700 /mnt/backups
sudo chown root:root /mnt/backups
sudo chmod 700 /mnt/backups

Initialize the repository:

sudo restic init --repo /mnt/backups/restic
sudo restic init --repo /mnt/backups/restic

You are asked for a password, and this is the single most important thing in the whole setup. Restic encrypts the repository with it, and there is no recovery mechanism. Lose the password and the backups are permanently unreadable. Put it in your password manager before you continue.

Take the first snapshot:

sudo restic backup /srv/homelab /data/coolify --repo /mnt/backups/restic
sudo restic backup /srv/homelab /data/coolify --repo /mnt/backups/restic

Note that both paths are included. /srv/homelab holds the DNS, proxy and monitoring configuration, but Coolify keeps its own state — application definitions, the database, environment variables — in /data/coolify. Backing up only /srv/homelabwould give you a false sense of safety.

List what you have:

sudo restic snapshots --repo /mnt/backups/restic
sudo restic snapshots --repo /mnt/backups/restic

Testing the restore

An untested backup is a hypothesis. Verify it:

sudo mkdir -p /root/restore-test
sudo restic restore latest --target /root/restore-test --repo /mnt/backups/restic
sudo ls -la /root/restore-test/srv/homelab
sudo mkdir -p /root/restore-test
sudo restic restore latest --target /root/restore-test --repo /mnt/backups/restic
sudo ls -la /root/restore-test/srv/homelab

Restic recreates the full path inside the target directory, which is why the files land under /root/restore-test/srv/homelab. Use sudo here too — the repository is root-owned, so a restore as your normal user fails on both the repository and the file permissions.

Clean up when you are satisfied:

sudo rm -rf /root/restore-test
sudo rm -rf /root/restore-test

Automating it

First store the password in a file only root can read:

sudo nano /root/.restic-password
sudo chmod 600 /root/.restic-password
sudo nano /root/.restic-password
sudo chmod 600 /root/.restic-password

Put the password on a single line, with no trailing spaces.

Then write the backup script:

sudo nano /usr/local/bin/homelab-backup.sh
sudo nano /usr/local/bin/homelab-backup.sh

And add this content:

#!/bin/bash
set -euo pipefail

export RESTIC_PASSWORD_FILE=/root/.restic-password
export RESTIC_REPOSITORY=/mnt/backups/restic
restic backup /srv/homelab /data/coolify
restic forget 
  --keep-daily 7 
  --keep-weekly 4 
  --keep-monthly 12 
  --prune
#!/bin/bash
set -euo pipefail

export RESTIC_PASSWORD_FILE=/root/.restic-password
export RESTIC_REPOSITORY=/mnt/backups/restic
restic backup /srv/homelab /data/coolify
restic forget 
  --keep-daily 7 
  --keep-weekly 4 
  --keep-monthly 12 
  --prune

set -euo pipefail makes the script stop at the first error instead of carrying on and reporting success. Without it, a failed backup followed by a successful forget would look like everything went fine.

The forget policy keeps the last 7 daily, 4 weekly and 12 monthly snapshots and deletes the rest. --prune then removes the now-unreferenced data from the repository. Pruning is I/O heavy, so if the drive is slow you may prefer to prune weekly and let the daily run only do forget.

Make it executable and try it:

sudo chmod +x /usr/local/bin/homelab-backup.sh
sudo /usr/local/bin/homelab-backup.sh
sudo chmod +x /usr/local/bin/homelab-backup.sh
sudo /usr/local/bin/homelab-backup.sh

The systemd timer

A systemd timer is the modern replacement for cron. Two files: a service that describes what to run, and a timer that describes when.

Create the Backup Service:

sudo nano /etc/systemd/system/homelab-backup.service
sudo nano /etc/systemd/system/homelab-backup.service

And add this content:

[Unit]
Description=Homelab Restic Backup
RequiresMountsFor=/mnt/backups

[Service]
Type=oneshot
ExecStart=/usr/local/bin/homelab-backup.sh
[Unit]
Description=Homelab Restic Backup
RequiresMountsFor=/mnt/backups

[Service]
Type=oneshot
ExecStart=/usr/local/bin/homelab-backup.sh

RequiresMountsFor makes systemd refuse to run the backup if the drive is not mounted — otherwise restic would happily create a fresh, empty repository in a directory on the internal disk and you would not notice for months.

Also create a timer:

sudo nano /etc/systemd/system/homelab-backup.timer
sudo nano /etc/systemd/system/homelab-backup.timer

And add this content:

[Unit]
Description=Daily Homelab Backup

[Timer]
OnCalendar=daily
RandomizedDelaySec=30m
Persistent=true

[Install]
WantedBy=timers.target
[Unit]
Description=Daily Homelab Backup

[Timer]
OnCalendar=daily
RandomizedDelaySec=30m
Persistent=true

[Install]
WantedBy=timers.target
  • OnCalendar=daily fires at midnight. For a weekly run instead, use OnCalendar=Sun *-*-* 03:00:00.
  • RandomizedDelaySec=30m spreads the start time, so backups do not always collide with whatever else runs at midnight.
  • Persistent=true means that if the server was off at the scheduled time, the job runs at the next boot instead of being skipped.

Enable it:

sudo systemctl daemon-reload
sudo systemctl enable --now homelab-backup.timer
sudo systemctl daemon-reload
sudo systemctl enable --now homelab-backup.timer

Check when it will next fire:

systemctl list-timers homelab-backup.timer
systemctl list-timers homelab-backup.timer

And after the first automatic run, read the log:

journalctl -u homelab-backup.service --since today
journalctl -u homelab-backup.service --since today

One honest caveat: a USB stick plugged into the same machine is not a real backup. It protects you from a mistaken rm -rf or a corrupted container, but not from theft, fire or a power surge.

Restic can push the same repository to S3, Backblaze B2 or any SFTP host — adding a second, offsite target is one extra line in the script and worth doing for anything you would miss.

What’s Next

If you got this far, you have a server that deploys from Git, answers to hostnames you invented, is reachable from anywhere without a single open router port, tells you what it is doing, and backs itself up every night. Every piece can be restarted without taking down the others.

On hardware that was gathering dust.

From here, you could expand in several directions and try adding services on your own, like these:

  • Monitoring and alerting — Uptime Kuma watches your services and sends notifications when something goes down.
  • Container management — Portainer gives you a web GUI for the containers that live outside Coolify (Grafana etc.).
  • Security hardening — BasicAuth on Prometheus and the Traefik dashboard would lock them down from the rest of your tailnet.
  • Offsite resilience — Mirroring your restic repository to B2.