deploy: worker image COPY simplification, web-dist mount, alarm build flow

This commit is contained in:
Raphael Westphal
2026-08-18 14:59:25 +02:00
parent 4949b40f1c
commit bcd976a8ac
3 changed files with 23 additions and 14 deletions
+20 -11
View File
@@ -1,23 +1,32 @@
#!/usr/bin/env bash
# Deploy lvmh to alarm over ssh (tailnet). Source is rsynced; compose builds there.
# Deploy lvmh to alarm over ssh (tailnet). rsync source, build images there,
# compose up. Requires .env on the remote (created on first run).
set -euo pipefail
REMOTE="${1:-alarm}"
REMOTE_DIR="${2:-/zdata/root/dockerFiles/lvmh}"
if ! ssh "$REMOTE" "test -f $REMOTE_DIR/.env" 2>/dev/null; then
echo "ERROR: $REMOTE:$REMOTE_DIR/.env missing. Create it first (see .env.example):"
echo " ssh $REMOTE 'mkdir -p $REMOTE_DIR && cat > $REMOTE_DIR/.env' <<EOF
LVMH_TOKEN=...
ZAI_RENAUD_API_KEY=...
EOF"
exit 1
echo "ERROR: $REMOTE:$REMOTE_DIR/.env missing. Create it first (see .env.example):"
echo " ssh $REMOTE 'mkdir -p $REMOTE_DIR && nano $REMOTE_DIR/.env'"
echo " # LVMH_TOKEN=<random>, ZAI_RENAUD_API_KEY=<key>"
exit 1
fi
# web/dist must exist (daemon serves it)
if [ ! -f web/dist/index.html ]; then
echo "building web/dist first..."
(cd web && bun install && bun run build)
fi
rsync -az --delete \
--exclude .git --exclude node_modules --exclude web/dist \
--exclude .env --exclude .scratch --exclude .pi \
./ "$REMOTE:$REMOTE_DIR/"
--exclude .git --exclude node_modules --exclude web/node_modules \
--exclude .env --exclude .scratch --exclude .pi --exclude coverage \
./ "$REMOTE:$REMOTE_DIR/"
ssh "$REMOTE" "cd $REMOTE_DIR && docker compose build lvmh && docker compose up -d && docker compose ps"
echo "building daemon image + worker image on $REMOTE..."
ssh "$REMOTE" "cd $REMOTE_DIR \
&& docker build -q -f daemon/Dockerfile -t lvmh-daemon:latest . \
&& docker build -q -f docker/worker.Dockerfile -t lvmh-worker:latest . \
&& docker compose up -d && docker compose ps"
echo "Deployed: http://$REMOTE:8686"