StackPilot now manages exactly one Docker host: the one it runs on. The
stackpilot-agent sidecar and everything that proxied to it are gone — 4721
lines deleted against 657 added.
Deleted outright: agent/ (image, compose, env), agent_app.py, models/agent.py,
routers/agents.py (1200 lines), services/agent_service.py, the agent API client,
RemoteStackDetail, the host components and AgentStacksSection. That removes 57
API routes and the three /ws/agent-* proxies.
Threaded out everywhere else, which was the bulk of the work. Every API module
carried an optional agentId that switched the base path; every page that listed
Docker objects rendered one section per host behind a HostHeader; Files had a
host switcher; the New Stack editor and the template dialog had host selectors;
schedules, auto-update policies and stack summaries carried agent_id. All of it
is gone, and the typechecker drove the sweep — 85 files touched, tsc and the
build clean.
Two things the removal exposed as dead weight rather than merely unused:
compose_service kept an in-process busy set purely because the agent needed a
lock and has no database. With the agent gone that was a second source of truth
next to the real DB lock, so it is deleted; compute_status now reports only what
the containers say and the two callers that want "updating" overlay the lock.
StacksTable's linkBase prop only ever existed to point at /hosts/{id}/stacks.
The dashboard's "Hosts 1/1 online" KPI can no longer say anything else, so the
tile and the KPIs behind it are gone and the row is five wide.
Upgrading matters here. An existing install still has an agent table holding
each remote host's URL and bearer token — full Docker control of that host,
sitting in the database with nothing left to use it. _drop_removed_schema drops
it on first start, and drops the agent_id columns where the SQLite build
supports DROP COLUMN. Each statement runs in its own transaction on purpose: a
failed DDL poisons the transaction it is in, so sharing one would let an
unsupported column drop take the table drop down with it. test_agent_removal
covers both branches plus the fresh-install and idempotent cases, and an
end-to-end run against a seeded pre-0.48 database confirms the table is gone and
every /api/agents route answers 404.
Docstrings that justified a design by "shared with the agent, which has no
database" were rewritten rather than left lying: update_service's persistence
callback and image_status_store are still the right split (registry logic stays
testable without a database), but for that reason now, not the old one. The
README's multi-host sections are removed and an upgrade note explains what to do
with running agent containers; ROADMAP keeps its history behind a note saying
the feature it describes no longer exists.
CI no longer builds or pushes stackpilot-agent.
735 tests pass, ruff and tsc clean.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dk43rmEeRfYi5wsLDbmfyG
107 lines
3.6 KiB
YAML
107 lines
3.6 KiB
YAML
# Continuous integration on git.menzel.center (Gitea Actions).
|
|
#
|
|
# Two jobs: `check` runs the test suite, the linter and the frontend
|
|
# typecheck; `build-and-push` only starts once `check` is green, so a red
|
|
# suite never reaches the registry (and never reaches the self-update
|
|
# checker, which would happily offer a broken release).
|
|
#
|
|
# Builds and pushes both images to this instance's container registry on every
|
|
# push to main: backend and frontend. Each image gets both a ":latest" tag and
|
|
# a ":{APP_VERSION}" tag, the latter read
|
|
# from backend/version.py (the single source of truth for the release
|
|
# version) - self_update_service compares registry version *tags* against the
|
|
# running APP_VERSION to decide whether an update is available, so without a
|
|
# version tag it would never see one, no matter how far behind :latest is.
|
|
#
|
|
# Runs on ubuntu-latest, not the docker label: that label's image is a bare
|
|
# docker:24-dind with no Node/bash, which breaks actions/checkout (a JS
|
|
# action). ubuntu-latest has both a shell and the Docker CLI, talking to the
|
|
# host daemon through the socket the runner passes in.
|
|
|
|
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
env:
|
|
REGISTRY: git.menzel.center/menzeljonas
|
|
|
|
jobs:
|
|
check:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.CI_TOKEN }}
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12" # matches backend/Dockerfile
|
|
|
|
- name: Install backend + test dependencies
|
|
working-directory: backend
|
|
run: pip install -r requirements-dev.txt
|
|
|
|
- name: Lint (ruff)
|
|
working-directory: backend
|
|
run: ruff check .
|
|
|
|
# The suite runs without a Docker daemon on purpose: it drives the app
|
|
# through TestClient without the lifespan, so no background loops and no
|
|
# socket. See backend/tests/conftest.py.
|
|
- name: Test (pytest)
|
|
working-directory: backend
|
|
run: pytest
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
cache: npm
|
|
cache-dependency-path: frontend/package-lock.json
|
|
|
|
- name: Install frontend dependencies
|
|
working-directory: frontend
|
|
run: npm ci
|
|
|
|
- name: Typecheck (tsc)
|
|
working-directory: frontend
|
|
run: npx tsc --noEmit -p tsconfig.json
|
|
|
|
build-and-push:
|
|
needs: check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.CI_TOKEN }}
|
|
|
|
- name: Read app version
|
|
id: version
|
|
run: |
|
|
VERSION=$(grep -oP '(?<=APP_VERSION = ")[^"]+' backend/version.py)
|
|
echo "Building version $VERSION"
|
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Log in to the registry
|
|
run: |
|
|
echo "${{ secrets.CI_TOKEN }}" | docker login git.menzel.center -u menzeljonas --password-stdin
|
|
|
|
- name: Build and push backend
|
|
run: |
|
|
docker build \
|
|
-t "$REGISTRY/stackpilot-backend:latest" \
|
|
-t "$REGISTRY/stackpilot-backend:${{ steps.version.outputs.version }}" \
|
|
./backend
|
|
docker push "$REGISTRY/stackpilot-backend:latest"
|
|
docker push "$REGISTRY/stackpilot-backend:${{ steps.version.outputs.version }}"
|
|
|
|
- name: Build and push frontend
|
|
run: |
|
|
docker build \
|
|
-t "$REGISTRY/stackpilot-frontend:latest" \
|
|
-t "$REGISTRY/stackpilot-frontend:${{ steps.version.outputs.version }}" \
|
|
./frontend
|
|
docker push "$REGISTRY/stackpilot-frontend:latest"
|
|
docker push "$REGISTRY/stackpilot-frontend:${{ steps.version.outputs.version }}"
|