From b565efe9d123da8dc351e36078ca14f480b03bb4 Mon Sep 17 00:00:00 2001 From: Astra Date: Sun, 13 Sep 2026 22:11:54 +0100 Subject: [PATCH] build.sh: restart via systemd instead of managing containers directly owpengram-server and owpengram-admin are now systemd-managed units; build.sh no longer needs to podman create/start them itself, just build the image and restart the two services so they pick up the new image. The pod itself still isn't systemd's job, so build.sh keeps ensuring it exists first. Co-Authored-By: Claude Sonnet 5 --- build.sh | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/build.sh b/build.sh index 54f9dbc7..85bcb314 100755 --- a/build.sh +++ b/build.sh @@ -1,12 +1,15 @@ #!/usr/bin/env bash # Build the owpengram-server container image (stamping the current git state into # the binary - .containerignore excludes .git, so go build can't see the repo and -# the values are passed in here), then recreate and start the pod containers. +# the values are passed in here), then restart the owpengram-server and +# owpengram-admin systemd services so they pick up the freshly built image. +# Container creation/lifecycle beyond the pod itself is owned by those systemd +# units, not this script. # # Usage: ./build.sh [extra podman build args...] # IMAGE=my/tag ./build.sh override the image tag (default: owpengram-server) # POD=name ./build.sh override the pod name (default: owpengram) -# NO_DEPLOY=1 ./build.sh build the image only, don't touch containers +# NO_DEPLOY=1 ./build.sh build the image only, don't restart the services set -euo pipefail cd "$(dirname "$0")" @@ -24,7 +27,7 @@ podman build \ . if [ "${NO_DEPLOY:-0}" = "1" ]; then - echo "built $IMAGE (NO_DEPLOY=1, containers unchanged)" + echo "built $IMAGE (NO_DEPLOY=1, services unchanged)" exit 0 fi @@ -39,18 +42,6 @@ if ! podman pod exists "$POD"; then -p 12400:12400/udp \ -p 12500-12999:12500-12999/udp fi -if [ ! -f .env ]; then - echo "error: .env not found (containers are created with --env-file .env)" >&2 - exit 1 -fi -podman create --replace --pod "$POD" --name owpengram-server --restart unless-stopped \ - --pull never --env-file .env -v owpengram_serverdata:/data \ - "$IMAGE" - -podman create --replace --pod "$POD" --name owpengram-admin --restart unless-stopped \ - --pull never --env-file .env --entrypoint /app/telesrv-admin \ - "$IMAGE" - -podman start owpengram-server owpengram-admin -podman ps --pod --filter "pod=$POD" --format 'table {{.Names}} {{.Status}} {{.Image}}' +systemctl restart owpengram-server.service owpengram-admin.service +systemctl --no-pager status owpengram-server.service owpengram-admin.service