mirror of
https://github.com/BaaRai/ARTEX.git
synced 2026-12-03 13:11:05 +00:00
fix(compose): add opt-in Docker Desktop overlay instead of changing the default
Per review on #580: keep the default docker-compose.yml and docker-compose.ghcr.yml on host bind mounts so existing native-Linux installs are untouched -- a plain `git pull && docker compose up -d`, update.sh and `backup.sh --with-data` all keep working -- and move the named-volume fix into an opt-in overlay for VM-backed Docker hosts. - docker-compose.desktop.yml (new): layered over the base with `-f docker-compose.yml -f docker-compose.desktop.yml`, it overrides the /app/data, /app/keys and /app/skills host bind mounts with Docker-managed named volumes, so the agent-isolation self-test passes on Docker Desktop for Windows/WSL (0777, ignored chown/chmod) and macOS (fakeowner mount). Works over docker-compose.ghcr.yml too. - README: add a Quick-start callout and a "Docker Desktop on Windows and macOS" section documenting the overlay invocation and the cp-based data/keys/skills handling. The default docs keep describing ./data, ./keys and ./skills, which are correct again now that the default is unchanged. This reverts the earlier default-changing approach (named volumes in the base compose files) in favour of the overlay the maintainer preferred.
This commit is contained in:
parent
48ab520dc9
commit
fe6f2a3ed2
4 changed files with 118 additions and 95 deletions
120
README.md
120
README.md
|
|
@ -59,6 +59,11 @@ printed at startup:
|
|||
docker compose logs artex | grep "Setup token"
|
||||
```
|
||||
|
||||
> **On Docker Desktop for Windows or macOS**, add the Desktop overlay so agent isolation holds:
|
||||
> `docker compose -f docker-compose.yml -f docker-compose.desktop.yml up -d --build`. Without it the
|
||||
> `artex` container crash-loops on the isolation self-test. See
|
||||
> [Docker Desktop on Windows and macOS](#docker-desktop-on-windows-and-macos).
|
||||
|
||||
> Multi-arch release images (`linux/amd64`, `linux/arm64`) are published to GitHub Container
|
||||
> Registry at `ghcr.io/baarai/artex` from the next tagged release; v0.7.0 predates the publish
|
||||
> step. For pulling the prebuilt image and all other installation paths (script, binaries,
|
||||
|
|
@ -371,6 +376,7 @@ the reachable hostname of your database server.
|
|||
```bash
|
||||
docker pull ghcr.io/baarai/artex:latest
|
||||
|
||||
mkdir -p data keys
|
||||
docker run -d --name artex \
|
||||
--security-opt no-new-privileges:true \
|
||||
-p 127.0.0.1:8787:8787 \
|
||||
|
|
@ -382,12 +388,9 @@ docker run -d --name artex \
|
|||
-e ARTEX_PG_DBNAME=artex \
|
||||
-e ARTEX_PG_SSLMODE=disable \
|
||||
-e ARTEX_JWT_KEY_DIR=/app/keys \
|
||||
-v artex_data:/app/data \
|
||||
-v artex_keys:/app/keys \
|
||||
-v "$PWD/data:/app/data" \
|
||||
-v "$PWD/keys:/app/keys" \
|
||||
ghcr.io/baarai/artex:latest
|
||||
# Named volumes (not host bind mounts): agent isolation fails closed when /app/data
|
||||
# and /app/keys are host-mounted on a VM-backed Docker host (Docker Desktop on Windows
|
||||
# or macOS). Retrieve their contents with `docker cp artex:/app/data ./data`.
|
||||
# → http://localhost:8787 (docker logs artex | grep "Setup token")
|
||||
```
|
||||
|
||||
|
|
@ -398,9 +401,8 @@ literal `$`. The `ARTEX_PG_*` variables take the password raw; quote it in a she
|
|||
|
||||
The image includes a scanner toolchain (`nmap`, `nuclei`, `httpx`, `katana`, `ffuf`, `dalfox`,
|
||||
`sqlmap`, `ripgrep`, `curl`, `npm`, …) and built-in `/app/skills`. The GHCR Compose file below
|
||||
persists `keys` and `data` in Docker-managed named volumes (not host bind mounts, so agent
|
||||
isolation holds on VM-backed Docker hosts); it does not mount a host `skills/` directory, so the
|
||||
image's built-in skills are used.
|
||||
persists `./keys` and `./data`; it does not mount a host `skills/` directory, so the image's
|
||||
built-in skills are used.
|
||||
|
||||
#### Compose stack from the prebuilt image
|
||||
|
||||
|
|
@ -426,10 +428,41 @@ docker compose -f docker-compose.ghcr.yml up -d
|
|||
```
|
||||
|
||||
Pin a version with `ARTEX_IMAGE_TAG=v0.7.1` in `.env` (or `0.7.1`); unset uses `latest`. To use
|
||||
custom skills, add a `skills:/app/skills` named volume to the `artex` service and copy your skill
|
||||
directory into it with `docker compose -f docker-compose.ghcr.yml cp ./skills/. artex:/app/skills`,
|
||||
which overrides the built-in `/app/skills`. (A host `- ./skills:/app/skills` bind mount also works
|
||||
on native Linux, but breaks the agent-isolation self-test on VM-backed Docker hosts.)
|
||||
custom skills, copy them into a host directory and add `- ./skills:/app/skills` to the `artex`
|
||||
volumes, which overrides the built-in `/app/skills`.
|
||||
|
||||
#### Docker Desktop on Windows and macOS
|
||||
|
||||
Docker Desktop runs containers inside a Linux VM and serves the project's `./data`, `./keys` and
|
||||
`./skills` host directories into the container as bind mounts the server cannot lock down. The
|
||||
agent-isolation self-test (the fail-closed privilege drop) then refuses to start, so the `artex`
|
||||
container crash-loops at startup with `self-test failed ... Bash can create files in /app/data`. At
|
||||
startup the server runs as root and `chown`/`chmod`s those paths so the uid-10001 agent executor
|
||||
cannot write to them; on Docker Desktop it cannot: Windows/WSL forces the bind mount world-writable
|
||||
(`0777`) and ignores `chown`/`chmod`, while macOS serves it as a `fakeowner` filesystem that reports
|
||||
`root:root 0755` inside the container but does not enforce it, so uid 10001 can still create files.
|
||||
(That is also why the `chmod -R go-w` workaround helps on WSL but does nothing on a Mac.)
|
||||
|
||||
Layer `docker-compose.desktop.yml` over the base file to swap those three host bind mounts for
|
||||
Docker-managed named volumes, which live inside the VM's own filesystem where the server's
|
||||
permission hardening takes effect, so isolation stays **enabled** (no `-dev-insecure-no-isolation`):
|
||||
|
||||
```bash
|
||||
docker compose -f docker-compose.yml -f docker-compose.desktop.yml up -d --build
|
||||
# or, from the prebuilt image:
|
||||
docker compose -f docker-compose.ghcr.yml -f docker-compose.desktop.yml up -d
|
||||
```
|
||||
|
||||
Use the same `-f docker-compose.yml -f docker-compose.desktop.yml` for every later `docker compose`
|
||||
command (`logs`, `up -d artex`, `down`). The named volumes persist across rebuilds, but `data` and
|
||||
`keys` are no longer directly browsable at the project path — inspect or back them up with
|
||||
`docker compose -f docker-compose.yml -f docker-compose.desktop.yml cp artex:/app/data ./data` (and
|
||||
the same for `/app/keys`). `/app/skills` is seeded from the image's baked skills the first time the
|
||||
volume is created; editing a skill then means refreshing the volume
|
||||
(`docker compose -f docker-compose.yml -f docker-compose.desktop.yml cp ./skills/. artex:/app/skills`)
|
||||
rather than a live host edit. **Native-Linux installs do not need this overlay** — there host bind
|
||||
mounts work, so the default `docker-compose.yml` already passes the self-test and keeps your `./data`,
|
||||
`./keys` and `./skills` directories on the host.
|
||||
|
||||
For remote MCP you can choose `http` (Streamable HTTP) or `sse` (legacy SSE) in system settings.
|
||||
Legacy SSE servers usually establish the event stream with `GET /sse` and receive JSON-RPC over
|
||||
|
|
@ -649,27 +682,19 @@ services:
|
|||
- "${ARTEX_BIND_ADDR:-127.0.0.1}:8787:8787"
|
||||
- "127.0.0.1:8788:8788"
|
||||
volumes:
|
||||
# Named volumes, not host bind mounts, so agent isolation holds on VM-backed
|
||||
# Docker hosts (Docker Desktop on Windows and macOS). See docker-compose.yml.
|
||||
- data:/app/data
|
||||
- keys:/app/keys
|
||||
- ./data:/app/data
|
||||
- ./keys:/app/keys
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
data:
|
||||
keys:
|
||||
```
|
||||
|
||||
#### Local disk usage (`data/`)
|
||||
|
||||
Moving PostgreSQL to an external host does **not** move the runtime `/app/data` directory off local
|
||||
disk. The `data` volume still stores spilled HTTP/TCP traffic blobs (`data/traffic/_blobs`), LLM
|
||||
Moving PostgreSQL to an external host does **not** move the runtime `data/` directory off local
|
||||
disk. `data/` still stores spilled HTTP/TCP traffic blobs (`data/traffic/_blobs`), LLM
|
||||
transcripts, task working files, and local task archives, so heavy workloads can still fill the
|
||||
host disk if its backing disk is small. Put the `data` named volume on a suitably sized disk
|
||||
(configure the volume's driver/location, or override it with a host bind mount on native Linux where
|
||||
that does not trip the agent-isolation self-test), and consider setting `ARTEX_ARCHIVE_STORAGE=s3`
|
||||
(see [Task archive storage](docs/task-archive-storage.md)) to offload cold task archives to object
|
||||
storage.
|
||||
host disk if `data/` is on a small volume. Mount `data/` on a suitably sized volume, and consider
|
||||
setting `ARTEX_ARCHIVE_STORAGE=s3` (see [Task archive storage](docs/task-archive-storage.md)) to
|
||||
offload cold task archives to object storage.
|
||||
|
||||
### Reverse proxy deployment (HTTPS / exposing only 443)
|
||||
|
||||
|
|
@ -780,11 +805,6 @@ scripts/backup.sh --with-data # db dump + data/ archive, keep 14
|
|||
scripts/backup.sh --keep 7 # db only, keep 7
|
||||
```
|
||||
|
||||
`--with-data` archives a host `data/` directory, which exists for the binary and source installs.
|
||||
With the Docker Compose stack, `data` and `keys` are named volumes: copy them out first (for example
|
||||
`docker compose cp artex:/app/data ./data` and `docker compose cp artex:/app/keys ./keys`) and
|
||||
archive those copies.
|
||||
|
||||
Restore into a running stack:
|
||||
|
||||
```bash
|
||||
|
|
@ -809,34 +829,12 @@ Daily cron example (03:20, operator crontab):
|
|||
|
||||
### Updating and upgrading
|
||||
|
||||
> Upgrading swaps the program and never touches data: the `pgdata`, `data` (traffic index, task
|
||||
> files, transcripts) and `keys` (`jwt.key`, `secret.key`) volumes are preserved, and skills come
|
||||
> from the rebuilt image. **No manual database step is needed**: on every start ARTEX applies its
|
||||
> embedded `schema.sql` baseline, then any pending numbered migration from `db/migrations/`, in
|
||||
> order, each in its own transaction. Restarting the new binary is the upgrade. Back up the `data`
|
||||
> and `keys` volumes and the database before upgrading.
|
||||
|
||||
#### Migrating a host-mounted install to named volumes
|
||||
|
||||
Earlier versions bind-mounted `./data` and `./keys` from the project directory. The Compose files
|
||||
now use Docker-managed named volumes instead, so agent isolation holds on VM-backed Docker hosts
|
||||
(Docker Desktop on Windows and macOS). If you already ran ARTEX with the old host-mounted layout,
|
||||
a plain `git pull && docker compose up -d` would start against **empty** `data` and `keys` volumes:
|
||||
task history and transcripts vanish from the UI, the regenerated `jwt.key` signs everyone out, and —
|
||||
if `ARTEX_SECRET_KEY` is unset — the new `keys/secret.key` cannot read secrets encrypted with the
|
||||
old one. Copy your existing host directories into the new volumes once, before the first `up`:
|
||||
|
||||
```bash
|
||||
git pull
|
||||
docker compose create artex # create the container + empty volumes without starting it
|
||||
docker compose cp ./keys/. artex:/app/keys # existing jwt.key / secret.key
|
||||
docker compose cp ./data/. artex:/app/data # existing traffic index, tasks, transcripts
|
||||
docker compose up -d # start with your data in place
|
||||
```
|
||||
|
||||
The old `./data` and `./keys` directories can be kept as a backup or removed afterwards. Native
|
||||
Linux installs that prefer host-visible directories can instead override the `data`/`keys` volumes
|
||||
with bind mounts in a `docker-compose.override.yml`, where host mounts do not trip the self-test.
|
||||
> Upgrading swaps the program and never touches data: the Postgres volume `pgdata`, `./data`
|
||||
> (traffic index, task files, transcripts), `./keys` (`jwt.key`, `secret.key`) and `./skills` are
|
||||
> preserved. **No manual database step is needed**: on every start ARTEX applies its embedded
|
||||
> `schema.sql` baseline, then any pending numbered migration from `db/migrations/`, in order, each
|
||||
> in its own transaction. Restarting the new binary is the upgrade. Back up `./data`, `keys/` and
|
||||
> the database before upgrading.
|
||||
|
||||
**Update banner (opt-in, off by default)**: start ARTEX with `ARTEX_UPDATE_CHECK=1` to ask the
|
||||
public GitHub releases API for the latest tag, at most once per 24 hours (cached in memory; a
|
||||
|
|
@ -857,7 +855,7 @@ git reset --hard origin/main
|
|||
git stash pop # only if you stashed
|
||||
```
|
||||
|
||||
Your data is unaffected: the `data`, `keys` and `pgdata` volumes are not part of git history.
|
||||
Your data is unaffected: `./data`, the `pgdata` volume and `./skills` are not part of git history.
|
||||
|
||||
#### Option 1: one-click update script
|
||||
|
||||
|
|
|
|||
46
docker-compose.desktop.yml
Normal file
46
docker-compose.desktop.yml
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
# Docker Desktop overlay for Windows and macOS. Layer it over the base file:
|
||||
#
|
||||
# docker compose -f docker-compose.yml -f docker-compose.desktop.yml up -d --build
|
||||
#
|
||||
# or, with the published image:
|
||||
#
|
||||
# docker compose -f docker-compose.ghcr.yml -f docker-compose.desktop.yml up -d
|
||||
#
|
||||
# Why this exists: on a VM-backed Docker host the agent-isolation self-test
|
||||
# (the fail-closed privilege drop, PR #510) refuses to start when /app/data,
|
||||
# /app/keys and /app/skills are HOST bind mounts, so the container crash-loops
|
||||
# at startup with "self-test failed ... Bash can create files in /app/data ...".
|
||||
# At startup the server runs as root and chowns/chmods those paths so the
|
||||
# uid-10001 agent executor cannot write to them; on Docker Desktop it cannot:
|
||||
# - Windows/WSL forces the bind mount world-writable (0777) and ignores
|
||||
# chown/chmod, so the self-test's "writable by others" check trips.
|
||||
# - macOS serves the mount as a "fakeowner" filesystem that reports
|
||||
# root:root 0755 inside the container but does not enforce it, so uid 10001
|
||||
# can still create files. (This is also why the `chmod -R go-w` workaround
|
||||
# from #549 helps on WSL but does nothing on a Mac.)
|
||||
#
|
||||
# This overlay swaps those three host bind mounts for Docker-managed named
|
||||
# volumes, which live inside the Docker VM's own filesystem where the server's
|
||||
# chown/chmod take effect, so isolation stays ENABLED (no -dev-insecure-no-isolation).
|
||||
# The default docker-compose.yml is left untouched, so native-Linux installs,
|
||||
# where host bind mounts work, keep their ./data, ./keys and ./skills directories.
|
||||
#
|
||||
# Named volumes persist across rebuilds. /app/skills is seeded from the image's
|
||||
# baked skills the first time the volume is created; later image skill updates do
|
||||
# not overwrite it. Inspect or refresh the volumes from the host with, e.g.:
|
||||
# docker compose -f docker-compose.yml -f docker-compose.desktop.yml cp artex:/app/data ./data
|
||||
# docker compose -f docker-compose.yml -f docker-compose.desktop.yml cp ./skills/. artex:/app/skills
|
||||
services:
|
||||
artex:
|
||||
# Overrides the base artex bind mounts by container path: these three named
|
||||
# volumes replace ./data, ./keys and ./skills. pgdata and everything else are
|
||||
# inherited from the base file unchanged.
|
||||
volumes:
|
||||
- data:/app/data
|
||||
- keys:/app/keys
|
||||
- skills:/app/skills
|
||||
|
||||
volumes:
|
||||
data:
|
||||
keys:
|
||||
skills:
|
||||
|
|
@ -10,11 +10,8 @@
|
|||
#
|
||||
# Set POSTGRES_PASSWORD in .env. Pin the image with ARTEX_IMAGE_TAG=v0.7.1 in
|
||||
# .env; unset uses latest. The image carries the built-in /app/skills; this file
|
||||
# does not mount a host skills/ directory. data/ and keys/ are Docker-managed named
|
||||
# volumes rather than host bind mounts so agent isolation holds on VM-backed Docker
|
||||
# hosts (Docker Desktop on Windows and macOS); see docker-compose.yml for why. To use
|
||||
# custom skills, copy them into a skills volume with
|
||||
# `docker compose -f docker-compose.ghcr.yml cp ./skills/. artex:/app/skills`.
|
||||
# does not mount a host skills/ directory. To use custom skills, copy them into a
|
||||
# host directory and add `- ./skills:/app/skills` to the artex volumes.
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
|
|
@ -78,13 +75,9 @@ services:
|
|||
- "${ARTEX_BIND_ADDR:-127.0.0.1}:8787:8787"
|
||||
- "127.0.0.1:8788:8788"
|
||||
volumes:
|
||||
# Named volumes, not host bind mounts: agent isolation fails closed on a
|
||||
# VM-backed Docker host when these are host-mounted (see docker-compose.yml).
|
||||
- data:/app/data
|
||||
- keys:/app/keys
|
||||
- ./data:/app/data
|
||||
- ./keys:/app/keys
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
data:
|
||||
keys:
|
||||
|
|
|
|||
|
|
@ -74,30 +74,16 @@ services:
|
|||
- "${ARTEX_BIND_ADDR:-127.0.0.1}:8787:8787"
|
||||
- "127.0.0.1:8788:8788"
|
||||
volumes:
|
||||
# Docker-managed named volumes, NOT host bind mounts. At startup the server runs
|
||||
# as root and chowns/chmods these paths so the uid-10001 agent executor cannot
|
||||
# write to them; the agent-isolation self-test then refuses to start if it still
|
||||
# can (PR #510, fail-closed privilege drop). On a VM-backed Docker host the server
|
||||
# cannot lock a host bind mount down, so the self-test fails and the server
|
||||
# crash-loops: Docker Desktop for Windows/WSL forces the mount world-writable
|
||||
# (0777) and ignores chown/chmod, while Docker Desktop for macOS serves it as a
|
||||
# "fakeowner" filesystem that reports root:root 0755 but does not enforce it, so
|
||||
# uid 10001 can still create files. Named volumes live inside the Docker VM's own
|
||||
# filesystem, where the server's chown/chmod take effect, so isolation holds. They
|
||||
# persist across rebuilds. Inspect/back up on the host with, e.g.:
|
||||
# docker compose cp artex:/app/data ./data
|
||||
- data:/app/data
|
||||
# JWT signing key and secret key (jwt.key, secret.key); persisting keeps users
|
||||
# signed in across container rebuilds.
|
||||
- keys:/app/keys
|
||||
# skills/ is intentionally NOT mounted: the container uses the image's baked
|
||||
# /app/skills (root-owned, not agent-writable, and refreshed on every `--build`).
|
||||
# A host skills mount can't be made non-world-writable on a VM-backed host, which
|
||||
# would break the skill-approval guarantee; edit skills by rebuilding the image,
|
||||
# or copy them into a skills volume with `docker compose cp ./skills/. artex:/app/skills`.
|
||||
# Bind the runtime data directory (traffic index, task files, transcripts, etc.) to data/ in the project root,
|
||||
# so it is easy to inspect/back up on the host and survives container rebuilds.
|
||||
- ./data:/app/data
|
||||
# JWT signing key and secret key (jwt.key, secret.key), kept out of data/, which the file manager browses.
|
||||
# Persisting it keeps users signed in across container rebuilds.
|
||||
- ./keys:/app/keys
|
||||
# Mount skills/ from the project root into the container (overriding the image's built-in /app/skills);
|
||||
# skill changes require no image rebuild — the container reads the host copy.
|
||||
- ./skills:/app/skills
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
data:
|
||||
keys:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue