Files
Felix FaerberandClaude Opus 5 b4c62905e6 Add stamp-monitor; move Bee to 2.8.1
This is the config that was already running on the host, brought back
into the repo where it belongs, plus the Bee bump it implies.

stamp-monitor watches prod_bee's postage batches and renews them before
they lapse. It exists because nothing did: the gateway's batch fell under
minTtlDays, the gateway tried to renew it itself, the top-up (64.64 xBZZ
on a depth-24 batch) exceeded the wallet, and the throw took down every
route that boots the gateway context. A batch running out was never
supposed to be able to return 500 on /v1/models.

It runs next to Bee rather than reading the chain from elsewhere because
bucket fullness is not on-chain -- stamps are off-chain signatures, so
only a node that saw them knows how full a batch is. A batch can be fully
funded and still refuse writes, and that is the failure the chain cannot
show you.

Bee 2.8.0 -> 2.8.1 for a related reason: 2.8.0 omits utilizationRatio
from /stamps, so a batch at 215 of 256 reported as empty. An absent
number read as zero, and zero means "plenty of room" -- fullness alerts
would have stayed quiet on exactly the batch that needed them. The
monitor now derives the figure either way, but the node should not be the
thing lying. Digest-pinned: this node holds a chequebook and a stake.

BEE_STAMP_MANAGE defaults to false in the example now, and the batch ID
is pinned. Leaving the managed path reachable is what caused the outage,
and an empty BEE_POSTAGE_BATCH_ID is what re-enables it.

The dashboard is deliberately not routed through Traefik -- it can spend
xBZZ. Readme documents the tunnel instead.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YLYiaPYror1vLKApYKrxTu
2026-08-19 01:57:18 +03:00

54 lines
2.0 KiB
Bash

# Production .env for the hosted-gateway swarm stack.
# Copy to .env on the Hostinger host, chmod 600, and `docker stack deploy`.
# DATABASE_URL, REDIS_*, BEE_API_URL are set in prod-stack.yaml — do NOT
# override here (the stack file uses internal DNS names).
# --- Auth ---
JWT_SECRET_KEY=change-me-to-a-long-random-string
GOOGLE_OAUTH_CLIENT_ID=
# --- Operator wallet (the ONLY on-chain identity) ---
# Holds xBZZ + xDAI for all tenants. Funded once at bootstrap.
OPERATOR_PRIVATE_KEY=0x...
GNOSIS_RPC_URL=https://rpc.gnosischain.com
# --- T4T protocol contracts (Gnosis mainnet) ---
REGISTRY_ADDRESS=0xf81121AAbc2F7261224BaDd0Ed871711e6D1371E
ESCROW_ADDRESS=0x34Db8E014E71928f17E23eC1272B602582222c9c
XBZZ_ADDRESS=0xdBF3Ea6F5beE45c02255B2c26a16F300502F68da
# --- Bee node ---
# Pin the batch explicitly. It used to be bought on first deploy and left to
# the gateway to manage, which is how the outage happened: the batch fell
# under minTtlDays, the gateway tried to renew it, the renewal cost more xBZZ
# than the wallet held, and the throw took down every route that boots the
# gateway context. Renewal now belongs to stamp-monitor, which has spend caps
# and alerts; the gateway just uses the batch it is given.
#
# Must be set. An empty value here is what re-enables the path above.
BEE_POSTAGE_BATCH_ID=
BEE_STAMP_MANAGE=false
BEE_STAMP_LABEL=hosted-gateway
BEE_STAMP_TTL_DAYS=30
# Used by the Bee service itself (BEE_*_PASSWORD vars below):
BEE_PASSWORD=change-me
# --- Pricing ---
MARKUP_BPS=2000
WELCOME_XBZZ_WEI=50000000000000000000
# --- Concurrency / server ---
MAX_CONCURRENT_JOBS=200
LOG_LEVEL=info
# --- Phase 2 (Stripe) — leave blank in v1 ---
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=
# --- stamp-monitor ---
# Bearer token for the monitor's dashboard and admin API. That UI can spend
# xBZZ (manual top-up), so treat it as a spending credential, not a viewer
# login. Generate with `openssl rand -hex 32`; never commit the real value.
STAMP_MONITOR_ADMIN_TOKEN=change-me