feat(deploy): run the code runner in a dedicated LXD VM on the app host

This commit is contained in:
shira committed 2026-10-11 09:45:12 +03:00
1 parent 1ebd23693e
commit 53a125f2b5
11 files changed
+832 -10

No files matched your search

+34 -2
View File
@@ -64,7 +64,7 @@ DEMO_SCRIPT_ENV = DOCKER="$(DOCKER)" DEMO_MODE="$(DEMO_MODE)" DEMO_PROJECT="$(DE
DEMO_RELEASE_MANIFEST="$(DEMO_RELEASE_MANIFEST)"
PLAYWRIGHT_VERSION := $(shell sed -n 's/^ *"@playwright\/test": "\([^"]*\)",\{0,1\}$$/\1/p' "$(ROOT)/frontend/package.json")
.PHONY: help config build up down logs monitoring-config monitoring-up monitoring-down monitoring-logs ml-config ml-build ml-up ml-down ml-logs runner-dev-config runner-dev-build runner-dev-up runner-dev-down runner-dev-logs check-runner-dev check check-workflows check-release check-perimeter check-e2e-mail check-demo perimeter-test smoke test-e2e test-e2e-registration release-build release-smoke release-e2e release-manifest release-manifest-verify release-manifest-check release-up release-down release-clean demo-seed demo-reset demo-down
.PHONY: help config build up down logs monitoring-config monitoring-up monitoring-down monitoring-logs ml-config ml-build ml-up ml-down ml-logs runner-dev-config runner-dev-build runner-dev-up runner-dev-down runner-dev-logs check-runner-dev check-runner-vm check check-workflows check-release check-perimeter check-e2e-mail check-demo perimeter-test smoke test-e2e test-e2e-registration release-build release-smoke release-e2e release-manifest release-manifest-verify release-manifest-check release-up release-down release-clean demo-seed demo-reset demo-down
help: ## Show deployment commands
@awk 'BEGIN {FS = ":.*## "} /^[a-zA-Z0-9_-]+:.*## / {printf "%-24s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@@ -155,6 +155,35 @@ runner-dev-down: ## Stop the dev-only runner
runner-dev-logs: ## Follow dev-only runner logs
RUNNER_DEV_TOKEN_FILE="$(RUNNER_DEV_TOKEN_FILE)" $(DOCKER) compose -p "$(RUNNER_DEV_PROJECT)" -f "$(RUNNER_DEV_FILE)" logs -f
# Production code runner VM (deploy/labs/runner-vm.sh). The runner-vm-*
# targets run on the app host as a member of the docker and lxd groups,
# without sudo. Secrets and reports stay in RUNNER_VM_STATE_DIR (default
# ~/lincodex-runner), never in the repository. Settings come from the
# environment or the make command line, for example A16_BUNDLE=<path>.
.PHONY: runner-vm-up runner-vm-secrets runner-vm-rootfs runner-vm-create runner-vm-install runner-vm-a16 runner-vm-check
RUNNER_VM_SCRIPT := $(ROOT)/deploy/labs/runner-vm.sh
runner-vm-up: ## App host: secrets, runner file system, VM (once), install, and checks
@bash "$(RUNNER_VM_SCRIPT)" up
runner-vm-secrets: ## App host: create the runner CA, server certificate, and token outside the repository
@bash "$(RUNNER_VM_SCRIPT)" secrets
runner-vm-rootfs: ## App host: build runner/Dockerfile and export its file system for the VM
@bash "$(RUNNER_VM_SCRIPT)" rootfs
runner-vm-create: ## App host: create and start the runner VM with its static address
@bash "$(RUNNER_VM_SCRIPT)" create
runner-vm-install: ## App host: push the runner, its secrets, and the systemd unit into the VM and restart it
@bash "$(RUNNER_VM_SCRIPT)" install
runner-vm-a16: ## App host: run the A16 suite in the runner VM (bundle from make -C runner a16-bundle)
@bash "$(RUNNER_VM_SCRIPT)" a16
runner-vm-check: ## App host: check the VM, TLS and token, a harmless run, mounts, secrets, limits, and network denial
@bash "$(RUNNER_VM_SCRIPT)" check
# Edge proxy (TLS and tunnel templates under deploy/edge). edge.env is local;
# the checked-in example is used when it does not exist.
.PHONY: edge-render edge-config
@@ -168,7 +197,7 @@ edge-render: ## Render the edge nginx config from deploy/edge/edge.env into depl
edge-config: ## Render the edge templates and check the nginx config with nginx -t in a container
@DOCKER="$(DOCKER)" EDGE_NGINX_IMAGE="$(EDGE_NGINX_IMAGE)" bash "$(EDGE_DIR)/scripts/check.sh" "$(EDGE_ENV)"
check: config check-workflows check-release check-perimeter check-e2e-mail check-demo check-runner-dev ## Validate Compose files, CI workflow aggregates, release tooling, and network boundaries without starting services
check: config check-workflows check-release check-perimeter check-e2e-mail check-demo check-runner-dev check-runner-vm ## Validate Compose files, CI workflow aggregates, release tooling, and network boundaries without starting services
check-workflows: ## Check that each workflow aggregate job requires every other job
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s "$(ROOT)/scripts" -p 'test_workflow_aggregate.py'
@@ -185,6 +214,9 @@ check-e2e-mail: ## Check that the mail fixture stays inside the explicit local E
check-runner-dev: ## Check that the dev-only runner switches stay out of production files
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s "$(ROOT)/deploy/scripts" -p 'test_runner_dev.py'
check-runner-vm: ## Check that the runner VM script keeps the VM boundary (no LXD needed)
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s "$(ROOT)/deploy/scripts" -p 'test_runner_vm.py'
check-demo: ## Check the guards of the demo targets and the demo overlay without starting services
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s "$(ROOT)/deploy/scripts" -p 'test_demo.py'