Files
zeekayandHanzo Dev dd55a53dcd Native CI/CD, and the CoinGecko tier stops being a guess
The repo built on GitHub Actions and deployed from hand-applied k8s/ manifests.
Both are retired: .hanzo/workflows/{ci,release}.yml run on lux-build-linux-amd64
and push ghcr.io/luxfi/price, and the deployment is declared in luxfi/universe
where CD reconciles it. Deleting .github/workflows is not only about GitHub —
this forge's WORKFLOW_DIRS includes it, so those files were firing here too.

THE TIER IS NOW DECLARED, NEVER INFERRED. NewPriceCache tried to detect Pro vs
Demo from the key's shape and could not: both are "CG-" plus alphanumeric. So the
branch assigned the demo host on BOTH sides, coingeckoProURL was referenced
nowhere in the program, and every request went out under x-cg-demo-api-key. A Pro
key was being throttled at the free tier with nothing in the logs to say so,
because the demo host answers a Pro key perfectly well — just slower. Host and
header now derive from one COINGECKO_TIER flag so they cannot drift, and an
unrecognised value falls back to demo, which is the safe wrong answer: a Pro key
on demo is throttled, a demo key against Pro is refused.

THE CACHE WAS ONE HOUR. That is a display-ticker number and a dangerous one the
moment a price sizes an amount of money — an hour of BTC is routinely a few
percent, and that gap is slippage somebody eats. Default is one minute,
PRICE_CACHE_TTL overrides, and a malformed or non-positive value REFUSES TO
START rather than silently defaulting: "0s" means no cache at all and burns the
upstream quota in minutes.

⚠ This cache must never price a settlement. It answers "what is BTC worth
roughly, now" for display and for sizing a quote. It does not answer "what did
this deposit realise" — that question's correct answer is the executed fill, and
no cache is it. Stated where someone would otherwise reach for it.

The repo had zero tests. It has three, and both the one-hour TTL and the
demo-host-on-the-pro-branch fail them.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-06 19:30:16 -07:00

18 lines
521 B
YAML

services:
price:
build: .
ports:
- "8080:8080"
environment:
# Optional, and `:-` says so. `:?` refused to start without a key the
# service has never required — unset, it uses the anonymous CoinGecko
# endpoint and says so in the log.
- COINGECKO_API_KEY=${COINGECKO_API_KEY:-}
- PORT=8080
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3