# Deploy

The site is a static Hugo build served by nginx in one container
(`docker compose up -d --build`). Recommended hosting: an LXC on Proxmox, with
Caddy in front terminating TLS and reverse-proxying the domain.

## Prerequisites

1. The repo must be on Gitea (e.g. `git.kgva.ch/karim/kgva`). The `REPO` URL in
   `provision-lxc.sh` and `backend.repo` in `static/admin/config.yml` point there.

## Safe cutover (no downtime, with rollback)

1. On the Proxmox node, run (free CTID, **new/temporary** IP):
   ```
   CTID=141 IP=10.0.0.50/24 GW=10.0.0.1 BRIDGE=vmbr0 STORAGE=local-lvm \
     ./provision-lxc.sh
   ```
2. Test it directly:  `curl -I http://10.0.0.50:8080`
3. Point Caddy's upstream at the new IP (`deploy/Caddyfile`), reload Caddy,
   open the domain, click around.
4. Only once it's verified: stop/remove the **old** container
   (`pct stop <old> && pct destroy <old>`), or keep it a day as rollback.

This never deletes the live site before the replacement is proven.

## Updating later

```
pct exec <CTID> -- bash -lc 'cd /opt/kgva && git pull && docker compose up -d --build'
```
or wire a Gitea Action / webhook to run that on push (see ../ADMIN.md).
