Compare commits

..
2 Commits
Author SHA1 Message Date
BaaRai b9f90d9216 test(ghidra): set the runner token in the compose fixture
The default compose now requires ARTEX_RUNNER_TOKEN for the panel, so the ghidra overlay config test must provide it like the sandbox compose test already does.
2026-11-30 19:48:11 +01:00
BaaRai a37b5b7025 release: package the sandbox images for the 0.7.1 default
The panel refuses tasks when artex-runner is unavailable, so the runner, worker and egress proxy are now part of docker-compose.yml and docker-compose.ghcr.yml. install.sh and update.sh generate ARTEX_RUNNER_TOKEN and build the three images; the release workflow publishes them beside the panel image. The changelog records the security fixes, the upgrade steps and the scope re-approval.
2026-11-30 19:34:59 +01:00
11 changed files with 295 additions and 29 deletions
+6
View File
@@ -17,6 +17,12 @@ POSTGRES_USER=artex
# because Compose reads this file that way.
POSTGRES_PASSWORD=change-me-please
POSTGRES_DB=artex
# Shared secret between the panel and artex-runner for the internal execution
# API. install.sh and update.sh generate it when empty. Keep it private.
ARTEX_RUNNER_TOKEN=
# Agent execution isolation: required (default, one worker per task) or off
# (explicit degraded mode, loud warning). docker-compose.yml includes the runner.
# ARTEX_SANDBOX=required
# Prebuilt GHCR image tag for docker-compose.ghcr.yml. Unset uses latest.
# ARTEX_IMAGE_TAG=latest
# Build identity shown in the UI and the startup banner. update.sh refreshes both
+63 -2
View File
@@ -82,7 +82,7 @@ jobs:
# ③ Collect all zips → create the GitHub Release
release:
needs: binaries
needs: [binaries, sandbox-images]
runs-on: ubuntu-latest
permissions:
contents: write # create the Release (softprops/action-gh-release)
@@ -152,7 +152,68 @@ jobs:
generate_release_notes: false
body_path: ${{ runner.temp }}/release-body.md
# ④ Multi-arch image → push to GitHub Container Registry (and optionally Docker Hub
# ④ Sandbox images: the runner, the per-task worker and the egress proxy.
# The panel image above is useless for agent execution without them when
# ARTEX_SANDBOX=required, so they are published from the same tag.
sandbox-images:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- { name: runner, dockerfile: Dockerfile.runner }
- { name: worker, dockerfile: Dockerfile.worker }
- { name: egress-proxy, dockerfile: Dockerfile.egress-proxy }
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Log in to GitHub Container Registry
if: github.event_name == 'push'
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
id: meta
with:
images: ghcr.io/baarai/artex-${{ matrix.name }}
tags: |
type=ref,event=tag
type=semver,pattern={{version}}
type=raw,value=latest
- uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
ARTEX_VERSION=${{ github.ref_name }}
ARTEX_REVISION=${{ github.sha }}
provenance: true
sbom: true
- name: Verify the image pulls anonymously
if: github.event_name == 'push'
run: |
tag="${GITHUB_REF_NAME}"
image="ghcr.io/baarai/artex-${{ matrix.name }}:${tag}"
cfg="$(mktemp -d)"
for attempt in 1 2 3; do
if DOCKER_CONFIG="$cfg" docker manifest inspect "$image" >/dev/null; then
exit 0
fi
sleep 10
done
echo "anonymous pull of $image is denied; set the package visibility to Public" >&2
exit 1
# ⑤ Multi-arch image → push to GitHub Container Registry (and optionally Docker Hub
# when DOCKERHUB_ENABLED is set to 'true' alongside DOCKERHUB_IMAGE and
# DOCKERHUB_USERNAME / DOCKERHUB_TOKEN secrets). Dry runs (workflow_dispatch)
# build both platforms without logging in or pushing.
+22 -7
View File
@@ -1,15 +1,29 @@
## [Unreleased]
### Breaking Changes
- **Upgrade note (migration `0023_task_scope_operator_approval.sql`)**: Existing `source = 'manual'` `task_scope` rows are backfilled to `approved_by_operator = TRUE`, while goal-derived/agent (`source = 'agent'`) and auto (`source = 'auto'`) scopes remain `FALSE` and must be re-approved once via the Task Scope UI to grant sandbox egress. Target-gate approval clears only the tool gate; worker egress still requires operator-approved Task Scope.
- **Container sandbox required by default (`ARTEX_SANDBOX=required`)**: agent execution (`Bash`, custom command/script tools) now routes to disposable per-task `artex-worker` containers via `artex-runner` (`docker-compose.sandbox.yml`) with an `internal: true` per-task network and DNS-pinning HTTP/SOCKS5 egress allowlist proxy (`artex-egress-proxy`). Tasks refuse to start or pause when the runner is unavailable (no silent local fallback). Pass `ARTEX_SANDBOX=off` for explicit degraded local mode (logs a loud startup warning and records `sandbox=off` in every task event log).
# Changelog
All notable changes to this project are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
## [Unreleased]
## [0.7.1] - 2026-11-30
### Security
- **Per-task execution sandbox is the default.** `Bash`, custom command and script tools, and stdio MCP servers run in a disposable `artex-worker` container created by `artex-runner`, never in the panel container. The worker has uid/gid 10001, a read-only rootfs, `cap-drop ALL`, no key or database mount, only its task workspace, and only an internal task network. A per-task `artex-egress-proxy` enforces a deny-by-default domain and CIDR allowlist with DNS pinning, HTTP/HTTPS CONNECT and SOCKS5, blocks IMDS, RFC1918, loopback, link-local and IPv6 unless explicitly approved, and writes its audit log outside the worker workspace. The runner and the three images are part of `docker-compose.yml`, `docker-compose.ghcr.yml`, `install.sh` and `update.sh`; the release publishes the runner, worker and egress-proxy images beside the panel. `ARTEX_SANDBOX=off` is the explicit, loud degraded mode.
- **The sandbox egress allowlist is operator-owned, not agent-writable.** Migration `0023_task_scope_operator_approval.sql` adds `task_scope.approved_by_operator`. Only operator-approved rows (Task Scope UI, operator-selected companies, operator retarget) grant egress; `add_task_scope`, `insert_assets`, agent-spawned company scope and expanded rows are coverage-only. `WebFetch` and the shared browser use the same policy. Existing `source='manual'` rows are backfilled; goal-derived (`source='agent'`) and auto (`source='auto'`) scopes must be re-approved once in Task Scope. Target-gate approval clears only the tool-call gate, and the denial message says so.
- **Startup is fail-closed and key permissions are enforced.** The isolation self-test stops the server on every platform unless `ARTEX_ALLOW_UNISOLATED=1` is explicitly set. The key directory is tightened to 0700 and existing key files to 0600 at startup, so a host bind mount cannot mask the image permissions.
- **Secret rotation is atomic.** `db.RotateSecretKey`, `artex -rotate-secrets` and `scripts/rotate-secrets.sh` re-encrypt every sealed database value and bump `auth.password_version` in one transaction before the new key is moved into place. Existing sessions are invalidated.
- **Target gate backfill and a real kill switch.** Migration `0022_target_gate_backfill.sql` enables the gate on active scoped tasks that did not opt out, with `tasks.target_gate_opt_out` for the explicit opt-out. `Engine.Pause` and `Engine.BeginDelete` set `PR_SET_CHILD_SUBREAPER` and terminate the executor UID or task descendants from `/proc`; the sandbox kill scans `/proc` for uid 10001 and never trusts agent-writable state, with a container-removal fallback.
- **Chat bridge approval buttons recheck access.** A member removed, a chat unlisted or the bridge disabled while a batch was queued can no longer spend a valid button. The handler re-reads the bridge, refuses when access or the enabled state changed, and the consume statement requires the current `config_version`. Reported privately by @jamesKhor.
### Breaking Changes
- **`ARTEX_SANDBOX=required` by default.** If `artex-runner` is unavailable, ARTEX refuses to start tasks and pauses running tasks, with no local fallback. `ARTEX_SANDBOX=off` is the explicit degraded mode and writes `sandbox=off` into each task event log. The runner needs access to the Docker socket; `install.sh` and `update.sh` generate `ARTEX_RUNNER_TOKEN` and build the runner, worker and egress-proxy images. GHCR users pull the sandbox profile from the same release tag.
- **Existing task scopes need one re-approval.** Operator-entered `source='manual'` scopes are backfilled by migration 0023. Goal-derived and auto-discovered scopes remain coverage-only and must be re-approved once in Task Scope before sandbox egress is granted.
### Credits
The execution-scope gap and its remediation were tracked in public before the November 2026 writeup: #421 and #423 by @youssefmedhatl, #554, #555 and #553 by @renaesop, with the two-sources-of-truth analysis by @Dukotah in #421. The chat bridge advisory was reported by @jamesKhor. The public writeup is by Kevin Joensen. Thank you.
### Added
- **The last four `src/lib` test files run in CI**: `activity-merge`, `chat-mentions`, `format` and `http-href` existed and passed, but no `package.json` script named them and the `web` job runs scripts by name, so their 15 assertions could not fail a build. `test:activity-merge`, `test:chat-mentions`, `test:format` and `test:http-href` now match the existing one-script-per-file shape and run in the `web` job; `http-href` is the guard that refuses `javascript:`, `data:` and `vbscript:` URLs before they reach an href (#678).
@@ -1285,7 +1299,8 @@ First release of this fork. The engine underneath is still upstream's, but this
- [@Autumn-27](https://github.com/Autumn-27)
- [@neouks](https://github.com/neouks)
[Unreleased]: https://github.com/BaaRai/ARTEX/compare/v0.7.0...HEAD
[Unreleased]: https://github.com/BaaRai/ARTEX/compare/v0.7.1...HEAD
[0.7.1]: https://github.com/BaaRai/ARTEX/compare/v0.7.0...v0.7.1
[0.7.0]: https://github.com/BaaRai/ARTEX/compare/v0.6.0...v0.7.0
[0.6.0]: https://github.com/BaaRai/ARTEX/compare/v0.5.1...v0.6.0
[0.5.1]: https://github.com/BaaRai/ARTEX/compare/v0.5.0...v0.5.1
+25 -3
View File
@@ -1178,12 +1178,34 @@ using this project means you have read, understood and agreed to all of the abov
> development, set `ARTEX_SANDBOX=off` (logs a loud startup banner and writes
> `sandbox=off` into each task's event log).
Launch with the sandbox overlay:
The runner, worker and proxy services are part of `docker-compose.yml` and the
GHCR compose file. `install.sh` and `update.sh` generate `ARTEX_RUNNER_TOKEN` and
build the three images:
```bash
docker compose -f docker-compose.yml -f docker-compose.sandbox.yml --profile build-only build
docker compose -f docker-compose.yml -f docker-compose.sandbox.yml up -d
./install.sh # first install
./update.sh # existing checkout
```
Manual, from a source checkout:
```bash
# Put ARTEX_RUNNER_TOKEN=$(openssl rand -hex 32) in .env once.
docker compose build artex artex-runner
docker compose --profile build-only build artex-worker artex-egress-proxy
docker compose up -d
```
From the published images:
```bash
# ARTEX_RUNNER_TOKEN must be set in .env.
docker compose -f docker-compose.ghcr.yml --profile build-only pull
docker compose -f docker-compose.ghcr.yml up -d
```
`docker-compose.sandbox.yml` remains as a compatibility overlay for existing
commands; it is no longer required.
See [`docs/SANDBOX.md`](docs/SANDBOX.md) for the runner API, per-task internal
network, HTTP/SOCKS5 egress allowlist proxy, and security boundary.
+52
View File
@@ -37,6 +37,11 @@ services:
depends_on:
postgres:
condition: service_healthy
artex-runner:
condition: service_healthy
networks:
- default
- runner-net
environment:
# Parts, not a pasted URL. PostgresDSN percent-encodes the password, so a
# value with / ? % @ : or a space still connects.
@@ -71,6 +76,11 @@ services:
ARTEX_TASK_BUDGET_TURNS: ${ARTEX_TASK_BUDGET_TURNS:-}
ARTEX_INTENT_BUDGET_TOKENS: ${ARTEX_INTENT_BUDGET_TOKENS:-}
ARTEX_INTENT_BUDGET_TURNS: ${ARTEX_INTENT_BUDGET_TURNS:-}
# Agent execution runs in disposable per-task worker containers. The
# sandbox images are published beside the panel image.
ARTEX_SANDBOX: ${ARTEX_SANDBOX:-required}
ARTEX_RUNNER_URL: ${ARTEX_RUNNER_URL:-http://artex-runner:8789}
ARTEX_RUNNER_TOKEN: ${ARTEX_RUNNER_TOKEN:?Please set ARTEX_RUNNER_TOKEN in .env}
ports:
- "${ARTEX_BIND_ADDR:-127.0.0.1}:8787:8787"
- "127.0.0.1:8788:8788"
@@ -79,5 +89,47 @@ services:
- ./keys:/app/keys
restart: unless-stopped
artex-runner:
image: ghcr.io/baarai/artex-runner:${ARTEX_IMAGE_TAG:-latest}
networks:
- runner-net
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./data/tasks:/app/data/tasks
- ./data/egress-audit:/app/data/egress-audit
environment:
ARTEX_RUNNER_TOKEN: ${ARTEX_RUNNER_TOKEN:?Please set ARTEX_RUNNER_TOKEN in .env}
ARTEX_WORKER_IMAGE: ${ARTEX_WORKER_IMAGE:-ghcr.io/baarai/artex-worker:${ARTEX_IMAGE_TAG:-latest}}
ARTEX_EGRESS_PROXY_IMAGE: ${ARTEX_EGRESS_PROXY_IMAGE:-ghcr.io/baarai/artex-egress-proxy:${ARTEX_IMAGE_TAG:-latest}}
ARTEX_WORKSPACE_ROOT: /app/data/tasks
ARTEX_HOST_WORKSPACE_ROOT: ${ARTEX_HOST_WORKSPACE_ROOT:-./data/tasks}
ARTEX_AUDIT_ROOT: /app/data/egress-audit
ARTEX_HOST_AUDIT_ROOT: ${ARTEX_HOST_AUDIT_ROOT:-./data/egress-audit}
ARTEX_TASK_NET_PREFIX: ${ARTEX_TASK_NET_PREFIX:-artex-task-}
ARTEX_EGRESS_NET: ${ARTEX_EGRESS_NET:-egress-net}
healthcheck:
test: ["CMD-SHELL", "curl -fsS -H \"Authorization: Bearer $$ARTEX_RUNNER_TOKEN\" http://127.0.0.1:8789/v1/health"]
interval: 5s
timeout: 3s
retries: 10
restart: unless-stopped
# Images the runner instantiates per task. They are pulled with
# `docker compose -f docker-compose.ghcr.yml --profile build-only pull`.
artex-worker:
image: ghcr.io/baarai/artex-worker:${ARTEX_IMAGE_TAG:-latest}
profiles: ["build-only"]
artex-egress-proxy:
image: ghcr.io/baarai/artex-egress-proxy:${ARTEX_IMAGE_TAG:-latest}
profiles: ["build-only"]
networks:
runner-net:
internal: true
egress-net:
name: ${ARTEX_EGRESS_NET:-egress-net}
driver: bridge
volumes:
pgdata:
+7 -4
View File
@@ -1,7 +1,10 @@
# ARTEX Sandbox MVP overlay (CONTRACT.md §§1-6).
# Usage:
# docker compose -f docker-compose.yml -f docker-compose.sandbox.yml build
# docker compose -f docker-compose.yml -f docker-compose.sandbox.yml up -d
# ARTEX sandbox compatibility overlay.
#
# Since 0.7.1 the runner, worker and egress proxy are part of
# docker-compose.yml and docker-compose.ghcr.yml, so a plain
# `docker compose up -d` runs the sandbox. This file is kept so existing
# `-f docker-compose.yml -f docker-compose.sandbox.yml` commands keep working;
# it is no longer required.
#
# Security boundary:
# - artex (panel): holds DB credentials, keys, LLM keys; never mounts docker.sock;
+59
View File
@@ -39,6 +39,11 @@ services:
depends_on:
postgres:
condition: service_healthy
artex-runner:
condition: service_healthy
networks:
- default
- runner-net
environment:
# Parts, not a pasted URL. PostgresDSN percent-encodes the password, so a
# value with / ? % @ : or a space still connects. ARTEX_PG_DSN, when set,
@@ -73,6 +78,11 @@ services:
ARTEX_TASK_BUDGET_TURNS: ${ARTEX_TASK_BUDGET_TURNS:-}
ARTEX_INTENT_BUDGET_TOKENS: ${ARTEX_INTENT_BUDGET_TOKENS:-}
ARTEX_INTENT_BUDGET_TURNS: ${ARTEX_INTENT_BUDGET_TURNS:-}
# Agent execution runs in disposable per-task worker containers. The
# runner is part of this compose file; its token must be set in .env.
ARTEX_SANDBOX: ${ARTEX_SANDBOX:-required}
ARTEX_RUNNER_URL: ${ARTEX_RUNNER_URL:-http://artex-runner:8789}
ARTEX_RUNNER_TOKEN: ${ARTEX_RUNNER_TOKEN:?Please set ARTEX_RUNNER_TOKEN in .env}
ports:
- "${ARTEX_BIND_ADDR:-127.0.0.1}:8787:8787"
- "127.0.0.1:8788:8788"
@@ -88,5 +98,54 @@ services:
- ./skills:/app/skills
restart: unless-stopped
artex-runner:
build:
context: .
dockerfile: Dockerfile.runner
image: artex-runner:local
networks:
- runner-net
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./data/tasks:/app/data/tasks
- ./data/egress-audit:/app/data/egress-audit
environment:
ARTEX_RUNNER_TOKEN: ${ARTEX_RUNNER_TOKEN:?Please set ARTEX_RUNNER_TOKEN in .env}
ARTEX_WORKER_IMAGE: ${ARTEX_WORKER_IMAGE:-artex-worker:local}
ARTEX_EGRESS_PROXY_IMAGE: ${ARTEX_EGRESS_PROXY_IMAGE:-artex-egress-proxy:local}
ARTEX_WORKSPACE_ROOT: /app/data/tasks
ARTEX_HOST_WORKSPACE_ROOT: ${ARTEX_HOST_WORKSPACE_ROOT:-./data/tasks}
ARTEX_AUDIT_ROOT: /app/data/egress-audit
ARTEX_HOST_AUDIT_ROOT: ${ARTEX_HOST_AUDIT_ROOT:-./data/egress-audit}
ARTEX_TASK_NET_PREFIX: ${ARTEX_TASK_NET_PREFIX:-artex-task-}
ARTEX_EGRESS_NET: ${ARTEX_EGRESS_NET:-egress-net}
healthcheck:
test: ["CMD-SHELL", "curl -fsS -H \"Authorization: Bearer $$ARTEX_RUNNER_TOKEN\" http://127.0.0.1:8789/v1/health"]
interval: 5s
timeout: 3s
retries: 10
restart: unless-stopped
artex-worker:
build:
context: .
dockerfile: Dockerfile.worker
image: artex-worker:local
profiles: ["build-only"]
artex-egress-proxy:
build:
context: .
dockerfile: Dockerfile.egress-proxy
image: artex-egress-proxy:local
profiles: ["build-only"]
networks:
runner-net:
internal: true
egress-net:
name: ${ARTEX_EGRESS_NET:-egress-net}
driver: bridge
volumes:
pgdata:
+24 -4
View File
@@ -28,13 +28,33 @@ from disposable per-task **worker** containers (`artex-worker:local`).
## Running with the sandbox
The runner, worker and proxy are part of `docker-compose.yml` and
`docker-compose.ghcr.yml`. `install.sh` and `update.sh` generate
`ARTEX_RUNNER_TOKEN` and build the three images:
```bash
export ARTEX_RUNNER_TOKEN="$(openssl rand -hex 32)"
docker compose -f docker-compose.yml -f docker-compose.sandbox.yml --profile build-only build
docker compose -f docker-compose.yml -f docker-compose.sandbox.yml build
docker compose -f docker-compose.yml -f docker-compose.sandbox.yml up -d
./install.sh # first install
./update.sh # existing checkout
```
Manual, from a source checkout (put `ARTEX_RUNNER_TOKEN` in `.env` once):
```bash
docker compose build artex artex-runner
docker compose --profile build-only build artex-worker artex-egress-proxy
docker compose up -d
```
From the published images:
```bash
docker compose -f docker-compose.ghcr.yml --profile build-only pull
docker compose -f docker-compose.ghcr.yml up -d
```
`docker-compose.sandbox.yml` is kept as a compatibility overlay; it is no longer
required.
## Breaking change: `ARTEX_SANDBOX=required` by default
Starting with this release, `ARTEX_SANDBOX` defaults to **`required`**. If
+1 -1
View File
@@ -49,7 +49,7 @@ func TestComposeOverlayConfigHasInternalNetworkAndHardening(t *testing.T) {
t.Skip("docker CLI not available; static overlay assertions passed")
}
cmd := exec.Command("docker", "compose", "-f", baseFile, "-f", overlayFile, "config", "--format", "json")
cmd.Env = append(os.Environ(), "POSTGRES_PASSWORD=test")
cmd.Env = append(os.Environ(), "POSTGRES_PASSWORD=test", "ARTEX_RUNNER_TOKEN=testtoken")
out, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("docker compose config failed: %v\n%s", err, out)
+16 -2
View File
@@ -43,6 +43,16 @@ stamp_version(){
fi
ok "Build identity: ${BUILD_VERSION}${BUILD_REVISION:+ (${BUILD_REVISION:0:12})}"
}
# ensure_runner_token fills ARTEX_RUNNER_TOKEN in .env once. The panel and the
# runner authenticate the internal execution API with it; an empty value makes
# the panel fail closed, so the token is generated with the rest of the setup.
ensure_runner_token(){
[ -f .env ] || return 0
grep -q '^ARTEX_RUNNER_TOKEN=.' .env && return 0
set_env ARTEX_RUNNER_TOKEN "$(rand)"
ok "ARTEX_RUNNER_TOKEN generated"
}
# json_str prints $1 as a JSON string literal: backslash, double quote and the
# control characters read -r can return are escaped.
json_str(){
@@ -156,8 +166,12 @@ install_docker(){
info "reusing existing .env"
fi
stamp_version
info "building the image from this checkout and starting..."
docker compose up -d --build
ensure_runner_token
info "building the panel and the sandbox images from this checkout..."
docker compose build artex artex-runner
docker compose --profile build-only build artex-worker artex-egress-proxy
info "starting..."
docker compose up -d
ok "started → http://localhost:8787"
info "view logs: docker compose logs -f artex"
}
+20 -6
View File
@@ -11,6 +11,7 @@ ok(){ printf '\033[32m[+]\033[0m %s\n' "$*"; }
warn(){ printf '\033[33m[!]\033[0m %s\n' "$*"; }
die(){ printf '\033[31m[x]\033[0m %s\n' "$*" >&2; exit 1; }
ask(){ local p="$1" d="${2:-}" a; read -rp "$p${d:+ [$d]}: " a; echo "${a:-$d}"; }
rand(){ head -c 18 /dev/urandom | base64 | tr -dc 'A-Za-z0-9' | head -c 24; }
# ── Build identity: keep .env and the binary in step with the checkout ─────────
BUILD_VERSION="dev"
@@ -46,6 +47,16 @@ stamp_version(){
ok "Build identity: ${BUILD_VERSION}${BUILD_REVISION:+ (${BUILD_REVISION:0:12})}"
}
# ensure_runner_token fills ARTEX_RUNNER_TOKEN in .env once. The panel and the
# runner authenticate the internal execution API with it; an empty value makes
# the panel fail closed, so an existing .env gets one before the upgrade.
ensure_runner_token(){
[ -f .env ] || return 0
grep -q '^ARTEX_RUNNER_TOKEN=.' .env && return 0
set_env ARTEX_RUNNER_TOKEN "$(rand)"
ok "ARTEX_RUNNER_TOKEN generated"
}
# ── Optional: sync the repo to the latest code (compose/scripts/local build sources all update through it) ───────
sync_repo(){
[ -d .git ] && command -v git >/dev/null 2>&1 || { warn "not a git working copy, skipping git pull"; return 0; }
@@ -73,12 +84,15 @@ update_docker(){
|| die "docker buildx not detected; the image build needs it (see the Docker section of the README)"
[ -f .env ] || die ".env not found; run ./install.sh first to complete the initial deployment"
# Touch only artex: postgres is pinned to 16-alpine and does not need upgrading along
# (pulling it wastes bandwidth, and a major version bump risks compatibility). artex
# declares depends_on postgres, so an up with the service name starts pg if needed and leaves a running one untouched.
info "Building the image from this checkout (artex only)…"
docker compose build artex
info "Recreating artex (schema migrates automatically on restart)…"
ensure_runner_token
# Touch only artex and artex-runner: postgres is pinned to 16-alpine and does not
# need upgrading along (pulling it wastes bandwidth, and a major version bump
# risks compatibility). The worker and proxy images are built locally because the
# runner creates one container of each per task.
info "Building the panel and the sandbox images from this checkout…"
docker compose build artex artex-runner
docker compose --profile build-only build artex-worker artex-egress-proxy
info "Recreating artex and artex-runner (schema migrates automatically on restart)…"
docker compose up -d artex
ok "Update complete → http://localhost:8787"
info "View logs: docker compose logs -f artex"