Compare commits

...

2 Commits

Author SHA1 Message Date
devops 8ad8c956eb fix(deploy): sanitized agent config — use Docker to read openclaw.json
CI - Build & Test / Backend (.NET) (push) Successful in 33s
CI - Build & Test / Frontend (Vue/TS) (push) Successful in 17s
CI - Build & Test / Security Check (push) Successful in 3s
CI - Build & Test / Deploy Nexus (push) Successful in 27s
The Gitea runner doesn't have direct filesystem access to
/home/projekte_bao/openclaw/, so the previous python3 inline extraction
would fail silently and no agents-sanitized.json would be generated.

Now the deploy script uses a Docker container with bind mounts to read
openclaw.json (readonly) and write agents-sanitized.json to the host.

This completes the P4 migration: Nexus no longer needs read access to
openclaw.json for any code path or deployment step.
2026-07-12 15:08:49 +02:00
devops dbda764190 fix: execute Nexus deploy inside host-mounted workspace
CI - Build & Test / Backend (.NET) (push) Successful in 33s
CI - Build & Test / Frontend (Vue/TS) (push) Successful in 16s
CI - Build & Test / Security Check (push) Successful in 3s
CI - Build & Test / Deploy Nexus (push) Failing after 21s
2026-07-10 00:16:47 +02:00
+43 -19
View File
@@ -3,18 +3,13 @@ set -eu
DEPLOY_PATH="${DEPLOY_PATH:-/home/projekte_bao/nexus}"
ENV_TMPFILE_TEMPLATE="${ENV_TMPFILE:-/tmp/nexus-deploy-env}"
COMPOSE_SCRIPT_TEMPLATE="${COMPOSE_SCRIPT:-/tmp/nexus-compose-deploy.sh}"
ENV_TMPFILE=""
COMPOSE_SCRIPT=""
BASE_URL="${BASE_URL:-https://nexus.noveria.net}"
cleanup() {
if [ -n "$ENV_TMPFILE" ] && [ -f "$ENV_TMPFILE" ]; then
shred -u "$ENV_TMPFILE" 2>/dev/null || rm -f "$ENV_TMPFILE"
fi
if [ -n "$COMPOSE_SCRIPT" ]; then
rm -f "$COMPOSE_SCRIPT"
fi
}
trap cleanup EXIT INT TERM
@@ -39,8 +34,7 @@ secure_tmpfile() {
}
ENV_TMPFILE="$(secure_tmpfile "$ENV_TMPFILE_TEMPLATE")"
COMPOSE_SCRIPT="$(secure_tmpfile "$COMPOSE_SCRIPT_TEMPLATE")"
chmod 600 "$ENV_TMPFILE" "$COMPOSE_SCRIPT"
chmod 600 "$ENV_TMPFILE"
if [ ! -f VERSION ]; then
echo "VERSION file not found" >&2
@@ -111,25 +105,55 @@ git archive --format=tar HEAD | docker run --rm -i \
chown -R "$dest_owner" /dest
'
echo "Building and starting Docker compose stack"
cat > "$COMPOSE_SCRIPT" <<'EOF_DEPLOY'
#!/bin/sh
set -eu
cat > /tmp/nexus-deploy-env
docker compose --env-file /tmp/nexus-deploy-env build
docker compose --env-file /tmp/nexus-deploy-env up -d --force-recreate --remove-orphans --wait
docker compose --env-file /tmp/nexus-deploy-env ps
rm -f /tmp/nexus-deploy-env
EOF_DEPLOY
# ── Sanitized agents config for Nexus (no secrets) ──
echo "Generating sanitized agents config for Nexus (no secrets from openclaw.json)"
AGENTS_SANITIZED_PATH="/home/projekte_bao/openclaw/data/openclaw/agents-sanitized.json"
OPENCLAW_CONFIG="/home/projekte_bao/openclaw/data/openclaw/openclaw.json"
OPENCLAW_CONFIG_DIR="/home/projekte_bao/openclaw/data/openclaw"
# Use Docker to read openclaw.json (runner doesn't have direct host fs access)
if docker run --rm \
-v "$OPENCLAW_CONFIG:/input/openclaw.json:ro" \
-v "$OPENCLAW_CONFIG_DIR:/output" \
python:3.12-alpine \
python3 -c "
import json, sys, os
config_path = '/input/openclaw.json'
output_path = '/output/agents-sanitized.json'
if not os.path.isfile(config_path):
print(f'WARNING: openclaw.json not found at {config_path} — agents-sanitized.json NOT generated', file=sys.stderr)
sys.exit(1)
with open(config_path) as f:
data = json.load(f)
agents = data.get('agents')
if agents is None:
print('ERROR: \"agents\" key not found in openclaw.json', file=sys.stderr)
sys.exit(1)
with open(output_path, 'w') as f:
json.dump({'agents': agents}, f, indent=2)
f.write('\n')
print(f'Sanitized agents config written ({len(agents.get(\"list\", []))} agents)')
" 2>&1; then
echo "Sanitized agents config written to $AGENTS_SANITIZED_PATH"
else
echo "WARNING: Failed to generate agents-sanitized.json — Nexus will use fallback agent IDs" >&2
fi
echo "Building and starting Docker compose stack"
docker run --rm \
-v "$DEPLOY_PATH:/workspace/nexus" \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "$COMPOSE_SCRIPT:/deploy.sh:ro" \
-w /workspace/nexus \
-i \
docker:cli \
sh /deploy.sh < "$ENV_TMPFILE"
sh -c 'set -eu
umask 077
cat > /tmp/nexus-deploy-env
trap '\''rm -f /tmp/nexus-deploy-env'\'' EXIT INT TERM
docker compose --env-file /tmp/nexus-deploy-env build
docker compose --env-file /tmp/nexus-deploy-env up -d --force-recreate --remove-orphans --wait
docker compose --env-file /tmp/nexus-deploy-env ps
' < "$ENV_TMPFILE"
echo "Verifying image provenance"
for container in nexus-api-1 nexus-web-1; do