Skip to content

Commit cda1007

Browse files
authored
Merge pull request #6 from hypercerts-org/docs/certified-one-readme
docs: refresh orglabeler deployment docs
2 parents 929ed42 + 6f039f5 commit cda1007

11 files changed

Lines changed: 213 additions & 515 deletions

File tree

.env.example

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# DID of your labeler account (e.g. did:plc:xxxx)
22
DID=did:plc:your-labeler-did
33

4-
# Signing key for the labeler (hex-encoded private key)
4+
# Private signing key for the labeler
55
SIGNING_KEY=your-signing-key
66

7-
# Bluesky account credentials for the labeler bot
8-
BSKY_IDENTIFIER=your-handle.bsky.social
9-
BSKY_PASSWORD=your-app-password
7+
# Labeler account credentials
8+
LABELER_IDENTIFIER=orglabeler.certified.one
9+
LABELER_PASSWORD=your-app-password
1010

1111
# Public HTTP port for Caddy. Hosted platforms usually set PORT automatically.
1212
PORT=8080
@@ -29,12 +29,12 @@ ACTIVITY_DB_PATH=activity-log.db
2929
# Path to the labels database (used by @skyware/labeler LabelerServer)
3030
LABELS_DB_PATH=labels.db
3131

32-
# Public URL of the Caddy-fronted app/labeler endpoint (e.g. https://labeler.yourdomain.com)
32+
# Public URL of the Caddy-fronted app/labeler endpoint (e.g. https://orglabeler.hypercerts.dev)
3333
# /xrpc/* is routed to the labeler and dashboard/API routes are routed to Next.js.
34-
NEXT_PUBLIC_LABELER_ENDPOINT=https://labeler.yourdomain.com
34+
NEXT_PUBLIC_LABELER_ENDPOINT=https://orglabeler.hypercerts.dev
3535

3636
# PDS URL for the labeler account (auto-detected during setup, override if needed)
37-
PDS_URL=https://climateai.org
37+
PDS_URL=https://certified.one
3838

3939
# External Tap service URL. Tap runs as a separate service, not inside this app container.
4040
TAP_URL=https://your-tap-service.example.com

