Bundles the working-tree state into one coherent commit covering the
upgrade-safety glue that complements today's earlier landings
(orphan-recovery, sf-db single-connection, drain-timer-not-unref'd,
forceShutdown drain, shutdown-state.ts, instrumentation.ts,
shutdown-signal.js, gate-deadlock-classifier).
Modified:
docker/Dockerfile.source-server — image build tweaks for the source-
server variant used by the in-container upgrader.
docker/docker-compose.vega.yaml — env passthroughs for host-side dirs
(SF_SOURCE_HOST_ROOT, SF_WORKSPACE_HOST_DIR, SF_WORKSPACES_HOST_DIR,
SF_HOME_HOST_DIR), docker socket mount, group_add for docker GID,
and SF_RPC_SHUTDOWN_GRACE_MS=600000 matching the 10-min drain.
scripts/run-vega-source-server.mjs — substantial rework supporting
the in-container upgrade flow.
scripts/upgrade-vega-source-server.mjs — buildEnv() + dockerBuildEnv()
helpers, probeBind via SF_VEGA_PROBE_HOST, containerExists()
pre-check before drainContainer, stop timeout now matches the
10-min RPC grace via SF_VEGA_DRAIN_STOP_TIME (default 610s).
src/web/project-discovery-service.ts — calls
recoverProjectRuntimeQueues() on each of the 3 discovery paths
(root monorepo, per-entry, nested SF projects). Closes the
cloud-volume mtime-lag window codex flagged.
web/app/api/ready/route.ts — calls recoverProjectRuntimeQueues() on
every readiness probe, and now also reads shutdown-state so the
probe returns 503 while draining.
web/components/sf/projects-view.tsx — UI wiring for the upgrade
trigger.
web/pages/api/projects.ts — backend API addition for the project
enumeration that feeds projects-view.
docs/specs/sf-self-deploy.md — docs update for the new flow.
package.json — script alias.
Added:
scripts/build-web-host.mjs — new build helper for the standalone web
host artifact consumed by the upgrade flow.
src/resources/extensions/sf/tests/auto-shutdown-signal.test.mjs —
unit test for the cooperative-shutdown signal module (registers /
requests / snapshot).
src/web/project-runtime-recovery.ts — thin wrapper around
recoverOrphanedFeedbackDrains for per-project use from web routes.
web/app/api/drain/route.ts — explicit drain endpoint for operator-
triggered queue flush.
web/app/api/server-upgrade/route.ts — auth-gated endpoint that
spawns the in-container upgrader via docker socket; passes through
host-dir env so the upgrader knows real bind-mount paths.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
51 lines
1.9 KiB
YAML
51 lines
1.9 KiB
YAML
services:
|
|
sf-server:
|
|
build:
|
|
context: ..
|
|
dockerfile: docker/Dockerfile.source-server
|
|
container_name: ${SF_VEGA_CONTAINER:-sf-server-vega}
|
|
working_dir: /opt/sf
|
|
user: "${PUID:-1000}:${PGID:-1000}"
|
|
group_add:
|
|
- "${DOCKER_GID:-999}"
|
|
ports:
|
|
- "${SF_VEGA_BIND:-127.0.0.1}:4000:4000"
|
|
volumes:
|
|
- ../:/opt/sf
|
|
- ${SF_WORKSPACE_DIR:-..}:/workspace
|
|
- ${SF_WORKSPACES_DIR:-..}:/workspaces
|
|
- ${SF_WORKSPACES_DIR:-/home/mhugo/code}:${SF_WORKSPACES_DIR:-/home/mhugo/code}
|
|
- ${HOME}/.sf:/home/node/.sf
|
|
- ${HOME}/.gitconfig:/home/node/.gitconfig:ro
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
environment:
|
|
HOME: /home/node
|
|
NODE_ENV: development
|
|
SF_SOURCE_ROOT: /opt/sf
|
|
SF_RUNTIME_SOURCE_ROOT: /opt/sf
|
|
SF_RELEASE_MANIFEST: /opt/sf/dist/sf-release-manifest.json
|
|
SF_WEB_PROJECT_CWD: ${SF_WORKSPACE_DIR:-/home/mhugo/code/singularity-forge}
|
|
SF_WORKSPACES_DIR: ${SF_WORKSPACES_DIR:-/home/mhugo/code}
|
|
SF_SOURCE_HOST_ROOT: ${SF_SOURCE_HOST_ROOT:-/home/mhugo/code/singularity-forge}
|
|
SF_WORKSPACE_HOST_DIR: ${SF_WORKSPACE_HOST_DIR:-/home/mhugo/code/singularity-forge}
|
|
SF_WORKSPACES_HOST_DIR: ${SF_WORKSPACES_HOST_DIR:-/home/mhugo/code}
|
|
SF_HOME_HOST_DIR: ${SF_HOME_HOST_DIR:-/home/mhugo/.sf}
|
|
SF_WEB_HOST: 0.0.0.0
|
|
SF_WEB_PORT: "4000"
|
|
HOSTNAME: 0.0.0.0
|
|
PORT: "4000"
|
|
SF_WEB_ALLOWED_ORIGINS: ${SF_WEB_ALLOWED_ORIGINS:-http://127.0.0.1:4000,http://localhost:4000}
|
|
SF_DEV_SERVER_WATCH: "1"
|
|
SF_RPC_SHUTDOWN_GRACE_MS: "600000"
|
|
command:
|
|
- node
|
|
- /opt/sf/dist/web/standalone/server.js
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test:
|
|
- CMD-SHELL
|
|
- node -e "fetch('http://127.0.0.1:4000/api/healthz').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
|
|
interval: 15s
|
|
timeout: 5s
|
|
retries: 12
|
|
start_period: 60s
|