Rebuilding my home Docker server from scratch: the complete step-by-step guide
Everything it takes to go from an empty Proxmox VM to the finished docker-host: Debian, network storage, Docker, the media stack behind a VPN, the website, Plex logins and the little helpers that hold it together. Copy-and-paste friendly.
docker-host is the virtual machine that runs almost everything on example.com: Plex and the apps around it, the book and audiobook libraries, this website, the members area and the "Log in with Plex" system. This guide rebuilds it from an empty Proxmox VM to the finished product. Every command is meant to be copied and pasted as-is, and after each step there's a short what you should see so you know it worked before moving on.
Names and addresses are examples. In this guide the Proxmox host is pve (192.168.1.10), the Docker VM is docker-host (192.168.1.50), the TrueNAS box is nas (192.168.1.20) and the domain is example.com. Swap in your own. Every password, key and token is a placeholder like PASTE_HERE.
Before you start
- Quickest recovery: if docker-host just died, restoring the whole VM from the nightly Proxmox Backup Server backup (pve → VM 100 → Backup → Restore) is faster than any rebuild. This guide is for building a fresh, clean docker-host, for example on new hardware or a new Debian version.
- App data: everything the apps remember (Plex's library database, Sonarr and Radarr settings, Calibre-Web users, Ghost posts, Authentik logins) lives in
/opt/dockerand/opt/npm. Step 7 shows how to pull those folders out of a backup. Without them you'd be setting up every app from zero. - Secrets: have these ready from your password manager: the nas SMB user and password, Cloudflare API token, Gmail app password, NordVPN WireGuard key, and the old
.envfiles if you have them. Database passwords in the website.envmust match the restored databases. - Time: about an hour of hands-on work, plus however long the backup copy takes.
Step 1: Download Debian 12 onto pve
Open a shell on pve (PuTTY to 192.168.1.10, or the Proxmox web UI → pve → Shell) and fetch the small "netinst" installer into Proxmox's ISO store. Check debian.org/distrib/netinst for the current file name if this one has moved on.
cd /var/lib/vz/template/iso
wget https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.12.0-amd64-netinst.iso
ls -lh debian-12*What you should see: a file of roughly 650 MB. (If Debian 12 has moved to the "archive" by the time you read this, Debian 13 works the same way for everything below.)
Step 2: Create the VM
You can click through Create VM in the Proxmox UI, but one command gets every setting right. Run it on pve. Tip: if your router has a DHCP reservation for the old VM, put the old network card (MAC) address in --net0, for example virtio=AA:BB:CC:DD:EE:FF,bridge=vmbr0,firewall=1, so the new VM gets the same address (192.168.1.50).
qm create 100 --name docker-host --ostype l26 \
--cpu host --sockets 1 --cores 12 \
--memory 24576 --balloon 24576 \
--scsihw virtio-scsi-pci --scsi0 local-ssd:200,discard=on,ssd=1 \
--net0 virtio,bridge=vmbr0,firewall=1 \
--ide2 local:iso/debian-12.12.0-amd64-netinst.iso,media=cdrom \
--boot 'order=scsi0;ide2;net0' \
--agent enabled=1,fstrim_cloned_disks=1 \
--vga qxl --onboot 1
qm config 100What you should see: the config printed back, with cpu: host, cores: 12, memory: 24576 and a 200 GB scsi0 on local-ssd.
Why these settings matter:
- CPU type
host: the website's MySQL 8.4 refuses to start on Proxmox's default generic CPU, because it needs newer CPU features (x86-64-v2). discard=on,ssd=1+ guest agent withfstrim_cloned_disks: deleted files actually free space on the 240 GBlocal-ssdSSD. Without it the virtual disk only ever grows.- Guest agent on: Proxmox can shut docker-host down cleanly and see its IP address.
- VM ID 100 and the old name in backups: if the old VM 100 still exists, use another ID (for example 110) and remove the old one when the new one works. The nightly backup job lists VMs by ID, so update it if the ID changes.
Step 3: Install Debian
Start the VM (qm start 100) and open its Console in the Proxmox UI. Choose Install (the text installer is fine) and answer:
- Hostname:
docker-host, domain: leave empty. - Root password: a strong one, saved in your password manager (not in the Proxmox notes field).
- New user: full name and username
youruser. - Partitioning: Guided, use entire disk → the 200 GB disk → All files in one partition.
- Software selection: untick Debian desktop environment and GNOME; tick only SSH server and standard system utilities.
- GRUB: yes, install to
/dev/sda.
When it finishes, remove the installer disc (Hardware → CD/DVD → Do not use any media) and reboot.
What you should see: a docker-host login: prompt in the console, and PuTTY to 192.168.1.50 works as youruser. If the address is different, check the router's DHCP reservation still points the old MAC address at .50.
Step 4: Base system
Log in as youruser and become root for the setup. Everything from here on runs as root unless it says otherwise.
su -Install the basics and add your user to sudo:
apt update
apt full-upgrade -y
apt install -y sudo curl ca-certificates gnupg qemu-guest-agent nfs-common cifs-utils
usermod -aG sudo youruser
systemctl enable --now qemu-guest-agent
systemctl enable --now fstrim.timer
timedatectl set-timezone America/New_YorkWhat you should see: no errors; in Proxmox, the VM's Summary now shows its IP address (that's the guest agent talking).
SSH keys from your PC. On the Windows PC, PowerShell can copy your public key over (enter the root password once):
type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh root@192.168.1.50 "mkdir -p ~/.ssh; cat >> ~/.ssh/authorized_keys; chmod 600 ~/.ssh/authorized_keys"Debian's default PermitRootLogin prohibit-password then allows root by key only. What you should see: ssh root@192.168.1.50 logs in without a password.
Step 5: Connect nas's storage
docker-host keeps no media itself: movies, TV, downloads, books and audiobooks live on nas (TrueNAS) and are mounted over the network. Make the mount points and a credentials file for the read-only family photos share:
mkdir -p /mnt/media /mnt/plex/family_media /mnt/plex/phones
cat > /root/.smb-nas <<'EOF'
username=PASTE_NAS_SMB_USER
password=PASTE_NAS_SMB_PASSWORD
EOF
chmod 600 /root/.smb-nas
nano /root/.smb-nasReplace the two placeholders in nano, save with Ctrl+O, Enter, Ctrl+X. Then add the two mounts to /etc/fstab:
cat >> /etc/fstab <<'EOF'
# nas (TrueNAS): media, downloads, books, audiobooks
192.168.1.20:/mnt/tank/media /mnt/media nfs4 rw,_netdev,hard,timeo=600,retrans=5,noatime,nofail 0 0
# nas SMB: family photos and videos for Plex, read-only
//192.168.1.20/photos /mnt/plex/family_media cifs ro,credentials=/root/.smb-nas,iocharset=utf8,vers=3.1.1,uid=1000,gid=1000,nofail,_netdev 0 0
EOF
systemctl daemon-reload
mount -a
df -h /mnt/media /mnt/plex/family_mediaWhat you should see: both mounts listed, /mnt/media at around 48 TB. ls /mnt/media shows folders like movies, TV Shows, calibre and audiobookshelf.
Step 6: Install Docker
Use Docker's own repository (Debian's package is too old for the compose features used here):
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release; echo $VERSION_CODENAME) stable" > /etc/apt/sources.list.d/docker.list
apt update
apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
usermod -aG docker youruser
docker --version
docker compose versionWhat you should see: a Docker version (29.x or newer) and a Compose version.
Make Docker start only after nas's shares have been mounted:
mkdir -p /etc/systemd/system/docker.service.d
cat > /etc/systemd/system/docker.service.d/wait-for-nas.conf <<'EOF'
# Start Docker only after the nas shares have been attempted, so Plex never starts
# with empty media folders. Wants= (not Requires=): Docker still starts if nas is down.
[Unit]
Wants=mnt-media.mount mnt-plex-family_media.mount
After=mnt-media.mount mnt-plex-family_media.mount remote-fs.target
EOF
systemctl daemon-reload
systemctl restart dockerStep 7: Bring back the app data
The apps keep their settings and databases in two folders: /opt/docker (both Docker projects) and /opt/npm (Nginx Proxy Manager and its certificates). Get them from the most recent backup of the old docker-host:
- In the Proxmox UI: Datacenter → pve → storage pbs → Backups, select the latest VM 100 backup and click File Restore.
- Open
drive-scsi0.img.fidx→ the main partition →opt. Selectdockerand click Download (as .tar.zst), then do the same fornpm. - Copy both archives to the new docker-host and unpack them:
apt install -y zstd
mkdir -p /opt/docker /opt/npm
cd /opt
tar --zstd -xpf /root/docker.tar.zst -C /opt
tar --zstd -xpf /root/npm.tar.zst -C /opt
ls /opt/docker /opt/npmWhat you should see: /opt/docker/mega and /opt/docker/web, each with its docker-compose.yml and .env, and /opt/npm/data plus /opt/npm/letsencrypt.
Put the secret files' permissions back (only their owners may read them):
chown youruser:youruser /opt/docker/mega/.env
chmod 600 /opt/docker/mega/.env /opt/docker/web/.env
chmod 600 /opt/docker/mega/qbittorrent/mam_id 2>/dev/null
ls -l /opt/docker/mega/.env /opt/docker/web/.envStarting from nothing instead? Create the folders and the two .env files by hand. The media stack's .env needs these names (values from your password manager or the apps):
mkdir -p /opt/docker/mega /opt/docker/web /opt/npm
umask 077
cat > /opt/docker/mega/.env <<'EOF'
CLOUDFLARE_API_TOKEN=PASTE_HERE
SMTP_USER=you@gmail.com
SMTP_PASSWORD=PASTE_GMAIL_APP_PASSWORD
NORD_WIREGUARD_KEY=PASTE_HERE
HOMEPAGE_VAR_PLEX_TOKEN=PASTE_HERE
HOMEPAGE_VAR_TAUTULLI_KEY=PASTE_HERE
HOMEPAGE_VAR_OMBI_KEY=PASTE_HERE
SONARR_API_KEY=PASTE_HERE
RADARR_API_KEY=PASTE_HERE
JACKETT_API_KEY=PASTE_HERE
EOF
nano /opt/docker/mega/.envThe website's .env holds generated passwords. For a brand-new site you can let the computer make them (never do this when restoring old databases: the passwords must match what's inside them):
umask 077
cat > /opt/docker/web/.env <<EOF
GHOST_URL=https://example.com
GHOST_DB_PASSWORD=$(openssl rand -hex 24)
GHOST_DB_ROOT_PASSWORD=$(openssl rand -hex 24)
AUTHENTIK_SECRET_KEY=$(openssl rand -base64 60 | tr -d '\n')
AUTHENTIK_DB_PASSWORD=$(openssl rand -hex 24)
EOF
grep -c = /opt/docker/web/.envWhat you should see: 5 (five settings written, none printed on screen).
Step 8: The media stack (project "mega")
This is /opt/docker/mega/docker-compose.yml as it runs today. If you restored Step 7, it's already in place; otherwise create it with nano /opt/docker/mega/docker-compose.yml and paste this in. Secrets come from .env through the ${...} references, so the file itself is safe to keep anywhere.
The important idea: Gluetun (the vpn service) connects to NordVPN, and the download apps (qBittorrent, Sonarr, Radarr, Jackett, Shelfmark) use network_mode: "service:vpn", so all their traffic goes through the VPN. If the VPN drops, they lose the internet instead of leaking your home IP. Their web pages are published on the vpn service's ports.
# /opt/docker/mega/docker-compose.yml — Phases 1-2 (2026-11-24)
# Secrets live in .env next to this file (see .env.example). Never paste .env.
# Still runs as root (PUID/PGID=0): that is phase 3.
services:
# ---------------------------------------------------------------- VPN (Gluetun / NordVPN) + things that route through it
# NordVPN has no port forwarding, so the old 23353 torrent-port mapping did nothing and is gone.
vpn:
image: qmcgaw/gluetun:v3
container_name: gluetun
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun:/dev/net/tun
ports:
- 8080:8080 # qBittorrent web UI
- 7878:7878 # Radarr
- 8989:8989 # Sonarr
- 9117:9117 # Jackett
- 8084:8084 # CWA book downloader
environment:
- TZ=America/New_York
- VPN_SERVICE_PROVIDER=nordvpn
- VPN_TYPE=wireguard
- WIREGUARD_PRIVATE_KEY=${NORD_WIREGUARD_KEY}
- WIREGUARD_ADDRESSES=10.5.0.2/32 # NordLynx always uses this address
# - OPENVPN_USER=${NORD_USER}
# - OPENVPN_PASSWORD=${NORD_PASSWORD}
- SERVER_HOSTNAMES=us1234.nordvpn.com
- UPDATER_PERIOD=24h
- FIREWALL_OUTBOUND_SUBNETS=192.168.1.0/24 # lets the apps reach your LAN (Plex, nas)
volumes:
- ./gluetun:/gluetun
restart: unless-stopped
qbittorrent:
image: lscr.io/linuxserver/qbittorrent:version-5.2.4_v2.0.15 # pinned: MyAnonamouse allows qBittorrent 5.0.1-5.2.x only
container_name: qbittorrent
depends_on:
vpn:
condition: service_healthy
network_mode: "service:vpn"
environment:
- PUID=0
- PGID=0
- TZ=America/New_York
- WEBUI_PORT=8080
volumes:
- /opt/docker/mega/qbittorrent:/config
- /mnt/media:/downloads
- /mnt/media/calibre/uploads:/uploads
restart: unless-stopped
radarr:
image: lscr.io/linuxserver/radarr:latest
container_name: radarr
depends_on:
vpn:
condition: service_healthy
network_mode: "service:vpn"
environment:
- PUID=0
- PGID=0
- TZ=America/New_York
volumes:
- /opt/docker/mega/radarr:/config
- /mnt/media/movies:/movies
- /mnt/media:/downloads
restart: unless-stopped
sonarr:
image: lscr.io/linuxserver/sonarr:latest
container_name: sonarr
depends_on:
vpn:
condition: service_healthy
network_mode: "service:vpn"
environment:
- PUID=0
- PGID=0
- TZ=America/New_York
volumes:
- /opt/docker/mega/sonarr/data:/config
- '/mnt/media/TV Shows:/tv'
- /mnt/media:/downloads
restart: unless-stopped
jackett:
image: lscr.io/linuxserver/jackett:latest
container_name: jackett
depends_on:
vpn:
condition: service_healthy
network_mode: "service:vpn"
environment:
- PUID=0
- PGID=0
- TZ=America/New_York
- AUTO_UPDATE=true
volumes:
- /opt/docker/mega/jackett:/config
restart: unless-stopped
calibre-web-automated-book-downloader:
image: ghcr.io/calibrain/calibre-web-automated-book-downloader:latest
container_name: calibre-web-automated-book-downloader
depends_on:
vpn:
condition: service_healthy
network_mode: "service:vpn"
environment:
FLASK_PORT: 8084
LOG_LEVEL: info
BOOK_LANGUAGE: en
USE_BOOK_TITLE: true
TZ: America/New_York
UID: 0
GID: 0
MAX_CONCURRENT_DOWNLOADS: 3
DOWNLOAD_PROGRESS_UPDATE_INTERVAL: 5
# Shelfmark (this image is Shelfmark; settings also editable in its web UI, saved in ./shelfmark)
INGEST_DIR: /cwa-book-ingest # ebooks -> Calibre-Web-Automated ingest (copied)
DESTINATION_AUDIOBOOK: /downloads/audiobookshelf/audiobooks
FILE_ORGANIZATION_AUDIOBOOK: organize # Author/Title/...
JACKETT_ENABLED: "true"
JACKETT_URL: http://127.0.0.1:9117 # same VPN network namespace
JACKETT_API_KEY: ${JACKETT_API_KEY}
QBITTORRENT_URL: http://127.0.0.1:8080 # username/password are set in the web UI
# Own categories, so the ftl-on-complete.sh hook (categories books/audiobooks = torrents you add by hand)
# never files Shelfmark's downloads a second time. Shelfmark imports its own when they finish.
QBITTORRENT_CATEGORY: shelfmark-books
QBITTORRENT_CATEGORY_AUDIOBOOK: shelfmark-audiobooks
QBITTORRENT_TAG: shelfmark
QBITTORRENT_SEPARATE_DOWNLOAD_DIRS: "true"
QBITTORRENT_DOWNLOAD_DIR_BOOK: /downloads/torrents/shelfmark-books
QBITTORRENT_DOWNLOAD_DIR_AUDIOBOOK: /downloads/torrents/shelfmark-audiobooks
HARDLINK_TORRENTS: "false" # ebooks: copy (CWA deletes/edits what it ingests)
HARDLINK_TORRENTS_AUDIOBOOK: "true" # audiobooks: hardlink, keeps seeding
AUTH_METHOD: proxy # Authentik "Log in with Plex" via NPM forward auth
PROXY_AUTH_USER_HEADER: X-authentik-username
PROXY_AUTH_ADMIN_GROUP_HEADER: X-authentik-groups
PROXY_AUTH_ADMIN_GROUP_NAME: Shelfmark Admins
PROXY_AUTH_DEFAULT_ROLE: user
PROXY_AUTH_LOGOUT_URL: https://requests.example.com/outpost.goauthentik.io/sign_out
volumes:
- /mnt/media/calibre/uploads:/cwa-book-ingest
- /mnt/media:/downloads # same path as qBittorrent, so finished torrents are visible
- ./shelfmark:/config
restart: unless-stopped
# ---------------------------------------------------------------- Moved OFF the VPN (same ports as before)
ombi:
image: lscr.io/linuxserver/ombi:latest
container_name: ombi
environment:
- PUID=0
- PGID=0
- TZ=America/New_York
- BASE_URL=/ombi
ports:
- 3579:3579
volumes:
- /opt/docker/mega/ombi:/config
restart: unless-stopped
tautulli:
image: lscr.io/linuxserver/tautulli:latest
container_name: tautulli
environment:
- PUID=0
- PGID=0
- TZ=America/New_York
ports:
- 8181:8181
volumes:
- /opt/docker/mega/tautulli:/config
restart: unless-stopped
# ---------------------------------------------------------------- Media
plex:
image: lscr.io/linuxserver/plex:latest
container_name: plex
network_mode: host
environment:
- PUID=0
- PGID=0
- VERSION=docker
volumes:
- /opt/docker/mega/plex/library:/config
- /mnt/plex/family_media:/PhotosAndVideos
- /mnt/media/TV Shows:/tv2
- /mnt/media/movies:/movies2
- /mnt/plex/phones:/phones
restart: unless-stopped
kometa:
image: kometateam/kometa:latest
container_name: kometa
environment:
- TZ=America/New_York
volumes:
- /opt/docker/mega/kometa/config:/config
extra_hosts:
- "host.docker.internal:host-gateway"
restart: unless-stopped
unpackerr:
image: golift/unpackerr:latest
container_name: unpackerr
environment:
- PGID=0
- PUID=0
- TZ=America/New_York
- UN_LOG_FILE=/downloads/unpackerr.log
# wait until nothing new has arrived for 5 min (slow copies over the network), retry 3x
- UN_START_DELAY=5m
- UN_RETRY_DELAY=5m
- UN_MAX_RETRIES=3
# Sonarr / Radarr: extract finished downloads they asked for, then they import them
- UN_SONARR_0_URL=http://gluetun:8989
- UN_SONARR_0_API_KEY=${SONARR_API_KEY}
- UN_SONARR_0_PATHS_0=/downloads
- UN_RADARR_0_URL=http://gluetun:7878
- UN_RADARR_0_API_KEY=${RADARR_API_KEY}
- UN_RADARR_0_PATHS_0=/downloads
# drop folder for manual copies: anything put in /mnt/media/unpack-here is
# extracted in place (MOVE_BACK puts the videos next to the rars; rars are kept)
- UN_FOLDER_0_PATH=/downloads/unpack-here
- UN_FOLDER_0_MOVE_BACK=true
- UN_FOLDER_0_DELETE_ORIGINAL=false
volumes:
- /mnt/media:/downloads
restart: unless-stopped
xteve:
image: senexcrenshaw/xteve:latest
container_name: xteve
environment:
- PUID=0
- PGID=0
- TZ=America/New_York
ports:
- 34400:34400
volumes:
- /opt/docker/mega/xteve/config:/home/xteve/conf
- /tmp/xteve:/tmp/xteve:rw
restart: unless-stopped
audiobookshelf:
image: ghcr.io/advplyr/audiobookshelf:latest
container_name: audiobookshelf
ports:
- "13378:80"
volumes:
- /mnt/media/audiobookshelf/audiobooks:/audiobooks
- /mnt/media/audiobookshelf/podcasts:/podcasts
- /opt/docker/mega/audiobookshelf/config:/config
- /opt/docker/mega/audiobookshelf/metadata:/metadata
restart: unless-stopped
# ---------------------------------------------------------------- Books
calibre-web-automated:
image: crocodilestick/calibre-web-automated:latest
container_name: calibre-web-automated
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
- NETWORK_SHARE_MODE=true
- CWA_PORT_OVERRIDE=8083
ports:
- 8083:8083
volumes:
- /opt/docker/mega/calibre-web:/config
- /mnt/media/calibre/uploads:/cwa-book-ingest
- /mnt/media/calibre/library:/calibre-library
- /mnt/media/calibre/plugins/folder:/config/.config/calibre/plugins
restart: unless-stopped
# ---------------------------------------------------------------- Web / infrastructure
nginx-proxy-manager:
image: jc21/nginx-proxy-manager:latest
container_name: nginx-proxy-manager
ports:
- "80:80"
- "443:443"
- "192.168.1.50:81:81" # admin UI, LAN only
volumes:
- /opt/npm/data:/data
- /opt/npm/letsencrypt:/etc/letsencrypt
restart: unless-stopped
splash:
image: nginx:alpine
container_name: splash
ports:
- "8091:80"
volumes:
- ./splash/site:/usr/share/nginx/html:ro
restart: unless-stopped
homepage:
image: ghcr.io/gethomepage/homepage:latest
container_name: homepage
ports:
- "8090:3000"
environment:
- HOMEPAGE_ALLOWED_HOSTS=192.168.1.50:8090,home.example.com,dashboard.example.com
- HOMEPAGE_VAR_PLEX_TOKEN=${HOMEPAGE_VAR_PLEX_TOKEN}
- HOMEPAGE_VAR_TAUTULLI_KEY=${HOMEPAGE_VAR_TAUTULLI_KEY}
- HOMEPAGE_VAR_OMBI_KEY=${HOMEPAGE_VAR_OMBI_KEY}
- HOMEPAGE_VAR_SONARR_KEY=${SONARR_API_KEY}
- HOMEPAGE_VAR_RADARR_KEY=${RADARR_API_KEY}
volumes:
- ./homepage/config:/app/config
- ./homepage/images:/app/public/images
restart: unless-stopped
# Replaces the abandoned oznu image. Updates every record that holds your home IP.
cloudflare-ddns:
image: favonia/cloudflare-ddns:latest
container_name: cloudflare-ddns
network_mode: host
user: "1000:1000"
read_only: true
cap_drop: [all]
security_opt: [no-new-privileges:true]
environment:
- CLOUDFLARE_API_TOKEN=${CLOUDFLARE_API_TOKEN}
- DOMAINS=example.com,requests.example.com,books.example.com,games.example.com,wow.example.com,wow-realm.example.com
- PROXIED=false
- IP6_PROVIDER=none
restart: unless-stopped
smtp-relay:
image: boky/postfix:latest
container_name: smtp-relay
ports:
- "192.168.1.50:587:587" # LAN only (not forwarded on the router): Proxmox, PBS, TrueNAS alerts
environment:
RELAYHOST: "[smtp.gmail.com]:587"
RELAYHOST_USERNAME: ${SMTP_USER}
RELAYHOST_PASSWORD: ${SMTP_PASSWORD}
MYHOSTNAME: "smtp.example.com"
ALLOWED_SENDER_DOMAINS: "example.com"
POSTFIX_inet_protocols: "ipv4"
restart: unless-stoppedStep 9: Start it, VPN first
cd /opt/docker/mega
docker compose pull
docker compose up -d vpn
sleep 30
docker exec gluetun wget -qO- https://ipinfo.io/ipWhat you should see: an address that is not your home IP (a NordVPN address). If it shows your home IP or errors, stop here and check docker logs gluetun: the download apps must not start without the VPN.
docker compose up -d
docker compose psWhat you should see: every service running (Gluetun and Shelfmark also say healthy after a minute). Plex appears on http://192.168.1.50:32400/web.
Step 10: The website stack (project "web")
Ghost (the blog), Authentik ("Log in with Plex") and Uptime Kuma live in their own project in /opt/docker/web, so restarting the media stack never touches the website. It joins the media stack's network to send email through smtp-relay, which is why "mega" must be started first.
# example.com website stack: compose project "web" (separate from "mega", so
# `docker compose up -d` in /opt/docker/mega never starts it by accident).
# STAGED 2026-11-29, NOT STARTED. Needs docker-host at 24 GB RAM first. See GO-LIVE.md.
#
# Lives in /opt/docker/web. Secrets come from ./.env (chmod 600, generated on docker-host,
# never printed). Host ports: 2368 Ghost, 9000 Authentik, 3001 Uptime Kuma: all LAN-only;
# the public reaches them only through Nginx Proxy Manager.
name: web
services:
# ---------- Ghost blog (example.com; testing at new.example.com) ----------
ghost:
image: ghost:6.79-alpine
container_name: ghost
restart: unless-stopped
depends_on:
ghost-db:
condition: service_healthy
ports:
- "2368:2368"
environment:
url: ${GHOST_URL}
NODE_ENV: production
database__client: mysql
database__connection__host: ghost-db
database__connection__user: ghost
database__connection__password: ${GHOST_DB_PASSWORD}
database__connection__database: ghost
# Email (sign-in links, member newsletters) through the existing smtp-relay in "mega"
mail__transport: SMTP
mail__from: '"My Site" <noreply@example.com>'
mail__options__host: smtp-relay
mail__options__port: 587
mail__options__secure: "false"
mail__options__ignoreTLS: "true"
volumes:
- ./ghost/content:/var/lib/ghost/content
networks: [default, mega]
ghost-db:
image: mysql:8.4
container_name: ghost-db
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: ${GHOST_DB_ROOT_PASSWORD}
MYSQL_DATABASE: ghost
MYSQL_USER: ghost
MYSQL_PASSWORD: ${GHOST_DB_PASSWORD}
volumes:
- ./ghost/mysql:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]
interval: 10s
timeout: 5s
retries: 12
start_period: 30s
# ---------- Authentik ("Log in with Plex" in front of home.example.com) ----------
authentik-db:
image: postgres:17-alpine
container_name: authentik-db
restart: unless-stopped
environment:
POSTGRES_DB: authentik
POSTGRES_USER: authentik
POSTGRES_PASSWORD: ${AUTHENTIK_DB_PASSWORD}
volumes:
- ./authentik/postgres:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -d authentik -U authentik"]
interval: 10s
timeout: 5s
retries: 12
start_period: 20s
authentik-server:
image: ghcr.io/goauthentik/server:2026.8.7
container_name: authentik-server
restart: unless-stopped
command: server
depends_on:
authentik-db:
condition: service_healthy
ports:
- "9000:9000" # HTTP; NPM proxies auth.example.com here and uses it for forward auth
environment: &authentik-env
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}
AUTHENTIK_POSTGRESQL__HOST: authentik-db
AUTHENTIK_POSTGRESQL__NAME: authentik
AUTHENTIK_POSTGRESQL__USER: authentik
AUTHENTIK_POSTGRESQL__PASSWORD: ${AUTHENTIK_DB_PASSWORD}
AUTHENTIK_ERROR_REPORTING__ENABLED: "false"
AUTHENTIK_EMAIL__HOST: smtp-relay
AUTHENTIK_EMAIL__PORT: "587"
AUTHENTIK_EMAIL__USE_TLS: "false"
AUTHENTIK_EMAIL__USE_SSL: "false"
AUTHENTIK_EMAIL__FROM: noreply@example.com
volumes:
- ./authentik/data:/data
- ./authentik/media:/media
- ./authentik/custom-templates:/templates
networks: [default, mega]
authentik-worker:
image: ghcr.io/goauthentik/server:2026.8.7
container_name: authentik-worker
restart: unless-stopped
command: worker
depends_on:
authentik-db:
condition: service_healthy
environment: *authentik-env
volumes:
- ./authentik/data:/data
- ./authentik/media:/media
- ./authentik/custom-templates:/templates
networks: [default, mega]
# ---------- Uptime Kuma (server status tile on the members dashboard) ----------
uptime-kuma:
image: louislam/uptime-kuma:2
container_name: uptime-kuma
restart: unless-stopped
ports:
- "3001:3001" # LAN only; admin UI. Members see status via the Homepage widget.
volumes:
- ./uptime-kuma:/app/data
networks: [default, mega]
networks:
mega:
name: mega_default # existing network of the "mega" project (smtp-relay, homepage, ...)
external: truecd /opt/docker/web
docker compose pull
docker compose up -d
sleep 60
docker compose psWhat you should see: six containers running; ghost-db and authentik-db healthy. If ghost-db keeps restarting with "CPU does not support x86-64-v2", the VM's CPU type isn't host (Step 2).
Step 11: Nginx Proxy Manager
NPM's admin page is LAN-only at http://192.168.1.50:81. With /opt/npm restored, every host and certificate comes back by itself. From scratch, these are the proxy hosts (all with Force SSL, HTTP/2, and a Let's Encrypt certificate using the DNS challenge with Cloudflare: the router doesn't forward port 80, so the HTTP challenge can't renew):
| Domain | Forward to | Extra |
|---|---|---|
| example.com, www. | http://192.168.1.50:2368 | Ghost |
| new.example.com | http://192.168.1.50:2368 | Ghost (test name) |
| auth.example.com | http://192.168.1.50:9000 | Authentik, websockets on |
| home.example.com | http://192.168.1.50:8090 | Homepage, websockets on, Plex login (below) |
| requests.example.com | http://192.168.1.50:8084 | Shelfmark, websockets on, Plex login (below) |
| books.example.com | http://192.168.1.50:8083 | Calibre-Web, websockets on |
| audiobooks.example.com | http://192.168.1.50:13378 | Audiobookshelf, websockets on |
| ombi.example.com | http://192.168.1.50:3579 | Ombi, websockets on |
| games.example.com | http://192.168.1.60:8080 | AMP game panel (separate VM) |
| wow.example.com | http://192.168.1.70:80 | WoW page (separate VM), access list with a password |
For the two Plex login hosts, set Access List to "Publicly Accessible" and paste this into the host's Advanced → Custom Nginx Configuration. It sends anyone without an Authentik session to the Plex sign-in, then passes their username (and groups) on to the app:
# NPM -> Proxy Host "requests.example.com" -> Advanced -> Custom Nginx Configuration.
# Proxy host itself: forward to 192.168.1.50:8084 (Shelfmark), SSL on, Websockets on, Access List: Publicly Accessible.
# Sends anyone without an Authentik session to "Log in with Plex", then back. Shelfmark (AUTH_METHOD=proxy)
# trusts X-authentik-username; members of the Authentik group "Shelfmark Admins" are admins (approve requests).
proxy_buffers 8 16k;
proxy_buffer_size 32k;
location / {
include conf.d/include/proxy.conf; # Host, X-Forwarded-*, proxy_pass (NPM standard)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
auth_request /outpost.goauthentik.io/auth/nginx;
error_page 401 = @goauthentik_proxy_signin;
auth_request_set $auth_cookie $upstream_http_set_cookie;
add_header Set-Cookie $auth_cookie;
auth_request_set $authentik_username $upstream_http_x_authentik_username;
auth_request_set $authentik_groups $upstream_http_x_authentik_groups;
auth_request_set $authentik_email $upstream_http_x_authentik_email;
proxy_set_header X-authentik-username $authentik_username;
proxy_set_header X-authentik-groups $authentik_groups;
proxy_set_header X-authentik-email $authentik_email;
}
location /outpost.goauthentik.io {
proxy_pass http://192.168.1.50:9000/outpost.goauthentik.io;
proxy_set_header Host $host;
proxy_set_header X-Original-URL $scheme://$http_host$request_uri;
add_header Set-Cookie $auth_cookie;
auth_request_set $auth_cookie $upstream_http_set_cookie;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
}
location @goauthentik_proxy_signin {
internal;
add_header Set-Cookie $auth_cookie;
return 302 /outpost.goauthentik.io/start?rd=$scheme://$http_host$request_uri;
}Step 12: "Log in with Plex" (Authentik)
With /opt/docker/web/authentik restored, all of this is already in place. From scratch, in Authentik's admin (https://auth.example.com/if/admin/, user akadmin):
- Directory → Federation & Social login → Create → Plex. Connect your Plex account, allow only your own server, and leave Allow friends off (Plex retired the friends API; turning it on breaks every login with an error 410). Add the source to the default authentication flow's identification stage so the Plex button shows.
- Proxy providers (mode Forward auth, single application) for
https://home.example.comandhttps://requests.example.com, each with an application, both added to the embedded outpost (whose authentik host ishttps://auth.example.com). - OAuth2/OpenID providers for Audiobookshelf (redirect URIs
https://audiobooks.example.com/auth/openid/callbackand…/auth/openid/mobile-redirect) and Calibre-Web (https://books.example.com/login/generic/authorized). For both, use a scope mapping that marks the email as verified (Plex has verified it), otherwise Audiobookshelf refuses to match existing accounts by email. - A group Shelfmark Admins containing your account: Shelfmark makes its members admins.
Then in each app: Audiobookshelf Settings → Authentication → OpenID Connect (issuer https://auth.example.com/application/o/audiobookshelf/, match existing users by email, subfolder "None"), and Calibre-Web Admin → Edit Basic Configuration → Login type: OAuth with the generic provider (redirect host https://books.example.com, and turn off group admin management, or your own admin rights are removed the first time you log in with Plex).
Step 13: The helpers
qBittorrent: file books and audiobooks automatically
When a torrent in the books category finishes, its ebooks are copied to Calibre-Web's import folder (a copy, because Calibre-Web deletes what it imports). Torrents in audiobooks are hard-linked into Audiobookshelf: the same files on disk, so qBittorrent keeps seeding without using extra space. Save this as /opt/docker/mega/qbittorrent/ftl-on-complete.sh:
#!/bin/bash
# qBittorrent "Run external program on torrent finished" hook (docker-host, container qbittorrent).
# Called as: /config/ftl-on-complete.sh "%L" "%F" "%N" (category, content path, torrent name)
# books -> COPY ebook files into the Calibre-Web-Automated ingest folder (/uploads).
# A real copy, because CWA deletes/edits what it ingests; the torrent keeps seeding.
# audiobooks -> HARDLINK the download into Audiobookshelf's library. Same files on disk, no extra
# space, qBittorrent keeps seeding. Deleting the torrent later leaves ABS's copy intact.
# Anything else is ignored. Log: /config/ftl-on-complete.log
set -u
cat="${1:-}"; src="${2:-}"; name="${3:-}"
LOG=/config/ftl-on-complete.log
INGEST=/uploads
STAGING=/downloads/torrents/.staging
ABS=/downloads/audiobookshelf/audiobooks
log() { echo "$(date '+%F %T') [$cat] $*" >> "$LOG"; }
[ -e "$src" ] || { [ -n "$cat" ] && log "missing content path: $src"; exit 0; }
case "$cat" in
books)
mkdir -p "$STAGING"
n=0
while IFS= read -r -d '' f; do
base="${f##*/}"
tmp="$STAGING/$base"
if cp -f "$f" "$tmp" && chown 1000:1000 "$tmp" && mv -f "$tmp" "$INGEST/$base"; then
n=$((n + 1))
else
log "copy failed: $f"; rm -f "$tmp"
fi
done < <(find "$src" -type f \( -iname '*.epub' -o -iname '*.mobi' -o -iname '*.azw3' -o -iname '*.azw' \
-o -iname '*.pdf' -o -iname '*.fb2' -o -iname '*.cbz' -o -iname '*.cbr' -o -iname '*.djvu' \) -print0)
log "$name: copied $n ebook file(s) to CWA ingest"
;;
audiobooks)
folder="${name%.*}"; [ -d "$src" ] && folder="$name" # single-file torrent: drop the extension
dest="$ABS/$folder"
mkdir -p "$dest"
if [ -d "$src" ]; then
cp -aln "$src/." "$dest/" 2>>"$LOG"
else
cp -aln "$src" "$dest/" 2>>"$LOG"
fi
log "$name: hardlinked into Audiobookshelf as '$folder' ($(find "$dest" -type f | wc -l) files)"
;;
esac
exit 0chmod 755 /opt/docker/mega/qbittorrent/ftl-on-complete.shIn qBittorrent (http://192.168.1.50:8080): Options → Downloads → Run external program on torrent finished = /config/ftl-on-complete.sh "%L" "%F" "%N", and create categories books (save path /downloads/torrents/books) and audiobooks (/downloads/torrents/audiobooks).
MyAnonamouse: keep the VPN address registered
MyAnonamouse needs to know the VPN's address. This script asks MAM to register it, running inside the qBittorrent container so it goes out through the VPN. The session ID (made under MAM → Preferences → Security, ASN-locked, "Allow dynamic seedbox" on) goes in /opt/docker/mega/qbittorrent/mam_id, readable by root only. Save as /opt/docker/mega/qbittorrent/mam-seedbox.sh:
#!/bin/bash
# Registers qBittorrent's VPN IP with MyAnonamouse (Dynamic Seedbox API). Runs inside the qbittorrent
# container (same network as Gluetun, so it calls from the VPN IP). Hourly via mam-seedbox.timer on docker-host.
# Session ID (MAM session "docker-host qBittorrent (NordVPN)", ASN locked, dynamic seedbox = yes) is in
# /config/mam_id; MAM may rotate the cookie, so the live value is kept in the cookie jar /config/mam.cookies.
# Never prints the session ID. Log: /config/mam-seedbox.log
JAR=/config/mam.cookies
ID=/config/mam_id
LOG=/config/mam-seedbox.log
URL=https://t.myanonamouse.net/json/dynamicSeedbox.php
umask 077
if [ -s "$JAR" ]; then
out=$(curl -s --max-time 30 -c "$JAR" -b "$JAR" "$URL")
else
[ -s "$ID" ] || { echo "$(date '+%F %T') no $ID" >> "$LOG"; exit 1; }
out=$(curl -s --max-time 30 -c "$JAR" -b "mam_id=$(tr -d ' \r\n' < "$ID")" "$URL")
fi
echo "$(date '+%F %T') $out" >> "$LOG"
tail -n 500 "$LOG" > "$LOG.tmp" && mv "$LOG.tmp" "$LOG"
case "$out" in
*'"Success":true'*|*'No Change'*) exit 0 ;;
*) exit 1 ;;
esacRun it every hour with a systemd timer:
chmod 700 /opt/docker/mega/qbittorrent/mam-seedbox.sh
cat > /etc/systemd/system/mam-seedbox.service <<'EOF'
[Unit]
Description=Register qBittorrent's VPN IP with MyAnonamouse (dynamic seedbox)
After=docker.service
Requires=docker.service
[Service]
Type=oneshot
ExecStart=/usr/bin/docker exec qbittorrent /config/mam-seedbox.sh
EOF
cat > /etc/systemd/system/mam-seedbox.timer <<'EOF'
[Unit]
Description=Hourly MyAnonamouse dynamic seedbox update
[Timer]
OnBootSec=10min
OnUnitActiveSec=1h
RandomizedDelaySec=5min
Persistent=true
[Install]
WantedBy=timers.target
EOF
systemctl daemon-reload
systemctl enable --now mam-seedbox.timer
sleep 5
tail -1 /opt/docker/mega/qbittorrent/mam-seedbox.logWhat you should see: {"Success":true,...} (or "No change").
Shelfmark: email members about their book requests
Shelfmark emails members when their request is approved or ready, but the Plex login doesn't tell it anyone's email address. This copies them from Authentik every hour. Save as /usr/local/sbin/shelfmark-email-sync.sh:
#!/bin/bash
# Copies members' email addresses from Authentik (where the Plex login stores them) into Shelfmark's
# user database, so Shelfmark's default member notification (mailto ...to={Email}) can reach them.
# Only fills in BLANK emails for usernames that exist in both; never overwrites, never prints addresses.
# docker-host: /usr/local/sbin/shelfmark-email-sync.sh, run hourly by shelfmark-email-sync.timer.
set -euo pipefail
DB=/opt/docker/mega/shelfmark/users.db
TMP=$(mktemp); trap 'rm -f "$TMP"' EXIT
chmod 600 "$TMP"
docker exec -i authentik-server ak shell 2>/dev/null > "$TMP" <<'P'
import json
from authentik.core.models import User
print("FTLJSON " + json.dumps({u.username: u.email for u in User.objects.filter(is_active=True) if u.email}))
P
python3 - "$DB" "$TMP" <<'P'
import json, sqlite3, sys
db, src = sys.argv[1], sys.argv[2]
line = next((l for l in open(src) if l.startswith("FTLJSON ")), None)
if line is None:
sys.exit("could not read users from Authentik")
emails = json.loads(line[len("FTLJSON "):])
c = sqlite3.connect(db, timeout=30)
n = 0
for uid, name in c.execute("select id, username from users where email is null or trim(email) = ''").fetchall():
if name in emails:
c.execute("update users set email = ? where id = ?", (emails[name], uid)); n += 1
c.commit()
total, with_email = c.execute("select count(*), sum(email is not null and trim(email) != '') from users").fetchone()
print(f"filled {n} email(s); {with_email or 0}/{total} Shelfmark users have an email")
Pchmod 700 /usr/local/sbin/shelfmark-email-sync.sh
cat > /etc/systemd/system/shelfmark-email-sync.service <<'EOF'
[Unit]
Description=Copy members' emails from Authentik into Shelfmark
After=docker.service
Requires=docker.service
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/shelfmark-email-sync.sh
EOF
cat > /etc/systemd/system/shelfmark-email-sync.timer <<'EOF'
[Unit]
Description=Hourly Authentik -> Shelfmark email sync
[Timer]
OnBootSec=15min
OnUnitActiveSec=1h
Persistent=true
[Install]
WantedBy=timers.target
EOF
systemctl daemon-reload
systemctl enable --now shelfmark-email-sync.timer
/usr/local/sbin/shelfmark-email-sync.shWhat you should see: filled N email(s); N/N Shelfmark users have an email.
Step 14: Final checks
docker ps --format 'table {{.Names}}\t{{.Status}}' | sort
systemctl list-timers mam-seedbox.timer shelfmark-email-sync.timer fstrim.timer --no-pager
df -h / /mnt/media- Websites: example.com, home.example.com (Plex login), cwa., calibre. and audiobooks. all load with a valid padlock.
- Uptime Kuma (
http://192.168.1.50:3001): everything green, and the members dashboard's Server status tile agrees. - Email: send a test from Kuma's notification settings and check it arrives from
noreply@example.com. - VPN:
docker exec qbittorrent curl -s https://ipinfo.io/ipshows the NordVPN address, never your home IP. - Backups: confirm the new VM is in pve's nightly backup job (Datacenter → Backup), and run one now (VM → Backup → Backup now).
Things I learned the hard way
- CPU type
host, or MySQL 8.4 won't start. - Proxy to apps over plain
httpinside the network; HTTPS belongs between the visitor and NPM. Pointing NPM athttpsgives "502 Bad Gateway". - Certificates by DNS challenge through Cloudflare. HTTP challenges fail quietly because port 80 isn't forwarded, and you find out months later.
- Plex "Allow friends" off in Authentik, or logins fail with error 410.
- Don't let apps auto-update past a tracker's allowed list; pin the version instead.
- Never keep passwords in the Proxmox notes field: anyone with Proxmox access can read them, and they're copied into every backup.
And that's docker-host: one VM, two Docker projects and a handful of small scripts, all of which can be rebuilt from this page and a backup.