Skip to content

2. Provisioning pretzel-vm on Proxmox, and Making It Survive a Reboot

The course’s path vs. what I actually did

Section titled “The course’s path vs. what I actually did”

The course provisions a VirtualBox VM by clicking through Ubuntu’s installer. I already run a Proxmox host, so instead I wrote a qm-based bash script and ran it directly against Proxmox over SSH — no GUI, no installer wizard. Same end result (pretzel-vm, Ubuntu, a devops user), different tooling: qm create for the VM shell, qm importdisk for the cloud image, a cloud-init snippet handling the user, SSH key, and password hash before the VM ever boots, and a static IP on my homelab’s own VLAN rather than a VirtualBox host-only network.

Two things cost real time getting this right: the password hash has to be generated once with openssl passwd -6 and pasted in as-is (re-hashing it produces a hash that silently doesn’t match), and Proxmox’s --cicustom flag overrides its own --ciuser/--cipassword flags without warning — once you’re pointing cloud-init at your own YAML, the identity has to live entirely in that file.

Why a terminal session isn’t a deployment

Section titled “Why a terminal session isn’t a deployment”

Lesson 1 ran the stack in SSH-session terminal tabs. Close that session and every process dies with the shell — nohup and tmux paper over this without solving it; neither restarts a crashed process or starts anything on boot. systemd is the actual fix: it’s already on the machine, and starting, restarting, and logging services is what it’s built for.

Both the API and the built frontend got their own systemd unit — Restart=on-failure so a crash gets a restart, EnvironmentFile so config comes from the system rather than a library reading .env at runtime, and a wrapper that explicitly sources nvm since systemd doesn’t read interactive shell startup files.

The actual test wasn’t systemctl status looking healthy right after starting it — it was sudo reboot, waiting, SSHing back in, and finding both services already active (running) with zero manual intervention. If you have to log in and start something after a reboot, nothing was actually deployed.

A real CORS bug, caused by a file permission

Section titled “A real CORS bug, caused by a file permission”

Opening the app from the VM’s IP threw a CORS error in the browser console — the backend’s .env still had CORS_ORIGIN set to localhost from Lesson 1. Trying to fix it, the file opened read-only in the editor: it was owned by root, with the devops group only holding read access, not write. Fixed with chown, updated the origin to the VM’s actual IP, and restarted the service — env vars are only read at process start, so editing the file alone does nothing until the process restarts.

Plenty of real companies in the 10-50 person range still run exactly this pattern: a systemd service, an EnvironmentFile, and a deploy script that’s effectively git pull && systemctl restart. Not elegant, but it holds up for years. The actual weaknesses are operational, not technical — deploying means SSHing in by hand, scaling means repeating the setup on another VM. Containers, CI/CD, and infrastructure as code each solve one of those, starting next lesson.


Next: Lesson 3, Web Servers and Automation.