mirror of
https://github.com/esengine/DeepSeek-Reasonix.git
synced 2026-11-07 10:45:59 -10:00
Opt-in metrics carried the anonymous install id so the dashboard could show a deduplicated daily user per signal. Keeping that answer meant keeping a row per install per signal per day — ~28M of them — and the 30-day COUNT(DISTINCT install_id) over that table was the database's entire read bill: the primary key leads with `date`, so each query could prune only the window and scanned the whole table, eight signals an hour, ~5.4B rows a day for one module. The client stops sending the id, the worker stops writing and creating the tables, the hourly rollup that existed only to make that query survivable is gone, and the dashboard's users/opens toggle goes with it. The aggregate tables keep the same signals as event counts in ~180k rows. migrate-drop-metric-users.sql drops the four retired tables. Deploy the worker first — it stops creating them at runtime, and a DROP before that is rebuilt on the next request.
72 lines
2.7 KiB
TOML
72 lines
2.7 KiB
TOML
# Deploy: wrangler d1 create reasonix-crash → paste database_id → wrangler deploy.
|
|
name = "reasonix-crash-report"
|
|
main = "src/index.ts"
|
|
compatibility_date = "2026-06-01"
|
|
|
|
routes = [{ pattern = "crash.reasonix.io", custom_domain = true }]
|
|
|
|
# First entry: daily retention purge (03:47 Beijing) — drops time-series rows
|
|
# past the dashboard's query horizon so the D1 database plateaus instead of
|
|
# hitting the size cap and failing every ingest write (purgeExpiredStatsRows).
|
|
# Second entry: ingest sentinel four times a day (runIngestSentinel) — canary
|
|
# write + checkpointed ping growth; alerts via the optional ALERT_WEBHOOK worker
|
|
# secret, log-only when unset. The secret is mirrored from the GitHub repo
|
|
# secret of the same name by deploy-crash-worker.yml on every deploy — set it
|
|
# under repo Settings → Secrets → Actions, no Cloudflare login needed. The
|
|
# sentinel expression must stay in sync with SENTINEL_CRON in src/index.ts.
|
|
[triggers]
|
|
crons = ["47 19 * * *", "17 1,7,13,19 * * *"]
|
|
|
|
[vars]
|
|
# Emails force-promoted to dashboard admin — the owner is never locked out even
|
|
# if the role migration misses them.
|
|
ADMIN_EMAILS = "[email protected]"
|
|
# Shared identity service (resolves the session) and the site hosting its login
|
|
# page. Override for local dev.
|
|
ID_ORIGIN = "https://id.reasonix.io"
|
|
APP_ORIGIN = "https://reasonix.io"
|
|
# Browsers allowed to call the folded registry API with credentials.
|
|
ALLOWED_ORIGINS = "https://reasonix.io,https://www.reasonix.io"
|
|
|
|
[[d1_databases]]
|
|
binding = "DB"
|
|
database_name = "reasonix-crash"
|
|
database_id = "54825184-366f-4877-80fc-924efab0239b"
|
|
|
|
# Skill/MCP registry data plane, folded in from the standalone worker. Before
|
|
# merging (the crash worker auto-deploys on push to main-v2):
|
|
# wrangler d1 create reasonix-registry # paste the id below
|
|
# wrangler d1 execute reasonix-registry --remote --file=registry-schema.sql
|
|
[[d1_databases]]
|
|
binding = "REGISTRY_DB"
|
|
database_name = "reasonix-registry"
|
|
database_id = "83786761-5cc5-487d-8624-5cf565d1a57c"
|
|
|
|
[[unsafe.bindings]]
|
|
name = "RATE_LIMITER"
|
|
type = "ratelimit"
|
|
namespace_id = "1001"
|
|
simple = { limit = 5, period = 60 }
|
|
|
|
# Looser than RATE_LIMITER: many installs can share one office/campus NAT IP.
|
|
[[unsafe.bindings]]
|
|
name = "PING_LIMITER"
|
|
type = "ratelimit"
|
|
namespace_id = "1002"
|
|
simple = { limit = 30, period = 60 }
|
|
|
|
# Opt-in metrics flush fires once per launch like the ping; its own bucket so it
|
|
# never eats the ping budget on a shared NAT IP.
|
|
[[unsafe.bindings]]
|
|
name = "METRICS_LIMITER"
|
|
type = "ratelimit"
|
|
namespace_id = "1003"
|
|
simple = { limit = 30, period = 60 }
|
|
|
|
# Per-IP throttle for registry writes (publish / install-ping / star).
|
|
[[unsafe.bindings]]
|
|
name = "WRITE_LIMITER"
|
|
type = "ratelimit"
|
|
namespace_id = "3001"
|
|
simple = { limit = 30, period = 60 }
|