feat: rename compose file to compose.yml — plain 'docker compose up -d' discovery

This commit is contained in:
sam
2026-08-21 06:46:07 +00:00
parent 7e7e78c1d9
commit f6bb3993f4
2 changed files with 20 additions and 17 deletions
+16 -13
View File
@@ -29,8 +29,8 @@ git clone https://gitea.noctools.nz/noctools/onlyscans-agent-kit.git
cd onlyscans-agent-kit cd onlyscans-agent-kit
cp .env.agent.example .env cp .env.agent.example .env
# edit .env: AGENT_IDENTITY / AGENT_PASSWORD # edit .env: AGENT_IDENTITY / AGENT_PASSWORD
docker compose -f docker-compose.agent.yml up -d docker compose up -d
docker logs -f onlyscans-agent docker compose logs -f
``` ```
The worker image pulls anonymously — no `docker login` required. The worker image pulls anonymously — no `docker login` required.
@@ -39,7 +39,7 @@ The worker image pulls anonymously — no `docker login` required.
`authenticated to PocketBase …` — that's it. (The agent's location is `authenticated to PocketBase …` — that's it. (The agent's location is
carried by its central record; nothing local participates.) carried by its central record; nothing local participates.)
A rejected password is FATAL by design — check `AGENT_IDENTITY` / A rejected password is FATAL by design — check `AGENT_IDENTITY` /
`AGENT_PASSWORD` in `.env` and `docker compose -f docker-compose.agent.yml up -d --force-recreate`. `AGENT_PASSWORD` in `.env` and `docker compose up -d --force-recreate`.
**Verify centrally:** Sam confirms the agent flips **online** on the **Verify centrally:** Sam confirms the agent flips **online** on the
central `/agents` page within ~90 s, then queues a pinned test scan against central `/agents` page within ~90 s, then queues a pinned test scan against
@@ -47,13 +47,13 @@ your location — `claimed_by` should show the agent username.
## Upgrades ## Upgrades
The compose file pins an image tag. To upgrade: `git pull` this repo, The compose file pins an image tag. To upgrade: `git pull` this repo
bump the tag + `AGENT_VERSION` in `docker-compose.agent.yml` if Sam hasn't (the tag + `AGENT_VERSION` in `compose.yml` are usually already bumped
already, then: centrally), then:
```bash ```bash
docker compose -f docker-compose.agent.yml pull docker compose pull
docker compose -f docker-compose.agent.yml up -d docker compose up -d
``` ```
The agent re-authenticates and resumes polling. The agent re-authenticates and resumes polling.
@@ -62,11 +62,13 @@ The agent re-authenticates and resumes polling.
- **Host-network variant** (scan the site LAN directly, ARP-level - **Host-network variant** (scan the site LAN directly, ARP-level
discovery, non-routed subnets): swap the service to `network_mode: host` discovery, non-routed subnets): swap the service to `network_mode: host`
per the commented block in `docker-compose.agent.yml`. per the commented block in `compose.yml`.
- **Second agent on the same box:** each agent needs its OWN credentials — - **Second agent on the same box:** each agent needs its OWN credentials —
copy the compose file AND create a second env file (`.env-agent2`), then copy `compose.yml` to `compose.agent2.yml` AND create a second env file
run it with `docker compose --env-file .env-agent2 -f (`.env-agent2`), then run it with `docker compose --env-file .env-agent2
docker-compose.agent2.yml up -d`. In the copy, change the project `name:` -f compose.agent2.yml up -d` (plain `docker compose up -d` always
operates on the first agent only — `compose.agent2.yml` is not
auto-discovered, which is the safe direction). In the copy, change the project `name:`
and `container_name` (and `WORKER_HEALTH_PORT` under host networking) per and `container_name` (and `WORKER_HEALTH_PORT` under host networking) per
the comments in the file. Two agents sharing one `.env` would share one the comments in the file. Two agents sharing one `.env` would share one
auth record — unsupported and silently wrong. auth record — unsupported and silently wrong.
@@ -78,7 +80,8 @@ The agent re-authenticates and resumes polling.
| Symptom | Meaning | | Symptom | Meaning |
|---|---| |---|---|
| `no configuration file provided: not found` | You ran a follow-up `docker compose logs`/`ps` without `-f docker-compose.agent.yml` — the kit's compose file has a non-default name, so it isn't auto-discovered. Re-run with `-f docker-compose.agent.yml`, or use plain `docker logs onlyscans-agent` (the container itself is fine) | | `no configuration file provided: not found` | You're not in the kit directory (`compose.yml` is auto-discovered only from the directory you run in). `cd` into the `onlyscans-agent-kit` clone, or use plain `docker logs onlyscans-agent` (the container itself is fine) |
| Upgraded from an older kit (`docker-compose.agent.yml`)? | The compose file was renamed to `compose.yml` — `git pull` removes the old one. Use plain `docker compose up -d` / `logs -f` from now on; your `.env` is untouched |
| Container exits ~1 s after start | Bad `AGENT_IDENTITY` or `AGENT_PASSWORD` — fatal by design; fix `.env` and recreate | | Container exits ~1 s after start | Bad `AGENT_IDENTITY` or `AGENT_PASSWORD` — fatal by design; fix `.env` and recreate |
| Agent shows **offline** centrally (`/agents`) | Container down, or no egress to `scan-api.noctools.nz:443` — check `docker logs onlyscans-agent` | | Agent shows **offline** centrally (`/agents`) | Container down, or no egress to `scan-api.noctools.nz:443` — check `docker logs onlyscans-agent` |
| Scans stay queued | Agent online but for a different location, or targets unreachable from the container's network — try the host-network variant | | Scans stay queued | Agent online but for a different location, or targets unreachable from the container's network — try the host-network variant |
+4 -4
View File
@@ -6,17 +6,17 @@
# 2. /agents → New agent: username (e.g. "chch-1") + that location. The # 2. /agents → New agent: username (e.g. "chch-1") + that location. The
# password is shown ONCE — put it in .env as AGENT_PASSWORD below. # password is shown ONCE — put it in .env as AGENT_PASSWORD below.
# #
# Then on this host: # Then on this host (from this directory):
# cp .env.agent.example .env (fill AGENT_IDENTITY / AGENT_PASSWORD) # cp .env.agent.example .env (fill AGENT_IDENTITY / AGENT_PASSWORD)
# → docker compose -f docker-compose.agent.yml up -d # → docker compose up -d (compose auto-discovers this file + .env)
# The worker image pulls anonymously from the public registry — no # The worker image pulls anonymously from the public registry — no
# `docker login` needed. (Fallback if the registry is ever re-privatized: # `docker login` needed. (Fallback if the registry is ever re-privatized:
# Sam will send login instructions with the kit credentials.) # Sam will send login instructions with the kit credentials.)
# Full walkthrough: README.md in this repo. # Full walkthrough: README.md in this repo.
# (Running a SECOND agent on the same box: each agent needs its OWN # (Running a SECOND agent on the same box: each agent needs its OWN
# credentials — copy this file to e.g. docker-compose.agent2.yml AND create # credentials — copy this file to e.g. compose.agent2.yml AND create
# a second env file (.env-agent2), then run it with # a second env file (.env-agent2), then run it with
# `docker compose --env-file .env-agent2 -f docker-compose.agent2.yml up -d`. # `docker compose --env-file .env-agent2 -f compose.agent2.yml up -d`.
# In the copy, change the project `name:` and `container_name` below — # In the copy, change the project `name:` and `container_name` below —
# otherwise compose project + container collide with the first agent. Two # otherwise compose project + container collide with the first agent. Two
# agents sharing one .env would share one auth record — unsupported and # agents sharing one .env would share one auth record — unsupported and