fix(update): isolate service restart handoff
This commit is contained in:
1 parent
9abc976330
commit
401913fffa
2 files changed
+45
-1
No files matched your search
+2
-1
@@ -172,8 +172,9 @@ echo "==> Building archied and archie-agent..."
|
||||
RUNTIME_VERSION="$(git describe --tags --match 'archie/v*' 2>/dev/null | sed 's|^archie/v||' || echo dev)"
|
||||
go build -ldflags "-X main.gatewayVersion=${GATEWAY_VERSION} -X main.runtimeVersion=${RUNTIME_VERSION} -X github.com/samcharles93/archie-core/internal/installtype.buildType=binary" -o "${ARCHIE_BIN_DIR}/archied" ./cmd/archied
|
||||
go build -o "${ARCHIE_BIN_DIR}/archie-agent" ./cmd/archie-agent
|
||||
install -m755 "${SRC_DIR}/scripts/archie-update-install" "${ARCHIE_BIN_DIR}/archie-update-install"
|
||||
)
|
||||
echo " Installed binaries to ${ARCHIE_BIN_DIR}/"
|
||||
echo " Installed binaries and updater to ${ARCHIE_BIN_DIR}/"
|
||||
|
||||
# 5. Interactive Configuration: Forge & LLM Provider Setup
|
||||
if [ ! -f "${ENV_FILE}" ]; then
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
# archie-update-install -- update installation adapter for archied's /update.
|
||||
#
|
||||
# archied runs this via CommandInstaller after the operator approves, and
|
||||
# captures CombinedOutput, so everything printed here reaches the chat on
|
||||
# failure. It is exec'd directly, without a shell.
|
||||
#
|
||||
# The restart is queued through a separate transient systemd unit. The
|
||||
# installer is a child of archied.service; restarting that unit directly
|
||||
# would make systemd kill this process before CommandInstaller can observe a
|
||||
# successful exit.
|
||||
set -euo pipefail
|
||||
|
||||
REPO="${ARCHIE_REPO_DIR:-$HOME/projects/archie-core}"
|
||||
BIN_DIR="${ARCHIE_BIN_DIR:-$HOME/.local/bin}"
|
||||
export PATH="/usr/local/go/bin:$PATH"
|
||||
|
||||
cd "$REPO"
|
||||
echo "==> fetching"
|
||||
git pull --ff-only
|
||||
|
||||
GW="$(git describe --tags --match 'archied/v*' | sed 's|^archied/v||')"
|
||||
RT="$(git describe --tags --match 'archie/v*' | sed 's|^archie/v||')"
|
||||
echo "==> building archied $GW / archie-agent $RT"
|
||||
|
||||
tmp="$(mktemp -d)"
|
||||
trap 'rm -rf "$tmp"' EXIT
|
||||
|
||||
go build -ldflags "-X main.gatewayVersion=$GW -X main.runtimeVersion=$RT -X github.com/samcharles93/archie-core/internal/installtype.buildType=binary" \
|
||||
-o "$tmp/archied" ./cmd/archied
|
||||
go build -o "$tmp/archie-agent" ./cmd/archie-agent
|
||||
|
||||
echo "==> installing"
|
||||
install -m755 "$tmp/archied" "$BIN_DIR/archied"
|
||||
install -m755 "$tmp/archie-agent" "$BIN_DIR/archie-agent"
|
||||
|
||||
echo "==> rebuilding agent image"
|
||||
docker compose build agent
|
||||
|
||||
echo "==> restarting (queued in a separate transient unit)"
|
||||
systemd-run --user --unit=archied-update-restart --collect --quiet \
|
||||
/usr/bin/systemctl --user restart --no-block archied.service
|
||||
echo "update applied: archied $GW, archie-agent $RT"
|
||||
Reference in new issue
Block a user