feat(flows): add update_mcp_worker flow with git_status, force-recreate, and health check
- update_mcp_worker.yml: git_status -> git_fetch -> git_pull (all cwd=scrum4me-docker) -> docker_compose_build -> docker_compose_up_recreate -> wait_for_health_worker - commands.yml.example: add docker_compose_up_recreate (--force-recreate) and wait_for_health_worker (polls /var/log/agent/current for 'pre-flight passed') Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9f590f1732
commit
6bee8e8741
2 changed files with 31 additions and 9 deletions
|
|
@ -117,6 +117,16 @@ commands:
|
||||||
- ops-dashboard
|
- ops-dashboard
|
||||||
description: "Start or recreate a docker compose service in detached mode"
|
description: "Start or recreate a docker compose service in detached mode"
|
||||||
|
|
||||||
|
docker_compose_up_recreate:
|
||||||
|
cmd: ["docker", "compose", "up", "-d", "--force-recreate"]
|
||||||
|
cwd: "/srv/scrum4me/compose"
|
||||||
|
args:
|
||||||
|
allowed:
|
||||||
|
- scrum4me-web
|
||||||
|
- worker-idea
|
||||||
|
- ops-dashboard
|
||||||
|
description: "Force-recreate a docker compose service (picks up a rebuilt image)"
|
||||||
|
|
||||||
git_pull:
|
git_pull:
|
||||||
cmd: ["git", "pull", "--ff-only"]
|
cmd: ["git", "pull", "--ff-only"]
|
||||||
cwd_pattern: "/srv/"
|
cwd_pattern: "/srv/"
|
||||||
|
|
@ -163,6 +173,13 @@ commands:
|
||||||
cwd: "/srv/scrum4me/compose"
|
cwd: "/srv/scrum4me/compose"
|
||||||
description: "Verify worker-idea container is in the running state"
|
description: "Verify worker-idea container is in the running state"
|
||||||
|
|
||||||
|
wait_for_health_worker:
|
||||||
|
cmd:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- "timeout 60 sh -c 'until grep -q \"pre-flight passed\" /var/log/agent/current 2>/dev/null; do sleep 3; done && echo \"pre-flight passed\"'"
|
||||||
|
description: "Wait up to 60s for MCP worker pre-flight check (/var/log/agent/current)"
|
||||||
|
|
||||||
# ── Scrum4Me web deployment steps ────────────────────────────────────────
|
# ── Scrum4Me web deployment steps ────────────────────────────────────────
|
||||||
|
|
||||||
npm_ci:
|
npm_ci:
|
||||||
|
|
|
||||||
|
|
@ -2,30 +2,35 @@
|
||||||
# Copy to /etc/ops-agent/flows/update_mcp_worker.yml on the host.
|
# Copy to /etc/ops-agent/flows/update_mcp_worker.yml on the host.
|
||||||
#
|
#
|
||||||
# Steps:
|
# Steps:
|
||||||
# 1. Fetch remote refs
|
# 1. Show current git status (informational)
|
||||||
# 2. Fast-forward pull (aborts if working tree is dirty)
|
# 2. Fetch remote refs
|
||||||
# 3. Rebuild the Docker image
|
# 3. Fast-forward pull (aborts if working tree is dirty)
|
||||||
# 4. Recreate the container in detached mode
|
# 4. Rebuild the Docker image
|
||||||
# 5. Verify the container is running
|
# 5. Recreate the container in detached mode (force-recreate picks up new image)
|
||||||
|
# 6. Wait for worker pre-flight to pass (checks /var/log/agent/current)
|
||||||
|
|
||||||
name: Update MCP Worker
|
name: Update MCP Worker
|
||||||
description: Pull latest code, rebuild Docker image, and restart the MCP worker service
|
description: Pull latest code, rebuild Docker image, and restart the MCP worker service
|
||||||
steps:
|
steps:
|
||||||
|
- command_key: git_status
|
||||||
|
args: ["/srv/scrum4me/repos/scrum4me-docker"]
|
||||||
|
on_failure: continue
|
||||||
|
|
||||||
- command_key: git_fetch
|
- command_key: git_fetch
|
||||||
args: ["/srv/scrum4me"]
|
args: ["/srv/scrum4me/repos/scrum4me-docker"]
|
||||||
on_failure: abort
|
on_failure: abort
|
||||||
|
|
||||||
- command_key: git_pull
|
- command_key: git_pull
|
||||||
args: ["/srv/scrum4me"]
|
args: ["/srv/scrum4me/repos/scrum4me-docker"]
|
||||||
on_failure: abort
|
on_failure: abort
|
||||||
|
|
||||||
- command_key: docker_compose_build
|
- command_key: docker_compose_build
|
||||||
args: ["worker-idea"]
|
args: ["worker-idea"]
|
||||||
on_failure: abort
|
on_failure: abort
|
||||||
|
|
||||||
- command_key: docker_compose_up
|
- command_key: docker_compose_up_recreate
|
||||||
args: ["worker-idea"]
|
args: ["worker-idea"]
|
||||||
on_failure: abort
|
on_failure: abort
|
||||||
|
|
||||||
- command_key: docker_compose_ps_worker
|
- command_key: wait_for_health_worker
|
||||||
on_failure: continue
|
on_failure: continue
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue