Files
crosscode-platform/docs/HANDOVER.md
T
2026-11-26 14:37:59 +02:00

16 KiB
Raw Blame History

Handover — Cross Code, all products

Last updated: 2026-11-26. The plan is ROADMAP-v3.md (decided 2026-11-03, decisions table near the end). This file says where each phase stands and what comes next. Product-specific notes (where the code lives, known gaps) stay with each product: Cross Events' are in apps/events/docs/HANDOVER.md, and the Hub's are in events-hub/docs/ and events-hub/deployment.md.

The docs for every product are here in docs/: the roadmap, the Hub protocol (hub-protocol.md, with a copy in events-hub), this handover, the plans for each phase and the rollout checklist (ROLLOUT-1.0.md). The latest version of everything, and what's deployed, is in VERSIONS.md (update it with every release).

Repos

Repo What
joshua/crosscode-platform (this one) Contracts, the apps (Events from 2.2.0; Accounts, Website and App to come), shared packages, the crosscode script (scripts/), the server agent (apps/agent), and these docs
joshua/hope-events Cross Events up to 2.1.x. Frozen; archived once every install is adopted (EVENTS-2.2-PLAN §7)
joshua/events-hub Cross Code Hub. Its own server, its own scripts/deploy.sh
joshua/crosscode-site crosscode.co.za. Updated at the end of every phase that changes what it says (ROADMAP §9)

Where each phase stands (ROADMAP §9)

Phase What State
0 contracts 1.0.0 → 1.17.0 Released and in use. Not published to a registry (decision 22): the Hub gets a packed release committed to its repo (backend/vendor/)
1 Hub 2.0 → 2.20.0 Released, deployed and tested (Hub v2.20.0)
1b Cross Events 2.2.0: moved here as apps/events, the crosscode script Released, rolled out and tested. Every install adopted onto the monorepo
1c Cross Events 2.3.x: authenticator app 2FA Released and rolled out (carried into Accounts in phase 4)
1d Agent 1.x + Hub 2.1+ Released, rolled out and tested (agent 1.5.0 on every server: from 1.4.0 the Hub reads and changes frps's / frpc's config and probes ports before an install; from 1.5.0 one product of a church can be uninstalled, exported or purged)
2 Cross Events 2.4.0: protocol v2, Linked products, event feed, packages/seo Released, rolled out and tested (EVENTS-2.4-PLAN.md)
3 Accounts 1.0.0 Released, rolled out and tested (now accounts@1.6.0; ACCOUNTS-1.0-PLAN.md)
4 Cross Events 3.0.0: sign-in through Accounts Released, rolled out and tested (now events@3.7.0; EVENTS-3.0-PLAN.md). Churches sign in through their Accounts; crosscode-site v1.6.0 deployed
4+ Running it: jobs from the dashboard, styled emails, .env from the Hub, sign-in health, the nightly people check; then frp config and one-product uninstalls, and the Hub's popups, pickers and port list Released, deployed and tested 2026-11-20 and 2026-11-23 (below)
5 Church Website 1.0.0 Released 2026-11-26 (planned 2026-11-21: WEBSITE-1.0-PLAN.md, all decisions confirmed). Font pairings confirmed 2026-11-24, section variants per template 2026-11-25 (§3). contracts@1.17.0, accounts@1.7.0 and events@3.7.0 released 2026-11-24, Hub v2.21.0 2026-11-25 (the Hub deployed 2026-11-25; the others not rolled out yet). contracts@1.18.0 and Hub v2.22.0 (Get more storage) released 2026-11-25, the Hub deployed 2026-11-26. website@1.0.0 and 1.0.1 released 2026-11-26, crosscode-site v1.7.0 (the Website on sale) released 2026-11-26, not deployed yet. Left: deploy the site, Hope Family Church, a second church
6–7 App 1.0.0 → App 1.x Not started

Released 2026-11-23

All tagged, pushed and deployed on 2026-11-23. Details in VERSIONS.md and the Hub's CHANGELOG.

