#!/usr/bin/env bash # Install rein-aharness claim-loop as a user systemd service (railiance01). # Run from a rein-aharness checkout ON the host: # ./deploy/scripts/install-claim-loop-user.sh set -euo pipefail ROOT="$(cd "$(dirname "$0")/../.." && pwd)" UNIT_DIR="${HOME}/.config/systemd/user" ENV_DIR="${HOME}/.config/rein-aharness" BIN_DIR="${HOME}/bin" mkdir -p "${UNIT_DIR}" "${ENV_DIR}" "${BIN_DIR}" cp -f "${ROOT}/deploy/systemd/rein-aharness-claim-loop.service" "${UNIT_DIR}/" # Durable env loader + k8s:// ClusterIP resolution (no port-forward) install -m 755 "${ROOT}/deploy/scripts/rein-aharness-claim" "${BIN_DIR}/rein-aharness-claim" if [[ ! -f "${ENV_DIR}/claim-loop.env" ]]; then cp "${ROOT}/deploy/systemd/claim-loop.env.example" "${ENV_DIR}/claim-loop.env" chmod 600 "${ENV_DIR}/claim-loop.env" echo "Created ${ENV_DIR}/claim-loop.env — set ACTIVITY_CORE_WORKER_TOKEN and REPO_MAP paths." else echo "Keeping existing ${ENV_DIR}/claim-loop.env" echo " Tip: migrate URLs with ${ROOT}/deploy/scripts/refresh-claim-loop-k8s-urls.sh" fi # Ensure package entrypoint exists if [[ ! -x "${ROOT}/.venv/bin/rein-aharness" ]]; then echo "warning: ${ROOT}/.venv/bin/rein-aharness missing; install the worker environment first" elif ! "${ROOT}/.venv/bin/python" -c 'import glas_harness, sandboxer' >/dev/null 2>&1; then echo "warning: profiled ops runs require sibling runtimes; install with:" echo " ${ROOT}/.venv/bin/pip install -e ${ROOT}/../sand-boxer -e ${ROOT}/../glas-harness" fi systemctl --user daemon-reload systemctl --user enable rein-aharness-claim-loop.service echo "Enabled. Start when env is filled:" echo " systemctl --user start rein-aharness-claim-loop.service" echo " journalctl --user -u rein-aharness-claim-loop -f" echo "llm-connect / actcore-api: use k8s:// URLs (see activity-core docs/llm-connect-host-access.md)." echo "Do not rely on kubectl port-forward for production claim-loop."