Implement Canvas V2 subgraphs, assets and asynchronous AI execution
This commit is contained in:
+34
-3
@@ -70,9 +70,40 @@ fi
|
||||
codex_mounts=()
|
||||
codex_dir=$foundry/codex
|
||||
if [[ -d "$codex_dir" ]]; then
|
||||
if ! docker inspect -f '{{.State.Running}}' foundry-codex-worker 2>/dev/null | grep -qx true; then
|
||||
bash "$(dirname "$0")/codex-worker.sh" "$release/foundry" >/dev/null
|
||||
# Core and its private worker must speak the same Canvas artifact protocol.
|
||||
# Keep the previous container definition for exact startup rollback.
|
||||
worker_backup=
|
||||
if docker inspect foundry-codex-worker >/dev/null 2>&1; then
|
||||
worker_backup=foundry-codex-worker-previous-$(date +%s)-$$
|
||||
docker stop -t 5 foundry-codex-worker >/dev/null
|
||||
docker rename foundry-codex-worker "$worker_backup"
|
||||
fi
|
||||
worker_ready=false
|
||||
if bash "$(dirname "$0")/codex-worker.sh" "$release/foundry" >/dev/null; then
|
||||
for attempt in {1..20}; do
|
||||
if docker exec foundry-codex-worker node -e '
|
||||
const http = require("node:http");
|
||||
const req = http.get({socketPath:"/run/foundry-codex/worker.sock",path:"/canvas/models"}, res => {
|
||||
let body = "";
|
||||
res.on("data", chunk => { body += chunk; if(body.length > 262144) req.destroy(); });
|
||||
res.on("end", () => { try { const value=JSON.parse(body); process.exit(res.statusCode===200 && Array.isArray(value.models) && value.models.length>0 ? 0 : 1); } catch { process.exit(1); } });
|
||||
});
|
||||
req.setTimeout(2000, () => req.destroy());
|
||||
req.on("error", () => process.exit(1));
|
||||
' >/dev/null 2>&1; then worker_ready=true; break; fi
|
||||
sleep 0.25
|
||||
done
|
||||
fi
|
||||
if [[ "$worker_ready" != true ]]; then
|
||||
docker rm -f foundry-codex-worker >/dev/null 2>&1 || true
|
||||
if [[ -n "$worker_backup" ]]; then
|
||||
docker rename "$worker_backup" foundry-codex-worker
|
||||
docker start foundry-codex-worker >/dev/null
|
||||
fi
|
||||
printf 'Canvas worker startup/catalog verification failed; previous worker restored.\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ -n "$worker_backup" ]]; then docker rm "$worker_backup" >/dev/null; fi
|
||||
for attempt in {1..20}; do
|
||||
[[ ! -S "$codex_dir/run/worker.sock" ]] || break
|
||||
sleep 0.25
|
||||
@@ -91,7 +122,7 @@ docker run -d --name "$candidate" "${codex_mounts[@]}" "${mail_env[@]}" "${slack
|
||||
--env-file "$foundry/database.env" -e HOST -e PORT -e PUBLIC_ORIGIN \
|
||||
-e GOOGLE_CLIENT_ID -e GOOGLE_CLIENT_SECRET -e FOUNDRY_PROJECTS -e FOUNDRY_ONBOARDING \
|
||||
--user 1000:1000 --cap-drop ALL --security-opt no-new-privileges \
|
||||
--read-only --memory 128m \
|
||||
--read-only --memory 1g \
|
||||
--mount "type=bind,source=$ca_bundle,target=/etc/ssl/certs/ca-certificates.crt,readonly" \
|
||||
-e SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
|
||||
--mount "type=bind,source=$release/foundry,target=/opt/foundry,readonly" \
|
||||
|
||||
Reference in New Issue
Block a user