diff --git a/deploy/docker-compose.prod.yml b/deploy/docker-compose.prod.yml index 69a2dce..3af961b 100644 --- a/deploy/docker-compose.prod.yml +++ b/deploy/docker-compose.prod.yml @@ -402,6 +402,11 @@ services: continuity-runtime: { condition: service_started } commit-runtime: { condition: service_started } cognitive-worker-candidate: { condition: service_healthy } + healthcheck: + test: ["CMD-SHELL", "wget -qO- http://localhost:8084/healthz >/dev/null"] + interval: 10s + timeout: 5s + retries: 20 volumes: assistant_pg: diff --git a/deploy/run-production-canary.sh b/deploy/run-production-canary.sh index 9ce8ade..1baca2c 100644 --- a/deploy/run-production-canary.sh +++ b/deploy/run-production-canary.sh @@ -53,9 +53,9 @@ JSON ) stable_json="$(curl -fsS --max-time 10 "$SUPERVISOR_CONTROL_URL/v1/state")" -stable_set="$(printf '%s' "$stable_json" | python3 -c 'import json,sys; s=json.load(sys.stdin).get("stable_release_set"); print(json.dumps(s,separators=(",",":")) if s else "")')" +stable_set="$(printf '%s' "$stable_json" | python3 -c "import json,sys; s=json.load(sys.stdin).get('stable_release_set'); print(json.dumps(s,separators=(',',':')) if s else '')")" if [[ -z "$stable_set" ]]; then - stable_revision="$(printf '%s' "$stable_json" | python3 -c 'import json,sys; print(json.load(sys.stdin).get("current",{}).get("version", "unknown"))')" + stable_revision="$(printf '%s' "$stable_json" | python3 -c "import json,sys; print(json.load(sys.stdin).get('current',{}).get('version','unknown'))")" stable_set="$(cat </dev/null || fail_rollback -observation="$(printf '%s' "$release_json" | python3 -c 'import json,sys,time; s=json.load(sys.stdin); print(json.dumps({"release_id":s["id"],"ready":True,"reason":"all ReleaseSet healthchecks and image revisions passed","observed_at_unix_millis":int(time.time()*1000),"components":{k:{"revision":v["revision"],"health":True,"ready":True} for k,v in s["components"].items()}},separators=(",",":")))')" +observation="$(printf '%s' "$release_json" | python3 -c "import json,sys,time; s=json.load(sys.stdin); print(json.dumps({'release_id':s['id'],'ready':True,'reason':'all ReleaseSet healthchecks and image revisions passed','observed_at_unix_millis':int(time.time()*1000),'components':{k:{'revision':v['revision'],'health':True,'ready':True} for k,v in s['components'].items()}},separators=(',',':')))" )" curl -fsS --max-time 10 -X POST "$SUPERVISOR_CONTROL_URL/v1/releases/observe-set" -H 'Content-Type: application/json' --data "$observation" >/dev/null || fail_rollback control /v1/traffic/canary || fail_rollback