Skip to content

Commit bd2eda8

Browse files
docs: document hermit d1 deploy flow
1 parent f55dcd1 commit bd2eda8

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

bot-management.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,37 @@ Gateway forwarder:
5555

5656
The old in-Worker Cloudflare Gateway Durable Object setup is no longer the active gateway path. Gateway events now come through the external forwarder.
5757

58+
### Hermit D1 and deploy setup
59+
60+
Hermit uses Cloudflare D1 for persistent bot state, including clawtributor claim dedupe and other operational records. Drizzle owns the TypeScript schema and generates SQL migration files in the repo; Wrangler applies those migrations to the Cloudflare D1 database.
61+
62+
Relevant repo paths:
63+
64+
```text
65+
src/db/schema.ts
66+
drizzle/
67+
wrangler.jsonc
68+
```
69+
70+
Operational model:
71+
72+
- Cloudflare Workers Builds deploys Hermit from the `main` branch.
73+
- The Cloudflare Builds deploy command should be `bun run deploy:cf`.
74+
- `bun run deploy:cf` runs remote D1 migrations first, then deploys the Worker.
75+
- Do not add a separate GitHub Actions deploy workflow for Hermit; Cloudflare Builds is the deployment source of truth.
76+
- `wrangler.jsonc` should keep the D1 binding named `DB` and `migrations_dir` set to `drizzle`.
77+
78+
Useful commands:
79+
80+
```bash
81+
bun run db:generate # generate Drizzle SQL migrations
82+
bun run db:apply:local # apply migrations to local D1
83+
bun run db:apply:remote # apply migrations to production D1
84+
bun run deploy:cf # Cloudflare Builds deploy command: migrate, then deploy
85+
```
86+
87+
D1 migration changes should be reviewed carefully before merge. If a migration is merged, confirm Cloudflare Builds is still configured to run `bun run deploy:cf`; otherwise the Worker may deploy without its expected database schema.
88+
5889
### Hermit gateway forwarder setup
5990

6091
The forwarder exists because the main Hermit bot runs on Cloudflare Workers, while Discord Gateway connections need a long-lived process. The forwarder connects to Discord, listens for gateway events, signs each event, and sends it to the Worker's `/events` route.

0 commit comments

Comments
 (0)