J Jack Develops
All writing
devops October 15, 2026 4 min read

Maintaining and Deploying This VM Part 2

Revisiting how I maintain and deploy here

Overview

So previously I wrote about how I deployed https://jack-develops.com. That process has changed quite a bit now. Here's how it works today.

Infrastructure

So previously I was using DigitalOcean for my provider to compute. Well I found a new provider, OVHCloud, and they offer pretty cheap VPSs (Virtual Private Servers). The reason VPSs can be cheap is due to the lack of guarantees on the compute you're going to get. Such as a noisy neighbor (another VPS you're sharing the hardware with) can negatively impact your share of the hardware.

The change to OVH's cheapest VPS at ~5.50 USD a month comes with 2 vCPU and 4 GBs of RAM. Which is a big upgrade from the 1 CPU and 512 MBs of RAM. This lets me have more room to run stuff like Postgres, Podman, and a telemetry stack (Loki, Grafana, OpenTelemetry -> OTEL).

The VM runs rootful Podman and podman-compose. Caddy is still the reverse proxy and still the only thing listening on 80/443.

Everything shared lives in compose I call platform. This consists of: Caddy, Postgres, and the telemetry stack. Apps are separate compose projects. They connect over three Podman networks:

  • edge for Caddy and HTTP-serving apps
  • data for Postgres and apps that use it
  • observability for the telemetry stack and apps that report to it

Postgres binds to 127.0.0.1:5432 only. Grafana publishes no port at all, so I reach it through an SSH tunnel.

Platform Compose

The platform is one compose.yaml. The same file runs locally and on the VM. The differences come from a variety of .env files.

# platform/compose.yaml
name: platform

services:
  caddy:
    image: caddy:2-alpine
    ports:
      - "${CADDY_HTTP_PORT:-80}:${CADDY_HTTP_CONTAINER_PORT:-80}"
      - "${CADDY_HTTPS_PORT:-443}:${CADDY_HTTPS_CONTAINER_PORT:-443}"
    volumes:
      - ./caddy:/etc/caddy:ro
      - ./caddy/${CADDYFILE:-Caddyfile}:/etc/caddy/Caddyfile:ro
    networks: [edge]

In production the files live under /srv/platform. In platform/.env I keep the Postgres password, Grafana password, Caddyfile name, ports, and data paths. Nothing else needs to know those values.

On the VM the layout is:

/srv/platform/       # platform compose, .env, Caddyfile
/srv/apps/<app>/     # app compose, .env, env/, data/
/srv/backup/         # Postgres dumps

Setting up or converging the platform is one command:

./scripts/setup.sh ovh

What's ovh? The script has different parameters right now just local and ovh. Ovh being the VM on OVHCloud and local being my machine.

That installs Podman, creates the networks and directories, generates secrets if they're missing, copies the platform files, installs the systemd unit, and starts everything. The script is idempotent.

To upgrade the platform to the pinned versions found in versions.env

./scripts/upgrade.sh ovh

Caddy has a global Caddyfile that imports sites.caddy. Local uses Caddyfile.local instead. Adding a site means adding a block to sites.caddy, then reloading:

sudo podman exec caddy caddy validate --config /etc/caddy/Caddyfile
sudo podman exec caddy caddy reload --config /etc/caddy/Caddyfile

A weekly timer prunes old images, and Postgres dumps land in /srv/backup.

App Composes

Apps are not listed in the platform compose. Each app owns its deployment under <app>/deployment/.

<app>/
├── Dockerfile
└── deployment/
    ├── compose.yaml
    ├── deploy_local.sh
    ├── deploy_ovh.sh
    ├── systemd/app-<project>-compose.service
    └── env/app.env.example

The compose file is small. It says what to run, which networks to join, and where config comes from.

# blue_mint/deployment/compose.yaml
name: blue-mint

services:
  blue-mint:
    image: blue_mint:${IMAGE_TAG}
    container_name: blue-mint
    restart: unless-stopped
    env_file: [./env/app.env]
    networks: [edge]
    mem_limit: 512m
    security_opt: [no-new-privileges:true]
    logging:
      driver: k8s-file
      options:
        max-size: "15m"

networks:
  edge:
    external: true

No published ports. Caddy reaches the app over edge.

There are two env files with similar names, and they do different jobs:

  • .env next to the compose file holds IMAGE_TAG. The deploy script writes this.
  • env/app.env holds app config and secrets like DATABASE_URL, SECRET_KEY_BASE, and PHX_HOST. It's mode 0600 and never committed. Commit only the .example.

The compose file stays the same for both deployed environments (local or production -> ovh). The real /srv/apps/<app>/env/app.env only exists on the VM.

Apps that need migrations add a one-shot migrate service under the tools profile. The deploy script runs it before starting the app.

Deploying Sites

Deploying is now build locally, ship the image, and let compose run it:

./blue_mint/deployment/deploy_ovh.sh

Under the hood the app scripts mostly do the same thing:

  1. Build linux/amd64 on my Apple Silicon machine.
  2. podman save the image and pipe it into podman load on the VM.
    1. This avoids having to host a registry since we can just ship over a tarball now via SCP
  3. Update IMAGE_TAG in /srv/apps/<app>/.env.
  4. Run the migrate service if the app has one.
  5. Run podman-compose up -d.
  6. Install and enable the app's systemd unit.
  7. Smoke test the public URL.

The important part is that the VM usually doesn't build anything. It loads and runs an image. No Elixir, Erlang, Node, or compiler toolchain on the host. Lumpy is the exception. Its Rust engine can't build through QEMU on my Mac, so that script syncs source and builds on the VM instead.

container_build linux/amd64 -f "$APP_DIR/Dockerfile" -t "$IMAGE:$TAG" "$APP_DIR"
container_export "$IMAGE:$TAG" | ssh -T "$OVH_HOST" 'sudo -n podman load'

Each app has a systemd oneshot unit that requires platform-compose.service. So on boot the platform comes up first, then the apps.

Local

Local has the same shape. The platform is still Caddy and Postgres, the apps are still their own composes, and the app compose files don't change.

./scripts/setup.sh local
cd blue_mint
./deployment/deploy_local.sh

Local Caddy serves http://blue-mint.localhost:8080, Postgres is on 127.0.0.1:5432, and the telemetry stack runs too. Grafana is at http://grafana.localhost:8080, and Mailpit catches alert emails instead of sending them.

Wrapping Up

The old flow was ship source to a tiny VM and compile it there. The new flow is build an image using the --platform flag, ship the image, and run it via compose up.

That removes the usage for build toolchains. The VM is still just one cheap box with systemd and compose.

If I had more memory I would think about leveraging K3s but that would take another 1GB of RAM and I also don't have any traffic to this VM, so its not like I need scaling.

As of writing right now the machine has 1.8 GBs of memory available.