Commit Graph
11 Commits
Author SHA1 Message Date
Mao NakamotoandClaude Opus 4.8 4b7ee8d63a fix(control+brand): purge dead Vercel refs, real favicon, honest badges/counts
Thorough cleanup after a full investigation of "so many things are wrong".

DEPLOYMENT — the "This deployment is temporarily paused" ghost. The canonical
host already moved to fleetcrown.orangecat.ch (Hetzner); the message came from
leftover references to the paused fleetcrown.vercel.app deployment:
- vercel.json: drop the `alias: ["fleetcrown.vercel.app"]` (the paused domain).
- scripts/fleet: install-cli POSTs to fleetcrown.orangecat.ch, not the dead URL.
- package.json: `ship` just pushes (the pre-push hook deploys to Hetzner);
  replace `wait:vercel` with `deploy` → scripts/deploy-hetzner.sh.
- delete scripts/wait-for-vercel.sh and orphaned desktop/.vercel/.
- repoint stale Vercel URLs in scripts/db/*.md and the local VAPID_SUBJECT.
(Fleet Runner already targets orangecat.ch in source — the user's "paused"
view is a stale installed build; the current v0.8.0 build/.deb is in desktop/dist.)

ICON — the browser-tab icon was blank/wrong:
- public/icon.svg drew the spiral at ~23% of the canvas with 0.7/0.95 opacity,
  so it vanished at 16px. Rescaled to fill ~62% at full contrast (shape
  unchanged, matches BrandMark.tsx).
- delete the stale src/app/favicon.ico (still the Next.js starter triangle);
  metadata already declares /icon.svg, so browsers now show the brand mark.

CONTROL honesty:
- Autopilot badge no longer shows a pulsing "Building" on every autopilot-on
  project (the default), which made idle projects look actively worked. It's now
  a static "Auto"/"Paused" policy chip; the pulse is reserved for real `working`.
- /activity stats (promptsSent/runsStarted) now come from real count(*)
  aggregates instead of the 200-capped row arrays (showed "200" when the true
  30-day count was 277).
- "Previous automated run" shows a crashed `running` row (no terminal write,
  >30min old) as "interrupted" instead of a live-looking "running" tag.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 14:21:26 +02:00
Mao NakamotoandClaude Opus 4.8 e1d212ad1a fix(runner): purge dead fleetcrown.vercel.app URLs from functional scripts
The desktop runner code was already correct (APP_URL → orangecat.ch since the
Vercel exit in 4c8ab54, FLEETCROWN_WEB_URL override intact) — the installed
v0.7.9 binary is just stale, built before that. But import-from-local.sh
(publicly served at /import-from-local.sh) still defaulted FC_API to the dead
fleetcrown.vercel.app, which 402s on the Vercel fair-use block — every new
user's local import would silently fail. Repoint it and two ops/test scripts
to fleetcrown.orangecat.ch. Rebuilt desktop bundle verified: orangecat ×9,
vercel ×0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 01:30:32 +02:00
Mao Nakamoto cdc042a131 feat: ship activity runtime parity fixes 2026-06-10 14:57:19 +02:00
Mao Nakamoto 152c8e9493 feat(db): bootstrap drizzle.__drizzle_migrations ledger (task #57)
Pre-this-commit, the Hetzner DB had ALL 26 historical migrations applied
(via drizzle-kit push during the v0.6 cutover, task #15) but ZERO rows in
drizzle.__drizzle_migrations because push doesn't write the ledger. As a
result drizzle-kit migrate would have tried to re-apply every migration
from scratch on its first run — failing on the first CREATE TABLE for an
already-existing table, OR worse, silently producing drift if any IF NOT
EXISTS / IF EXISTS guards saved the run.

This commit closes that gap permanently.

NEW scripts/db/bootstrap-migration-ledger.ts (175 lines):
  Reads all drizzle/NNNN_*.sql files. Computes sha256 of each (drizzle's
  canonical hash format). Modes:
    --dry-run (default)  Print the SQL it would apply
    --emit-sql           Print to stdout (pipe to psql)
    --write-journal      Update drizzle/meta/_journal.json locally
    --apply              Run against DATABASE_URL via psql -f
  Idempotent (uses ON CONFLICT DO NOTHING). Safe to re-run.

APPLIED to prod (postgresqlbridge.orangecat.ch):
  CREATE SCHEMA IF NOT EXISTS drizzle;
  CREATE TABLE IF NOT EXISTS drizzle.__drizzle_migrations (id, hash, created_at);
  CREATE UNIQUE INDEX __drizzle_migrations_hash_idx ON (hash);
  INSERT one row per migration (26 total) with computed sha256.
  Verified: SELECT count(*) FROM drizzle.__drizzle_migrations → 26.

WROTE drizzle/meta/_journal.json:
  26 entries, monotonic 'when' timestamps starting 2026-01-01.
  Future 'drizzle-kit generate' calls will append entries on top;
  'drizzle-kit migrate' will see existing entries' hashes match the
  ledger and skip them, applying only new migrations.

GOING FORWARD:
  Schema changes:  edit src/db/schema/*.ts → drizzle-kit generate → review
                   the new drizzle/NNNN_*.sql → drizzle-kit migrate to apply.
  No more direct 'drizzle-kit push' to prod (kept available for dev DBs).
  No more manual 'psql -f drizzle/NNNN_*.sql' shenanigans.

Tech debt this resolves:
  - Drift detection: works now. drizzle-kit migrate exits 0 if and only
    if the ledger matches the file hashes.
  - CI: future deploy pipelines can run drizzle-kit migrate as a step
    and have confidence in the result.
  - Team scaling: someone other than me can apply migrations without
    'how does this DB actually get migrated' tribal knowledge.

Verified: tsc clean, 19/19 control-presenter tests pass. Prod DB
unaffected outside the new drizzle schema.
2026-06-07 19:42:19 +02:00
Mao NakamotoandClaude Opus 4.7 9b80cc9137 chore(db): extend migration toolkit to OrangeCat / Supabase + both-on-one-host
Same job, one more source. Now the toolkit handles:
- FleetCrown out of Neon (`dump-from-neon.sh`)
- OrangeCat out of Supabase (`dump-from-supabase.sh`)
- Both consolidated onto one self-hosted Postgres box

scripts/db/dump-from-supabase.sh
  Mirrors dump-from-neon.sh's interface. Supabase-specific guards:
  - Refuses pooler URLs (port 6543 / pooler.supabase.com) because
    pg_dump fails midway through transaction-pooled connections.
  - Defaults to --schema=public only. Supabase's auth/storage/realtime/
    extensions schemas would create dangling-role FK errors on a vanilla
    Postgres target. FULL_DUMP=1 dumps everything when self-hosting
    gotrue too (bigger project for another day).
  - Same .sql + .manifest.txt output shape as the Neon script;
    restore-to-target.sh accepts either without modification.

scripts/db/BOTH_PRODUCTS_ONE_HOST.md
  Layers two databases (`fleetcrown`, `orangecat`) on a single Postgres
  instance with separate roles and per-role pg_hba.conf lines. Covers:
  - role + database setup
  - pg_hba rules: each role authenticates only to its own DB
  - migration sequence: FleetCrown first (it's broken), OrangeCat
    second (still functional on Supabase)
  - auth-stays-on-Supabase recommendation for OrangeCat (cheap, no
    gotrue self-host needed at this scale)
  - shared backup cron with off-box rsync mirror
  - PgBouncer add-on for when connection count balloons
  - explicit "when to split the box" thresholds (sustained 70% CPU,
    <95% cache hit ratio, p95 latency >50ms)

scripts/db/README.md
  Updated header + file table to mention both products. Migration
  cookbook now has separate Step 1 entries for Neon vs Supabase and
  points at BOTH_PRODUCTS_ONE_HOST.md for the dual-product path.

Capacity sanity for the curious: a Hetzner CX22 (€4.51/mo, 2 vCPU, 4 GB
RAM, 40 GB SSD) is over-provisioned by ~3 orders of magnitude for both
products at today's scale (single-user each). Upgrade in-place to CX32
when sustained CPU exceeds 70% — that's many months out.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-04 09:04:53 +02:00
Mao NakamotoandClaude Opus 4.7 a59180cb18 chore(db): migration toolkit for Neon → Hetzner / Oracle Free
Grab-and-place migration kit so we can move off Neon (which capped our
data transfer earlier today) on ~30 min notice when the quota resets or
we upgrade the plan just long enough to dump.

scripts/db/dump-from-neon.sh
  pg_dump + emit a manifest of pg_stat_user_tables row counts. Plain SQL
  format (auditable, diff-friendly). Halts the script if SOURCE_DATABASE_URL
  is missing.

scripts/db/restore-to-target.sh
  psql --single-transaction --set ON_ERROR_STOP=on against the new host.
  Refuses to overwrite a target that already has users rows (set
  RECREATE_DB=1 to force). After restore, compares pg_stat_user_tables
  row counts against the source manifest and halts if any table
  mismatches — keeps a botched migration from making it to "flip Vercel."

scripts/db/SETUP_HETZNER.md
  Runbook from "open Hetzner account" to "Vercel deployed + smoke passes"
  for a CX22 (~€4.5/mo). Covers Postgres 17 install, SSL, ufw, fail2ban,
  pg_hba, env swap, smoke. ~30 min end-to-end.

scripts/db/SETUP_ORACLE_FREE.md
  Same shape for Oracle Always-Free ARM (4 OCPU / 24 GB / free forever).
  Calls out the gotchas: dual firewall (Oracle Security List + iptables),
  ARM-specific Postgres package source, idle-reclamation risk.

scripts/db/README.md
  6-step end-to-end migration cookbook tying the scripts and runbooks
  together. Why pg_dump over Drizzle migrations: data move, not schema
  sync. Why keep the Neon dump cold for 30 days post-migration.

Today the toolkit can't actually run end-to-end because Neon's quota is
blocking pg_dump. That'll clear on monthly reset (or with a one-month
plan upgrade just long enough to dump). When it does, the full migration
is a coffee break, not a project.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-04 08:15:13 +02:00
Georgy Butaev e30c842869 feat(desktop) + fix(design,lint): project selection + auto-sync + Sync to Web (ck_* token); canonical injectIntoTab + real appendEvent bridge.dispatch/worker.started in Fleet Runner runtime (replaces fake in-memory); hardened zellij.ts (session resolution + -- write-chars); ui-public-download-* + --public-accent (zero design violations); full cockpit->fleetcrown rebrand in desktop/scripts/docs/thoughts/marketing/home; update desktop README + docs/desktop-app.md with capabilities + gaps (in-memory vs real log)
- desktop build clean, tsc clean, lint 0, home/ 89/89
- advances desktop-2/3: dispatches now produce durable events in ~/.fleetcrown/events.jsonl with proper runId/sentinel so stop-hooks and web control plane treat them as first-class
- still no embedded watcher (idle via co-running home/watcher.ts for now)

Refs: desktop-app.md phases, Cockpit.roadmap T1/T2, prior landing 2d98638
2026-06-02 14:54:51 +02:00
Georgy Butaev b08ac4da14 feat(desktop): project selection + auto-sync on connect + Sync to Web (agent token to /runtime-state); switch to canonical injectIntoTab; ui-public-download-* classes (zero design violations); forward custom prompts as queueHead; clean lint; broad docs/marketing/scripts updates for FleetCrown desktop runtime 2026-06-02 12:17:12 +02:00
g-but 8be96443fc fix(control): sync daemon runtime source of truth 2026-05-28 07:38:21 +02:00
g-but f20e520268 feat(infra): oracle-await script + cutover SKIP_DUMP/NODE_ENV hardening
Finishes the Oracle migration plumbing started in ec6f423. Three pieces:

1. scripts/db/oracle-await-cutover.sh — polls
   ~/.config/cockpit/oracle-migration.env every 15s for ORACLE_HOST
   (timeout 7200s by default), then runs oracle-cutover.sh with
   SKIP_DUMP=1 once the IP is set. Lets the operator launch this
   before creating the VM in the Oracle console; cutover fires
   automatically the moment the public IP lands in the config.

2. scripts/db/oracle-cutover.sh — SKIP_DUMP=1 reuses an existing
   pre-oracle-cutover.sql.gz instead of re-dumping prod, so the await
   loop doesn't double-dump on every retry; env -u NODE_ENV wraps
   `npm run build` and `vercel deploy`/`vercel redeploy` so the
   ambient NODE_ENV=production from systemd or .env files can't
   poison the build's mode resolution.

3. package.json — adds db:oracle-await alias.
2026-05-24 23:18:12 +02:00
g-butandCursor ec6f423b0f feat(infra): Postgres portability, Oracle cutover scripts, and DB kill-switch essay
Vendor-neutral DATABASE_URL helpers, dump/restore/sync tooling, and one-command
Oracle migration after a single console VM step. Publishes the studio-stack
thoughts article and hardens build (dynamic layout, resilient sitemap).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-23 11:24:20 +02:00