Release What
agent@1.4.0, contracts@1.15.0, Hub v2.11.0 The agent finds frps's / frpc's config wherever it is (TOML too); each server's Hub page reads and changes it (secrets stay on the server, verify, backup, put back if frp doesn't start, two-factor). New installs probe their ports on the central and church server first (probe-ports)
agent@1.5.0, contracts@1.16.0, Hub v2.12.0, crosscode script Uninstall, export and purge one product of a church (`crosscode uninstall
Hub v2.13.0 Alerts cleared by hand; billing tables sortable
Hub v2.14.0 – v2.17.0 Customer and install pages as a header, tiles and tabs; every add and edit in a popup (frontend only)
Hub v2.18.0, v2.19.0 Releases picked from a list; the server agent's own releases on the Releases page and in Update agent (migration AgentRelease)
Hub v2.20.0 The port list says what each port is for; frps's allow_ports checked against it
crosscode.co.za v1.6.1 Clearer web address choices on the Cross Events page

Released 2026-11-20

All tagged, pushed, deployed and tested (confirmed by Joshua 2026-11-21). Details in CHANGELOG.md, the apps' CHANGELOGs and What's New, and VERSIONS.md.

Release What
events@3.4.0, accounts@1.4.0, contracts@1.12.0, agent@1.3.0, Hub v2.8.0 Background jobs switched on/off and rescheduled from each site's admin (saved in job_overrides, wins over the .env, applies at once; Accounts gets an Admin → Background jobs page). Accounts' emails styled as Events' (src/lib/emails.ts). The Hub reads and changes an install's .env (env-read / env-set jobs → crosscode env; secrets never leave the server; the file is put back if the site doesn't start; the frontend's file triggers a rebuild)
events@3.5.0, contracts@1.13.0, agent@1.3.1, Hub v2.9.0 Fix: "Load demo data" deleted the Accounts link (set-demo.js truncated ProductLink), so events-demo couldn't sign anyone in (ACCOUNTS_UNAVAILABLE). Demo data keeps the link; a site in Accounts mode without a link reconnects at its next heartbeat. Heartbeat stats.signIn; Hub alerts: not linked (critical), wrong Accounts, sign-in failing, an Accounts nothing links to. Agent 1.3.0 reported itself as 1.2.0: use 1.3.1
accounts@1.6.0 A "New sign-in" email (and WhatsApp) after every sign-in; Sign-in settings → signin_notices turns it off
Hub v2.10.0 Every Hub email laid out as Events' and Accounts' (src/utils/emailLayout.js: header with the logo, button, notes, job steps, code blocks; plain text kept). The FastPanel email gives location ^~ /api/ as config to paste; Proxy done checks a file under /api reaches the backend. Billing emails unchanged
events@3.6.1 Fix: logo/favicon uploads failed on events-demo ("uploaded, but the site can't show it yet"). FastPanel's static-file rule sent every /api/… path with a file extension (.png, .pdf, …) to the frontend. The site now passes /api/* and /uploads/* on to the backend (BACKEND_INTERNAL_URL); the installers' nginx uses location ^~. Change each FastPanel site too (below)
events@3.6.0, accounts@1.5.0, contracts@1.14.0 The nightly people check (accounts-people-check, 04:30): people.check 500 subs at a time; fixes out-of-date copies, handles deleted accounts as user.deleted, stops (changing nothing) when most people are unknown. Skipped with an Accounts before 1.5.0

FastPanel sites (central server)

FastPanel's nginx on the central server is the only router for sites behind frp: the church server has no nginx. Its static-file handling adds a regex location for file extensions (png|jpg|ico|svg|css|js|pdf|txt|…) that falls back to the site's main proxy, the frontend. A plain location /api loses to it, so /api/uploads/…/logo.png reached Next.js and got a 404 (fixed in the site by Events 3.6.1, but slower and without the visitor's IP). In each Events site's nginx config in FastPanel, the backend locations must be ^~ (a prefix match that no regex can override):

location ^~ /api/ {
    proxy_pass http://127.0.0.1:<api port>;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto https;
}
location = /api { proxy_pass http://127.0.0.1:<api port>; }

Since Hub 2.10.0 the FastPanel email (AGENT-1.0-PLAN §11) gives this block to paste, and Proxy done refuses a site whose /api/proxy-check.png reaches the frontend. Sites set up before that need the change by hand, and so does the Hub's own site (events-hub, /api/…/statement.pdf; its deployment.md §8). Check after a change: curl -sI https://<domain>/api/health.png must not say X-Powered-By: Next.js (a 404 is fine).

Next up

Everything up to and including the 2026-11-23 releases is deployed (VERSIONS.md, "Deployed / rolled out").

  1. Phase 5, Church Website 1.0.0 (ROADMAP §6, §9). Planned in WEBSITE-1.0-PLAN.md: decisions all confirmed 2026-11-21. Font pairings confirmed 2026-11-24 (§3). Order: contracts 1.17.0 → Accounts 1.7.0 (both released 2026-11-24; Accounts ships with contracts because it answers the new church.update) → Events 3.7.0 (shared fonts and footer; released 2026-11-24) → Hub 2.21.0 (released and deployed 2026-11-25; the plan said 2.13.0) → website@1.0.0 (released 2026-11-26, with contracts@1.18.0 and Hub v2.22.0, deployed 2026-11-26; the release checks are in WEBSITE-1.0-PLAN §13, "Where they are"; the VM test was skipped, so watch the first install closely) → website@1.0.1 (released 2026-11-26: the messages' thumbnails served from the site, the Calendar dates; VERSIONS.md) → Hope Family Church: roll out Accounts 1.7.0 and Events 3.7.0 first (neither is rolled out yet), then New install → Website (1.0.1) → a second church on a different template. crosscode-site 1.7.0 (the Website on sale, released 2026-11-26; the Hub already had its prices): deploy it (deploy/deploy.sh on the server) once Hope Family Church's Website is live, so the first church to buy it isn't the first install. The release checks are all run on 1.0.1's build (WEBSITE-1.0-PLAN §13, "Where they are"): every variant passes axe, the 312 screenshots have baselines (taken again with whole-pixel section heights), Lighthouse passes 12 of 12. Still to do:
    • Look through the variant baselines once (the contact sheet: Bold, Community and Clean were taken, not compared, the first time). A section drawn wrong there is the reference until then.
    • The VM test was skipped: before Hope Family Church, a throwaway install from the Hub (New install → Website 1.0.0, update it to 1.0.1, uninstall with its export) in its place. Done (confirmed by Joshua 2026-11-25): hope-events is archived, and every FastPanel site set up before Hub 2.10.0, and the Hub's own site, has location ^~ /api/.

The VM test (2026-11-17)

Everything above was run on a WSL Ubuntu 24.04 VM before release: a church server, a "central" network namespace running frps with proxy_bind_addr, the Hub (feat/servers-agent) and local git mirrors standing in for c-git. It found nine bugs, all fixed with tests before tagging. None lost data, because each failed safely:

  1. adopt refused a release with new migrations (it now applies them in the switch-over).
  2. A failed migration blocked every later deploy (Prisma P3009; now marked rolled back).
  3. The agent install skipped the root's build tools (npm ci --include-workspace-root).
  4. A failed install's short name couldn't be used again.
  5. The Hub didn't save the servers settings (install defaults, port range, central IP).
  6. frpc only reads its admin lines when it starts (restarted once the first time).
  7. A site's PM2 belonged to the agent's service, so stopping or updating the agent took down every site it had installed. PM2 now always runs under pm2-<user>.
  8. Update and closing banners never reached Hub-installed sites (registration now links them).
  9. A moved tag blocked a church's deploys (tags are fetched with --force).

Not covered by the VM: FASTPANEL, real DNS, Let's Encrypt. Hence the throwaway install in the rollout.

Things to remember across phases

  • Before selling the Website or App: put the ROADMAP §10 prices in crosscode-site/src/data/pricing.mjs and the Hub's frontend/src/lib/tiers.ts (plus backend/src/utils/billing/tiers.js) in the same phase, so the site and the Hub never disagree.
  • A phase isn't done until crosscode-site matches it (ROADMAP §9, "Updating crosscode-site").
  • Servers stay PM2 + nginx (no Docker), with one database per product per church, under /var/www/sites/<church>/<product>. Each site user's PM2 runs as a systemd unit, pm2-<user>; the crosscode script makes sure of it before any PM2 command.
  • The agent pins the Hub's job key when it joins. Back up events-hub/backend/keys/ (licence and job keys); replacing the job key means every server joins again.
  • A new .env variable goes in three env templates: apps/<product>/env.template.json, scripts/products/<product>.env.template.json and the Hub's envTemplates/<product>.json. If the app refuses some values at startup (as Events does a TRUST_PROXY it can't parse), add a rule to both checkEnvValue in packages/contracts/src/agent.ts (the Hub) and VALUE_RULES in scripts/lib/envtpl.cjs (the server), so a bad value stops before an install's build.
  • Demo data: Hub → the install's page → Mark as a demo site → Load demo data (Hub 2.4.0, agent 1.2.0; crosscode demo <church> --profile … on the server). By hand, run npm run demo:* as the site's user (sudo -u cc-<church> …): only that user can read the .env.
  • A new Events install never takes over an existing database: moving an existing site is adopt, not a New install pointed at the old database.
  • Prisma in the monorepo: each app other than Events sets its own generator output, so hoisted clients don't overwrite each other (EVENTS-2.2-PLAN §2).
  • AI for a church: set the licence's monthly AI cap above R0 on the Hub; with no cap the buttons don't show (rules in Events' handover, "AI rules"). Churches see tokens; only the Hub shows rand (markup 15% by default).
  • The agent's version is in two places: apps/agent/package.json and AGENT_VERSION in apps/agent/src/stats.ts (what it reports to the Hub). Bump both; the agent's test checks they match, so run npm run check after the bump (1.3.0 shipped reporting 1.2.0).
  • Background jobs: each job's switch and schedule can be set in the site's admin (Events and Accounts, AppSetting job_overrides); that wins over the .env flag and JOB_SCHEDULE_<NAME>. JOBS_ENABLED=false still turns everything off. A new job gets a label and, if it may be turned off from the .env, an env flag.
  • An install's .env from the Hub (install page → Settings (.env), agent 1.3.0+): plain values only. Names matching SECRET_ENV_NAME (contracts) / SECRET_NAME (scripts/lib/envedit.cjs; keep them in step) and generated values can't be read or changed from the Hub. Changing an address there doesn't change the Hub's domain for the install or FastPanel.
  • Demo data keeps the links to the church's other products (KEEP_TABLES in apps/events/backend/scripts/set-demo.js). Anything that must survive a demo load goes there.
  • Releasing: branch → merge → tag (<product>@<version> here, v<version> in events-hub and crosscode-site) → push, with a CHANGELOG entry, and npm run check first. Pushes to c-git often fail authentication the first time; retry once. A push can also hang waiting on a login prompt after it has already gone through: check with git ls-remote before pushing again.