AGENTS.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ This is the **Certified Organization Labeler** fork — an AT Protocol labeler f
77
```
88
src/
99
├── app/ # Next.js App Router (dashboard)
10-
│ ├── api/ # API routes (read from activity-log.db)
10+
│ ├── api/ # API routes (read from configured ACTIVITY_DB_PATH)
1111
│ ├── feed/ # Feed page with tier filtering
1212
│ ├── globals.css # Tailwind v4 design system (OKLCH)
1313
│ ├── layout.tsx # Root layout with fonts + theme
1414
│ └── page.tsx # Dashboard page
15-
├── components/ # React components (all "use client")
15+
├── components/ # React UI components (client components only where interactive)
1616
├── labeler/ # Standalone labeler process (NO React/Next.js imports)
17-
│ ├── start.ts # Entry point: spawns Tap sidecar + LabelerServer
17+
│ ├── start.ts # Entry point: LabelerServer + workers + external Tap connection
1818
│ ├── tap-consumer.ts # Tap client, SimpleIndexer record handler
1919
│ ├── server.ts # Label application logic
2020
│ ├── setup.ts # Account setup (PDS-aware)
@@ -34,26 +34,31 @@ src/
3434
1. **src/labeler/ must NEVER import from React or Next.js** — it runs as a standalone Node.js process
3535
2. **src/lib/ is shared** — importable by both labeler and Next.js, but must not import from src/labeler/
3636
3. **src/components/ and src/app/ are Next.js only** — they can import from src/lib/ but never from src/labeler/
37-
4. **Two databases**: labels.db (AT Proto, managed by @skyware/labeler) and activity-log.db (dashboard, managed by src/lib/db.ts)
37+
4. **Two app databases**: `LABELS_DB_PATH` (AT Proto, managed by @skyware/labeler) and `ACTIVITY_DB_PATH` (dashboard, managed by src/lib/db.ts)
3838
5. **Design system**: Tailwind CSS v4, OKLCH colors (hue 260), Syne display font, no component libraries
3939
6. **Code style**: no semicolons, single quotes, 2-space indent
4040

4141
## Development
4242

4343
```bash
44-
npm run dev:all # Start dashboard + labeler together
45-
npm run build # Verify Next.js build passes
46-
npm run reset # Clear databases for fresh start
44+
npm run dev:service # Start dashboard + labeler together
45+
npm run build # Verify Next.js build passes
46+
npm run test # Run Node test suite
47+
npm run reset # Clear local databases for fresh start
4748
```
4849

49-
## Issue Tracking
50+
## Documentation Maintenance
5051

51-
This project uses **hb** (heartbeads) for issue tracking.
52+
When behavior, configuration, deployment, scripts, or operator workflow changes, check whether the relevant docs need updates in the same change.
5253

53-
```bash
54-
hb ready # Find available work
55-
hb show <id> # View issue details
56-
hb update <id> --status in_progress # Claim work
57-
hb close <id> # Complete work
58-
hb sync # Sync with git
59-
```
54+
Current docs to consider:
55+
56+
- `README.md` — project overview, setup, scripts, env vars, production shape
57+
- `DEPLOYMENT.md` — generic hosted deployment guidance
58+
- `RAILWAY.md` — Railway-specific deployment guidance
59+
- `AGENTS.md` — agent-facing architecture, workflow, and maintenance instructions
60+
- `src/app/docs/page.tsx` — dashboard documentation shown in the app
61+
- `.agents/skills/orglabeler/SKILL.md` — downstream consumer integration guidance
62+
- `.env.example` — documented environment variable defaults/examples
63+
64+
If a new documentation file is introduced, add it to this list and include when it should be checked.

DEPLOYMENT.md

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -40,59 +40,67 @@ The direct Caddy route is required for `subscribeLabels`, because it is a WebSoc
4040

4141
## Environment variables
4242

43-
### Required for the running service
43+
### Required for the running app service
4444

45-
- `DID` — labeler DID
46-
- `SIGNING_KEY`labeler private key used by `@skyware/labeler`
47-
48-
These are validated at startup by `src/lib/config.ts`.
45+
- `DID` — labeler account DID
46+
- `SIGNING_KEY` — private key material used by `@skyware/labeler` to sign labels
47+
- `TAP_URL` — URL of the separate Tap service; there is no localhost fallback
48+
- `NEXT_PUBLIC_LABELER_ENDPOINT` — public HTTPS base URL for the dashboard and labeler XRPC endpoint
4949

5050
### Required for first-time labeler setup / label sync
5151

52-
- `BSKY_IDENTIFIER`
53-
- `BSKY_PASSWORD`
54-
- `NEXT_PUBLIC_LABELER_ENDPOINT`
55-
56-
Use these with `npm run setup` and `npm run set-labels` when registering the labeler account and label definitions.
57-
58-
### Required for the app service to reach Tap
52+
- `LABELER_IDENTIFIER` — labeler account identifier, for example `orglabeler.certified.one`
53+
- `LABELER_PASSWORD` — labeler account password or app password
54+
- `PDS_URL` — optional override for the labeler account PDS; setup normally resolves this from the DID document
5955

60-
- `TAP_URL` — required URL of the separate Tap service
56+
Use these with `npm run setup` and `npm run set-labels` when registering the labeler account and label definitions. The labeler account identifier is the signing source; `NEXT_PUBLIC_LABELER_ENDPOINT` is the hosted app endpoint and may be a different domain.
6157

6258
### SQLite paths
6359

6460
Set these to persistent storage in hosted environments:
6561

66-
- `ACTIVITY_DB_PATH` (default `activity-log.db`)
67-
- `LABELS_DB_PATH` (default `labels.db`)
62+
- `ACTIVITY_DB_PATH` (code default `/data/activity-log.db`)
63+
- `LABELS_DB_PATH` (code default `/data/labels.db`)
6864

69-
### Tap service storage
65+
### Tap service settings
7066

7167
The Tap service manages its own persistent SQLite file and any Tap-specific settings outside this repo.
7268

73-
If your Tap deployment uses admin auth, configure `TAP_ADMIN_PASSWORD` on the Tap service itself.
69+
If your Tap deployment uses admin auth, configure `TAP_ADMIN_PASSWORD` on the Tap service itself and set the same `TAP_ADMIN_PASSWORD` on the app service so health checks and the Tap WebSocket can authenticate.
7470

75-
### Optional
71+
### Optional app settings
7672

77-
- `HF_TOKEN` — enables HuggingFace classification; if unset, HF scoring stays disabled
78-
- `PDS_URL`overrides PDS discovery from the DID document
73+
- `HF_TOKEN` — enables Hugging Face classification; if unset, HF scoring stays disabled
74+
- `HYPERSCAN_RECORD_URL_BASE`base URL used when the dashboard links to source AT Protocol records; default `https://hyperscan.dev/data`
7975
- `TEST_PDS_HOSTS` — comma-separated PDS hosts whose actors should always be labeled `likely-test`; URL enrichment waits for actor PDS resolution and skips matching test PDS hosts
80-
- `PORT` — public Caddy HTTP port (hosted platforms usually set this; default fallback `8080`)
76+
- `TRUSTED_PDS_HOSTS` — comma-separated PDS hosts whose actors receive the trusted-PDS score bonus; default `certified.one,gainforest.id`
77+
- `TRUSTED_PDS_BONUS` — score points added for trusted actor PDS hosts; default `10`
78+
- `PORT` — public Caddy HTTP port (hosted platforms usually set this; Caddy fallback `8080`)
8179
- `NEXT_PORT` — internal Next.js HTTP port (`3000` by default)
82-
- `HOST` — bind host for the labeler server (`127.0.0.1` is recommended when Caddy runs in the same container)
80+
- `HOST` — bind host for the labeler server (`0.0.0.0` by default; `127.0.0.1` is recommended when only same-container Caddy should reach it)
8381
- `LABELER_PORT` — internal labeler HTTP port (`4100` by default)
8482
- `METRICS_PORT` — metrics port (`4101` by default)
85-
- `RESET_DB=true` — deletes the SQLite files before startup
83+
- `RESET_DB=true` — deletes configured app SQLite files plus WAL/SHM companions before startup; remove it after one reset
84+
- `URL_ENRICHMENT_ENABLED` — enables async URL checks through `url_checks`; default `true`
85+
- `URL_CHECK_INTERVAL_MS` — poll interval for processing due URL checks; default `1000`
86+
- `URL_CHECK_DISCOVERY_INTERVAL_MS` — how often the URL worker scans local snapshots for newly referenced URLs; default `30000`
87+
- `URL_CHECK_TIMEOUT_MS` — timeout for one URL resolution attempt; default `4000`
88+
- `URL_CHECK_OK_TTL_MS` — freshness window for successful URL checks; default `604800000`
89+
- `URL_CHECK_FAILED_TTL_MS` — downgrade window for hard failed URL checks before another attempt; default `86400000`
90+
- `URL_CHECK_RETRY_BASE_MS` — initial retry delay for temporary URL check failures; default `300000`
91+
- `URL_CHECK_MAX_RETRY_MS` — maximum retry delay for temporary URL check failures; default `3600000`
92+
- `URL_CHECK_HARD_FAILURE_ATTEMPTS` — number of hard failures required before URL scoring removes resolve points; default `2`
93+
- `URL_CHECK_MAX_URLS_PER_DID` — maximum profile/organization URLs cached and checked per DID; default `5`
8694

8795
## Persistence requirements
8896

8997
This fork uses two SQLite databases in the app service and one in the Tap service:
9098

91-
- `activity-log.db` — dashboard data and scoring history
92-
- `labels.db` — AT Protocol label records
93-
- `tap.db` — Tap cursor / replay state (Tap service)
99+
- `ACTIVITY_DB_PATH` — dashboard data and scoring history
100+
- `LABELS_DB_PATH` — AT Protocol label records
101+
- Tap service database — Tap cursor / replay state
94102

95-
The app service should mount a volume for `activity-log.db` and `labels.db`. The Tap service should mount its own volume for `tap.db`. If the files are not persisted, redeploys will lose dashboard history and Tap will replay from an old or empty cursor.
103+
The app service should mount a volume for the configured `ACTIVITY_DB_PATH` and `LABELS_DB_PATH`. The Tap service should mount its own volume for its database. If the files are not persisted, redeploys will lose dashboard history and Tap will replay from old or empty state.
96104

97105
Also persist the `-wal` and `-shm` companions that SQLite may create beside each DB file.
98106

0 commit comments

Comments
 (0)