The chat left with NATS at the move to 1.0. uhhm/kino 0.1.2 has an image now, so it comes back as a service under the profile `chat`: it shares the site's network namespace like gdo and kron, dials the site over dhd/1, signs people in at Rauthy as the client `chat`, listens on 3070 (the host Caddy's samtaler.tomtervel.no block already points there) and keeps its history in kino_data. The deploy takes CHAT_HOST, KINO_RELEASE and the secret CHAT_OAUTH2_CLIENT_SECRET, refuses the profile without them, and writes kino.env; deploy-tomtervel puts that file in place. README.md, "The chat", has the four steps, the last being kino's key into DHD_KEYS. Nothing changes until COMPOSE_PROFILES has `chat`: the profile keeps the service out, and the new published port (3070) has nothing behind it. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L5fbDjRr9xfrtcDzcdJNr2
59 lines
2.2 KiB
Bash
59 lines
2.2 KiB
Bash
#!/usr/bin/env bash
|
|
# Tomter Vel's stack, brought up from its own repo. This is the whole of
|
|
# what CI may do as root for the vel: pull main, put the env files the
|
|
# deploy workflow wrote in place, and bring the compose project up. It
|
|
# takes no arguments, so there is nothing for a workflow to point
|
|
# somewhere else.
|
|
#
|
|
# The env files come from the repo's and org's Actions variables and
|
|
# secrets: the workflow writes them, as the runner, into $stage (the
|
|
# runner's own, 0700), and this script moves them into the checkout as
|
|
# root's, 0600, and leaves nothing behind in $stage.
|
|
#
|
|
# Install: sudo install -m 0755 -o root -g root \
|
|
# deploy-tomtervel /usr/local/bin/deploy-tomtervel
|
|
# Grant: gitea-runner ALL=(root) NOPASSWD: /usr/local/bin/deploy-tomtervel
|
|
set -euo pipefail
|
|
|
|
root=/srv/tomtervel/infrastructure
|
|
stage=/var/lib/gitea-runner/tomtervel-env
|
|
files=(.env portal.env)
|
|
# Written only when the site runs what needs it (Rauthy, the money
|
|
# service under the pay profile, the chat under the chat profile).
|
|
optional=(rauthy.env kron.env kino.env)
|
|
|
|
[ -d "$root/.git" ] || { echo "no checkout at $root - bootstrap it first" >&2; exit 1; }
|
|
for f in "${files[@]}"; do
|
|
[ -s "$stage/$f" ] || { echo "no $stage/$f - the deploy workflow writes it" >&2; exit 1; }
|
|
done
|
|
cd "$root"
|
|
|
|
git fetch --quiet origin main
|
|
git reset --hard --quiet origin/main
|
|
|
|
for f in "${files[@]}"; do
|
|
install -m 0600 -o root -g root "$stage/$f" "$root/$f"
|
|
rm -f "$stage/$f"
|
|
done
|
|
for f in "${optional[@]}"; do
|
|
[ -s "$stage/$f" ] || continue
|
|
install -m 0600 -o root -g root "$stage/$f" "$root/$f"
|
|
rm -f "$stage/$f"
|
|
done
|
|
|
|
# --build so a bumped PORTAL_RELEASE or GDO_RELEASE is actually fetched.
|
|
podman compose up -d --build
|
|
|
|
# The vel's portal, reached the way the host Caddy reaches it. No
|
|
# forwarded header on purpose: a check that sends the one Caddy sends
|
|
# cannot tell you the site is broken for everything that is not Caddy.
|
|
code=000
|
|
for n in $(seq 1 30); do
|
|
code=$(curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:3050/ || true)
|
|
[ "$code" = 200 ] && break
|
|
sleep 2
|
|
done
|
|
podman compose ps --format '{{.Names}} {{.State}}' || true
|
|
echo "portal http $code after $((n * 2))s"
|
|
[ "$code" = 200 ]
|