54 lines
1.8 KiB
Markdown
54 lines
1.8 KiB
Markdown
# 2. Docker Compose
|
||
|
||
`docker-compose.yml` in this repo starts:
|
||
|
||
- NATS JetStream **3-node cluster** (`nats1`–`nats3`) on an internal network
|
||
- **zappier-edge** `:3000`
|
||
- **middleware** `:3100` with `NATS_URL=nats://nats1:4222` and `MOCK_VERAE=true` by default
|
||
- **archive-worm** ×3 and **tree-node** ×3 (fleet floors) as long-running Node workers
|
||
- **aggregator** + **job-poller** stand-ins via middleware workers when `NATS_ENABLED=true`
|
||
|
||
NATS ports are **not** published to the host by default (private `verae` network). HTTPS edges are.
|
||
|
||
## Prereqs
|
||
|
||
Docker Engine 24+ and Compose v2. Clone **this repo** plus the application repos as siblings, **or** set `MONOREPO` to a checkout of `master-zapier-plan-draft`.
|
||
|
||
```bash
|
||
export MONOREPO=/path/to/master-zapier-plan-draft # contains packages/
|
||
docker compose up --build
|
||
curl -fsS http://127.0.0.1:3000/health
|
||
curl -fsS http://127.0.0.1:3100/health
|
||
```
|
||
|
||
Without `MONOREPO`, Compose expects `../zappier`, `../verae-zapier-middleware`, … (independent clones next to `verae-ops`).
|
||
|
||
## Link Zapier (cloud) to the lab
|
||
|
||
1. Publish zappier-edge on a TLS hostname (Caddy/nginx in front of `:3000`).
|
||
2. In the Zapier app env: `MIDDLEWARE_BASE_URL=https://<zappier-host>` (edge meters, then proxies).
|
||
3. Sign up on `/portal`, copy `x-api-key`.
|
||
|
||
## Scale
|
||
|
||
```bash
|
||
docker compose up --scale archive-worm=3 --scale tree-node=3
|
||
```
|
||
|
||
Do not publish `4222`. To debug NATS from the host:
|
||
|
||
```bash
|
||
docker compose exec nats1 wget -qO- http://127.0.0.1:8222/healthz
|
||
```
|
||
|
||
## Operator console
|
||
|
||
Fleet is **not** inside Compose by default (it SSH-spawns). On the Docker host:
|
||
|
||
```bash
|
||
cd $MONOREPO/packages/verae-fleet
|
||
NATS_URL=nats://127.0.0.1:4222 # only if you published 4222 on localhost for lab
|
||
node src/cli.js serve # http://127.0.0.1:3850/ loopback
|
||
```
|
||
|
||
For Compose-only labs, skip fleet; replica counts come from `--scale`.
|