diff --git a/README.md b/README.md index eb808a2..3c2bb4a 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,29 @@ reach the live DB automatically. Enter Qobuz / Soulseek / Last.fm credentials in **Settings** (they persist across rebuilds), then follow an artist or request an album to feed The Floor. +## Deploying to a server (pre-built images) + +For a server that should **pull** rather than build, the `web` and `worker` images are +published to the Gitea container registry and consumed by a compose file in the +[`vm-download`](https://git.jger.nl/Jonathan/vm-download) ops repo (`docker/lyra/`). + +Publish a new release from this repo (amd64): + +```sh +docker login git.jger.nl # once — Gitea user + a token with package:write +./scripts/build-push.sh # builds + pushes lyra-web / lyra-worker (:latest and :) +``` + +Then on the server: + +```sh +cd /opt/git/vm-download && git pull +cd docker/lyra && docker compose pull && docker compose up -d +``` + +`db` (Postgres) and `db-backup` use the stock `postgres:17` image, so only the two custom +images are built here. See `docker/lyra/README.md` in the ops repo for first-time setup. + ## Managing the library Open an album on the **Library** page and use **Delete album** to remove it: the folder is diff --git a/scripts/build-push.sh b/scripts/build-push.sh new file mode 100755 index 0000000..5c1e975 --- /dev/null +++ b/scripts/build-push.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# Build the Lyra web + worker images and push them to the Gitea container registry, so the VM +# can pull pre-built images instead of building from source. +# +# Usage (from the Lyra repo root): +# docker login git.jger.nl # once — Gitea username + a token with package:write +# ./scripts/build-push.sh # builds + pushes :latest and : +# +# Override the registry namespace with LYRA_REGISTRY (default git.jger.nl/jonathan). +set -euo pipefail + +REGISTRY="${LYRA_REGISTRY:-git.jger.nl/jonathan}" +here="$(cd "$(dirname "$0")/.." && pwd)" +sha="$(git -C "$here" rev-parse --short HEAD)" + +for svc in web worker; do + img="$REGISTRY/lyra-$svc" + echo "==> building $img ($sha)" + docker build -t "$img:latest" -t "$img:$sha" "$here/$svc" +done + +for svc in web worker; do + img="$REGISTRY/lyra-$svc" + echo "==> pushing $img:latest and $img:$sha" + docker push "$img:latest" + docker push "$img:$sha" +done + +echo "Done. Pulled on the VM with: docker compose pull && docker compose up -d"