Compare commits

...
Author SHA1 Message Date
joshuaandClaude Opus 5.5 9523976044 docs: font pairings confirmed (Website plan decision 15)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 15:59:03 +02:00
joshuaandClaude Opus 5.5 06eedd0499 docs: HANDOVER up to the 2026-11-23 releases; Website plan targets Hub 2.21.0; font pairings proposed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 15:55:47 +02:00
joshua 75aeae1ff2 Merge branch 'docs/hub-2.20.0-deployed' 2026-11-23 13:49:36 +02:00
joshuaandClaude Opus 5.5 d0df78abe3 docs: Hub 2.20.0 deployed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 13:49:36 +02:00
joshua 029d3f4e89 Merge branch 'docs/hub-2.20.0' 2026-11-23 13:45:48 +02:00
joshuaandClaude Opus 5.5 0b500934cb docs: Hub 2.20.0 released
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 13:45:48 +02:00
joshua 86ddc2e6d9 Merge branch 'docs/hub-2.19.0-deployed' 2026-11-23 13:28:29 +02:00
joshuaandClaude Opus 5.5 5fbfd28014 docs: Hub 2.18.0 and 2.19.0 deployed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 13:28:29 +02:00
joshua 703fa7804f Merge branch 'docs/hub-2.19.0' 2026-11-23 13:19:07 +02:00
joshuaandClaude Opus 5.5 9eb4d345c6 docs: Hub 2.19.0 released
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 13:19:07 +02:00
joshua e4730120ab Merge branch 'docs/agent-whats-new' 2026-11-23 13:11:40 +02:00
joshuaandClaude Opus 5.5 ac6800d9de docs: Hub 2.18.0 released
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 13:11:40 +02:00
joshuaandClaude Opus 5.5 fc1e97eba8 Agent: WHATS-NEW.md for every release (1.0.0-1.5.0)
Notes for whoever updates servers, read by the Hub's agent release source (Hub 2.19.0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 13:11:39 +02:00
joshua cd84838e78 Merge branch 'docs/hub-2.17.0-deployed' 2026-11-23 12:43:58 +02:00
joshuaandClaude Opus 5.5 6c03a10a24 docs: Hub 2.16.0 and 2.17.0 deployed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 12:43:57 +02:00
joshua fe54d9ab7b Merge branch 'docs/hub-2.17.0' 2026-11-23 12:43:07 +02:00
joshuaandClaude Opus 5.5 0d48f81c02 docs: Hub 2.17.0 released
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 12:43:06 +02:00
joshua c1383d62aa Merge branch 'docs/hub-2.16.0' 2026-11-23 12:35:59 +02:00
joshuaandClaude Opus 5.5 9dc42e7481 docs: Hub 2.16.0 released
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 12:35:57 +02:00
joshua a01465a4bb Merge branch 'docs/hub-2.15.0-deployed' 2026-11-23 11:50:23 +02:00
joshuaandClaude Opus 5.5 e59e7488a3 docs: Hub 2.15.0 deployed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:50:22 +02:00
joshua 1fe94bf70e Merge branch 'docs/hub-2.15.0' 2026-11-23 11:47:57 +02:00
joshuaandClaude Opus 5.5 970a60d55f docs: Hub 2.15.0 released
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:47:56 +02:00
joshua da0a7b5f15 Merge branch 'docs/hub-2.14.0-deployed' 2026-11-23 11:16:35 +02:00
joshuaandClaude Opus 5.5 e5bb98c81f docs: Hub 2.14.0 deployed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:16:34 +02:00
joshua 9dd599cd80 Merge branch 'docs/hub-2.14.0' 2026-11-23 11:14:39 +02:00
joshuaandClaude Opus 5.5 8dc2c8ad68 docs: Hub 2.14.0 released
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:14:38 +02:00
joshua 1bb64b1902 Merge branch 'docs/deployed-site-1.6.1' 2026-11-23 10:46:43 +02:00
joshuaandClaude Opus 5.5 3d28ec6edb docs: crosscode.co.za 1.6.1 deployed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 10:46:41 +02:00
joshua d7f30d348a Merge branch 'docs/site-1.6.1' 2026-11-23 10:40:43 +02:00
joshuaandClaude Opus 5.5 87069c85dd docs: crosscode.co.za 1.6.1 released
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 10:40:39 +02:00
joshua 1f9f2f4640 Merge branch 'docs/deployed-hub-2.13.0' 2026-11-23 10:22:55 +02:00
joshuaandClaude Opus 5.5 544cd30656 docs: Hub 2.13.0 deployed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 10:22:54 +02:00
joshua 55a924afb6 Merge branch 'docs/deployed-uninstall-release' 2026-11-23 10:00:52 +02:00
joshuaandClaude Opus 5.5 e9f1e46781 docs: agent 1.5.0 and Hub 2.12.0 deployed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 10:00:51 +02:00
joshua 3e85921a35 Merge branch 'fix/uninstall-one-product' 2026-11-23 09:42:10 +02:00
joshuaandClaude Opus 5.5 8899c97a9c Agent 1.5.0 + contracts 1.16.0: uninstall, export and purge one product of a church
crosscode uninstall/export/purge <church> [product ...]: with products named only those
go and the church keeps the others; naming every product it still has removes the church
(folder and app user), so the last product to go takes the church with it. The report
gives products and remaining. Uninstalling cross-events-demo's Events removed its Accounts
too, which the Hub still showed as live.

Contracts 1.16.0: optional products on export/uninstall/purge, PRODUCT_UNINSTALL_MIN_AGENT.
Agent 1.5.0 passes them to crosscode. The Website plan moves to contracts 1.17.0 / Hub 2.13.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 09:17:32 +02:00
joshua e04bfac208 Merge branch 'docs/deployed-frp-release' 2026-11-21 11:13:40 +02:00
joshuaandClaude Opus 5.5 7677f54056 docs: agent 1.4.0 and Hub 2.11.0 deployed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 11:13:39 +02:00
18 changed files with 584 additions and 95 deletions
+17
View File
@@ -2,6 +2,23 @@
Each package and app has its own section and its own tags (`contracts@1.0.0`, `accounts@1.0.0`, …).
## agent@1.5.0 + contracts@1.16.0 + crosscode script - 2026-11-23
- **Fix: uninstalling one product removed the whole church.** `crosscode uninstall <church>` only
knew whole churches, while the Hub uninstalls per product: uninstalling cross-events-demo's
Events also removed its Accounts, which the Hub still showed as live, and its own uninstall
failed later ("No church cross-events-demo on this server").
- **`crosscode uninstall|export|purge <church> [product …]`.** With products named, only those
are backed up, kept (`.removed/<church>-<date>/<product>`) and removed; the church keeps the
others in church.env. Naming every product it still has removes the church (folder and app
user), so the last product to go always takes the church with it. The report gives `products`
and `remaining`. `purge` with products deletes only what was kept of those, also while the
church still has others. Without products, as before.
- **Agent 1.5.0** passes `products` through. **Contracts 1.16.0:** optional `products` on the
`export`, `uninstall` and `purge` job arguments, and `PRODUCT_UNINSTALL_MIN_AGENT` (an older
agent refuses the key). Hub 2.12.0 uses them.
- The Church Website plan's versions move up one again: contracts 1.17.0, Hub 2.13.0.
## agent@1.4.0 + contracts@1.15.0 - 2026-11-21
- **Agent 1.4.0: frp's config, wherever it is.** The agent no longer assumes
+75
View File
@@ -0,0 +1,75 @@
# What's new in the server agent
What each version of the Cross Code server agent changes, for whoever runs the Hub. The Hub shows
these notes on its Releases page and when you pick a version under Update agent.
<!--
How this file is used: the Cross Code Hub reads it from main every 15 minutes (release source
"Server agent", tags agent@1.2.3) and shows a section only once its version is tagged, so write it
before tagging; fixes to old sections show straight away. Each version is a "## 1.2.3" heading; add
"— urgent" (or "security") to the heading for a security or serious bug fix. Under it, lines
starting with "- " show as a list and other lines as paragraphs.
Write for the person updating servers: what the agent can now do from the Hub, and which Hub or
contracts version needs it. The developer log is the commit history of apps/agent.
-->
## 1.5.0
- **One product of a church at a time.** Uninstall, export and purge jobs can name products: only
those go, and the church keeps the others. Naming every product it still has removes the whole
church, so the last product to go takes the church with it. Before, uninstalling a church's Cross
Events also removed its Accounts.
- The Hub (2.12.0 and later) uninstalls one product only on servers with this agent; older agents
can only remove the whole church.
## 1.4.0
- **frp's config from the Hub.** The agent finds frps's config (central server) or frpc's (church
server) wherever it is: the path set on the Hub, the `-c` in the systemd unit, or the usual places.
It reads INI and TOML.
- **Changing it from the Hub:** the agent checks the new file with `frp* verify`, keeps a backup,
restarts frp if asked, and puts the old file back if frp doesn't start. Secret values never leave
the server.
- **Ports checked before an install:** the Hub asks this server and the central server which ports
are free, so a new install gets ports free on both.
- Needed for frp config on a server's page and port checks (Hub 2.11.0).
## 1.3.1
- **Fix:** 1.3.0 reported itself as 1.2.0, so the Hub refused its .env jobs. It now reports its
real version. Install this instead of 1.3.0.
## 1.3.0
- **A site's .env from the Hub.** The agent reads an install's .env (secret values hidden) and
changes it: one file at a time, rebuilding the site when its frontend settings changed,
restarting it, and putting the old file back if the site doesn't answer.
- Needed for the Settings (.env) tab on an install's page (Hub 2.8.0).
## 1.2.0
- **Demo data from the Hub.** The agent loads a demo profile onto a site marked as a demo: a backup
first, then the demo data, keeping one admin account.
- Needed for demo sites (Hub 2.4.0).
## 1.1.1
- **Fix:** the server's stats now keep going while a long job runs. Before, a 30-minute install
stopped them and the Hub alerted that the server was down.
- **Fix:** 1.1.0 reported itself as 1.0.1; it now reports its real version.
## 1.1.0
- **Accounts installs.** The agent installs Accounts, and adds a product next to a church's others
on the same server (with the ports and release the Hub chose).
## 1.0.1
- **Fix:** on the central server, Check status failed (it has no `crosscode` script). It now answers
with its own stats, including whether frps is running.
## 1.0.0
- **The first server agent.** It polls the Hub every 30 seconds for signed jobs, runs the
`crosscode` script for them (install, update, status, export, uninstall), sends the results, and
sends the server's stats every minute. It listens on no port: every request goes out to the Hub.
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@crosscode/agent",
"version": "1.4.0",
"version": "1.5.0",
"private": true,
"description": "The server agent: runs the crosscode script for signed jobs from Cross Code Hub, reports stats (docs/AGENT-1.0-PLAN.md)",
"license": "UNLICENSED",
+4 -3
View File
@@ -62,11 +62,12 @@ export function crosscodeArgs(job: agent.AgentJob, opts: { exportFile?: string }
return ["demo", job.args.church, "--profile", job.args.profile, ...(job.args.adminEmail ? ["--admin-email", job.args.adminEmail] : [])];
case "export":
if (!opts.exportFile) throw new Error("export needs a file to write");
return ["export", job.args.church, "--out", opts.exportFile];
return ["export", job.args.church, ...(job.args.products ?? []), "--out", opts.exportFile];
case "uninstall":
return ["uninstall", job.args.church, "--confirm", job.args.church];
// 1.5.0: only the products named go (the church keeps its others); none named: the church.
return ["uninstall", job.args.church, ...(job.args.products ?? []), "--confirm", job.args.church];
case "purge":
return ["purge", job.args.church, "--confirm", job.args.church];
return ["purge", job.args.church, ...(job.args.products ?? []), "--confirm", job.args.church];
case "status":
return ["status", ...(job.args.church ? [job.args.church] : []), "--no-fetch"];
case "update-agent":
+1 -1
View File
@@ -12,7 +12,7 @@ import { paths } from "./paths";
* the tools that are there; anything missing is null rather than an error.
*/
export const AGENT_VERSION = "1.4.0";
export const AGENT_VERSION = "1.5.0";
function run(cmd: string, args: string[], timeoutMs = 10_000): Promise<string | null> {
return new Promise((resolve) => {
+4
View File
@@ -36,6 +36,10 @@ describe("crosscode arguments for each job", () => {
expect(crosscodeArgs(parsed({ type: "restart", args: { church: "hope" } }))).toEqual(["restart", "hope"]);
expect(crosscodeArgs(parsed({ type: "uninstall", args: { church: "hope" } }))).toEqual(["uninstall", "hope", "--confirm", "hope"]);
expect(crosscodeArgs(parsed({ type: "purge", args: { church: "hope" } }))).toEqual(["purge", "hope", "--confirm", "hope"]);
// 1.5.0: one product of the church.
expect(crosscodeArgs(parsed({ type: "uninstall", args: { church: "hope", products: ["events"] } }))).toEqual(["uninstall", "hope", "events", "--confirm", "hope"]);
expect(crosscodeArgs(parsed({ type: "purge", args: { church: "hope", products: ["events"] } }))).toEqual(["purge", "hope", "events", "--confirm", "hope"]);
expect(crosscodeArgs(parsed({ type: "export", args: { church: "hope", exportId: "exp_abcdefgh", products: ["accounts"] } }), { exportFile: "/x/e.zip" })).toEqual(["export", "hope", "accounts", "--out", "/x/e.zip"]);
expect(crosscodeArgs(parsed({ type: "status", args: {} }))).toEqual(["status", "--no-fetch"]);
});
+31 -11
View File
@@ -1,6 +1,6 @@
# Handover — Cross Code, all products
Last updated: 2026-11-21. **The plan is [ROADMAP-v3.md](./ROADMAP-v3.md)** (decided 2026-11-03,
Last updated: 2026-11-24. **The plan is [ROADMAP-v3.md](./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`](../apps/events/docs/HANDOVER.md), and the Hub's are in
@@ -25,18 +25,33 @@ every release).
| Phase | What | State |
|-------|------|-------|
| 0 | contracts 1.0.0 → 1.14.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.10.0 | **Released, deployed and tested** (Hub `v2.10.0`) |
| 0 | contracts 1.0.0 → 1.16.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.3.1` on every server; from agent 1.4.0 the central server's agent can also read and change frps's config from the Hub) |
| 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](./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](./ACCOUNTS-1.0-PLAN.md)) |
| 4 | Cross Events 3.0.0: sign-in through Accounts | **Released, rolled out and tested** (now `events@3.6.1`; [EVENTS-3.0-PLAN.md](./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 | **Released, deployed and tested** 2026-11-20 (below) |
| 5 | Church Website 1.0.0 | **Planned** 2026-11-21: [WEBSITE-1.0-PLAN.md](./WEBSITE-1.0-PLAN.md) (all decisions confirmed). Not started |
| 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 | **Planned** 2026-11-21: [WEBSITE-1.0-PLAN.md](./WEBSITE-1.0-PLAN.md) (all decisions confirmed). Font pairings confirmed 2026-11-24 (§3). contracts 1.17.0 in progress |
| 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](./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|export|purge <church> [product …]`); the last one removes the church; Accounts goes last. Stale installs removable from the Hub; customers archivable; several emails per customer |
| 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](../CHANGELOG.md), the apps' CHANGELOGs
@@ -80,15 +95,20 @@ before that need the change by hand, and so does the Hub's own site (`events-hub
## Next up
Everything up to and including the 2026-11-20 releases is deployed, rolled out and tested
(VERSIONS.md, "Deployed / rolled out").
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](./WEBSITE-1.0-PLAN.md): decisions all confirmed 2026-11-21. Order:
contracts 1.16.0 → Accounts 1.7.0 → Events 3.7.0 (shared fonts and footer) → Hub 2.12.0 →
`website@1.0.0` → Hope Family Church → a second church → crosscode-site 1.7.0.
[WEBSITE-1.0-PLAN.md](./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 → Events 3.7.0 (shared fonts and footer) → **Hub 2.21.0** (the
plan said 2.13.0; the Hub has moved on since) → `website@1.0.0` → Hope Family Church → a second
church → crosscode-site 1.7.0.
2. **Archive `hope-events`** if it isn't yet (every install now reports 2.2.0 or later;
EVENTS-2.2-PLAN §7).
3. **FastPanel sites set up before Hub 2.10.0** need `location ^~ /api/` by hand, and so does the
Hub's own site ("FastPanel sites" above). Not yet recorded which are done: check each with
`curl -sI https://<domain>/api/health.png`.
## The VM test (2026-11-17)
+1 -1
View File
@@ -641,7 +641,7 @@ Planned in [AGENT-1.0-PLAN.md](./AGENT-1.0-PLAN.md). In short:
| 2 | **Cross Events 2.4.0** | Reports `product: "events"` (protocol v2), **Linked products**, the event feed (publish + show events from siblings), `packages/seo` (§11) with canonical links for imported events. **Planned and built 2026-11-18:** [EVENTS-2.4-PLAN.md](./EVENTS-2.4-PLAN.md) (also needs contracts 1.4.0 and Hub 2.2.0, for a public key in the v2 heartbeat); not tagged yet | Small; ready for when the Website exists |
| 3 | **Accounts 1.0.0** | OIDC provider, sign-in, 2FA (email, WhatsApp, authenticator app), password reset, consent and notice, export / delete fan-out, admin, install script. [ACCOUNTS-1.0-PLAN.md](./ACCOUNTS-1.0-PLAN.md) (with contracts 1.5.0, `packages/auth-client`, Hub 2.3.0). **Released 2026-11-18** (`accounts@1.0.0`, 1.0.1 on 2026-11-19); the VM test and a run on real Postgres are still to do before a church gets it | Every later product signs in through it |
| 4 | **Cross Events 3.0.0** | Sign-in moves to Accounts; user migration keeping password hashes; migration guide. **Planned 2026-11-19:** [EVENTS-3.0-PLAN.md](./EVENTS-3.0-PLAN.md) (with contracts 1.8.0, Accounts 1.1.0, Hub 2.5.0; decisions confirmed 2026-11-19) | Breaking change, so a major version. **Moved before the Website on 2026-11-19** (decision 38): Events is the product churches use today, so Accounts is proven on real users first, and the Website then starts with a church whose people already have accounts |
| 5 | **Church Website 1.0.0** | Public site with the **four templates** (§6), admin, simple events + feed, SEO (§11), Hope Family Church as the first church, then a second test church on a different template to prove it repeats. **Planned 2026-11-21:** [WEBSITE-1.0-PLAN.md](./WEBSITE-1.0-PLAN.md) (with contracts 1.16.0, Accounts 1.7.0, Events 3.7.0 for the shared fonts and footer, Hub 2.12.0) | More churches need a website than an app; it also covers the "website only" case. Built on Accounts from day one |
| 5 | **Church Website 1.0.0** | Public site with the **four templates** (§6), admin, simple events + feed, SEO (§11), Hope Family Church as the first church, then a second test church on a different template to prove it repeats. **Planned 2026-11-21:** [WEBSITE-1.0-PLAN.md](./WEBSITE-1.0-PLAN.md) (with contracts 1.17.0, Accounts 1.7.0, Events 3.7.0 for the shared fonts and footer, Hub 2.21.0) | More churches need a website than an app; it also covers the "website only" case. Built on Accounts from day one |
| 6 | **Church App 1.0.0** | Foundation (PWA, branding, Accounts), House of Prayer, announcements, devotionals, events (simple + feed) | Starts with shared users and the feed already in place |
| 7 | Church App 1.x | Reading plans, sermons, groups, pastoral care, serving, giving links, directory | After House of Prayer is in use |
+69 -10
View File
@@ -1,6 +1,6 @@
# Versions — the latest release of everything
Last updated: 2026-11-21. Taken from the git tags, which is what a release is here (branch → merge →
Last updated: 2026-11-23. Taken from the git tags, which is what a release is here (branch → merge →
tag → push, see [HANDOVER.md](./HANDOVER.md) "Releasing"). **Update this file with every release.**
"Released" means tagged and pushed. Whether a release is **deployed** or rolled out is recorded
@@ -12,11 +12,11 @@ separately below; the two often differ.
|------|------|--------|-----|----------|
| Cross Events | `crosscode-platform` (`apps/events`) | **3.6.1** | `events@3.6.1` | 2026-11-20 |
| Accounts | `crosscode-platform` (`apps/accounts`) | **1.6.0** | `accounts@1.6.0` | 2026-11-20 |
| Server agent | `crosscode-platform` (`apps/agent`) | **1.4.0** | `agent@1.4.0` | 2026-11-21 |
| Contracts | `crosscode-platform` (`packages/contracts`) | **1.15.0** | `contracts@1.15.0` | 2026-11-21 |
| Cross Code Hub | `events-hub` | **2.11.0** | `v2.11.0` | 2026-11-21 |
| crosscode.co.za | `crosscode-site` | **1.6.0** | `v1.6.0` | 2026-11-19 |
| `crosscode` script | `crosscode-platform` (`scripts/`) | `main` | none | 2026-11-20 (last change: Accounts' pre-deploy dumps don't stop a deploy) |
| Server agent | `crosscode-platform` (`apps/agent`) | **1.5.0** | `agent@1.5.0` | 2026-11-23 |
| Contracts | `crosscode-platform` (`packages/contracts`) | **1.16.0** | `contracts@1.16.0` | 2026-11-23 |
| Cross Code Hub | `events-hub` | **2.20.0** | `v2.20.0` | 2026-11-23 |
| crosscode.co.za | `crosscode-site` | **1.6.1** | `v1.6.1` | 2026-11-23 |
| `crosscode` script | `crosscode-platform` (`scripts/`) | `main` | none | 2026-11-23 (last change: uninstall, export and purge one product of a church) |
The `crosscode` script has no version: every server's copy (`/opt/crosscode/tools`) pulls `main`
on each run, so merging to `main` and pushing releases it. Its changes are listed in
@@ -37,6 +37,65 @@ need their own tags until something outside this repo depends on them.
## What each latest release was for
- **Hub 2.20.0 (2026-11-23):** the port list says what each port is for (church, product, web or API,
linked to the install); a church server's hand-written frpc tunnels are listed as taken on each frp
config read. frps's allow_ports is checked against the port list (the Hub's range plus listed ports
outside it): an alert and Edit → Use the Hub's allow_ports when it leaves ports out. No migration.
Deployed 2026-11-23.
- **Hub 2.19.0 (2026-11-23):** the server agent's releases: a release source for the Server agent (in
the defaults: `agent@` tags, notes in `apps/agent/WHATS-NEW.md`), shown on the Releases page with how
many servers run each. Update agent picks a release (Latest by default, with its notes); the
Servers pages say when a newer agent is out. **Migration** (`AgentRelease`): run `prisma migrate
deploy`. A saved list of sources gets an "Add the agent's source" button.
Deployed 2026-11-23.
- **Hub 2.18.0 (2026-11-23):** releases are picked from a list, not typed: New install and Move onto
the monorepo (Events from 2.2.0) as well as an install's Update and the Updates page. Latest first,
then the newest 10, with Show older versions for the rest. Plan for agent releases (2.19.0) in the
Hub's `docs/VERSION-PICKERS-PLAN.md`. Frontend only: no migration, no API changes.
Deployed 2026-11-23.
- **Hub 2.17.0 (2026-11-23):** popups on the remaining pages: a server's configuration and Update
agent, the frp config (read-only on the card, Edit with the two-factor code), install defaults and
Mark as taken (Ports & defaults), Clear public key and notes on an install, and an invoice's lines
(Edit for drafts and approved ones; Void and Refund instead of the browser's prompt). Settings
forms that are the page itself stay as they are. Frontend only: no migration, no API changes.
Deployed 2026-11-23.
- **Hub 2.16.0 (2026-11-23):** every add and edit on the list pages is a popup like the customer
and install pages: Add server (the join command in the same popup), Add customer, New install,
Link existing, notices and releases (new and edit), release sources (a table; Edit opens the rows
and the token) and One-off invoice on Billing (with a church picker; `/billing/invoices/new` opens
it). Plan for the rest in the Hub's `docs/POPUPS-PLAN.md`. Frontend only: no migration, no API changes.
Deployed 2026-11-23.
- **Hub 2.15.0 (2026-11-23):** an install's page (Servers → Installs → one install) is a header
(status, Schedule update, a ⋯ menu for move onto the monorepo, demo site, uninstall and the two
removals) with tiles for the site, version, server, ports and last heartbeat, then tabs: Jobs,
Settings (.env), Exports. Every action is a popup like the customer page's, the .env files too
(the tab shows the values, Edit opens a file). Banners for not registered, no heartbeat and a
planned uninstall. Confirmations unchanged. Frontend only: no migration, no API changes.
Deployed 2026-11-23.
- **Hub 2.14.0 (2026-11-23):** the customer page is a summary header (products, owing, next invoice
with its estimate, address, AI) and three tabs: Overview, Products, Invoices and payments. Every
add and edit is a popup; each product is one card (licence and billing, one Save, suspend/revoke/
release in a ⋯ menu); contact and billing details are one form; the history is one timeline with
a filter. Record payment is a popup on Billing too. Frontend only: no migration, no API changes.
Deployed 2026-11-23.
- **crosscode.co.za 1.6.1 (2026-11-23):** the web address choices on the Cross Events page are three
cards (name, price, "best if", an example address, short points); the option names were white on
a light background and couldn't be seen. Prices unchanged. Deployed 2026-11-23.
- **Hub 2.13.0 (2026-11-23):** alerts can be cleared by hand (one, or Clear all); a cleared alert
stays away until its problem is fixed and comes back, and isn't emailed again meanwhile. Billing
invoices, payments and churches, and a customer's invoices and payments, can be sorted by column
(remembered per browser). Fixed a stray scrollbar beside tab rows. Migration
`20261123120000_alert_cleared`.
- **Agent 1.5.0 + contracts 1.16.0 + Hub 2.12.0 + `crosscode` script (2026-11-23):** uninstalling
one product no longer removes the whole church (it removed cross-events-demo's Accounts with its
Events, which the Hub still showed as live). `crosscode uninstall|export|purge <church>
[product …]`; the last product to go removes the church. On the Hub: a second product's
uninstall can join one already planned or get its own time; Accounts goes last; a stale install
(no heartbeat for 24 hours) can be removed from the Hub; customers can be archived; a customer's
email and billing email take several addresses; statements show R0 invoices' amounts. **Update
the agents first** (the Hub refuses a one-product uninstall on an older agent while the church
has other products), then deploy the Hub (migration `20261123090000_customer_archive`).
- **Agent 1.4.0 + contracts 1.15.0 + Hub 2.11.0:** the agent finds frps's / frpc's config wherever
it is (the path set on the Hub, the systemd unit's `-c`, the usual places) and reads TOML too;
each server's Hub page reads and changes that config (secrets stay on the server, `verify`,
@@ -147,9 +206,9 @@ you deploy one.
| What | Running | Since | Notes |
|------|---------|-------|-------|
| Hub | 2.10.0 | 2026-11-20 | |
| Agent on church-server1 | 1.3.1 | 2026-11-20 | |
| Agent on the central server | 1.3.1 | 2026-11-20 | Read-only (decision 35) |
| Hub | 2.20.0 | 2026-11-23 | Port list says what each port is for; hand-written frpc tunnels listed as taken; frps allow_ports checked against the port list (no migration) |
| Agent on church-server1 | 1.5.0 | 2026-11-23 | Uninstalls one product of a church at a time |
| Agent on the central server | 1.5.0 | 2026-11-23 | Reads and changes frps's config from the Hub (no longer read-only; decision 35 superseded) |
| Cross Events (churches) | 3.6.1 | 2026-11-20 | Every install adopted onto the monorepo and signing in through Accounts |
| Accounts (churches) | 1.6.0 | 2026-11-20 | |
| crosscode.co.za | 1.6.0 | 2026-11-20 | |
| crosscode.co.za | 1.6.1 | 2026-11-23 | Clearer web address choices on the Cross Events page |
+68 -9
View File
@@ -4,6 +4,10 @@ Phase **5** of [ROADMAP-v3.md](./ROADMAP-v3.md) (§6, §9, §10, §11; decisions
Written 2026-11-21. **All decisions confirmed by Joshua on 2026-11-21** (12 changed: a full
storage stops uploads). Not started.
**Updated 2026-11-24:** the Hub release is **2.21.0**, not 2.13.0 (the Hub reached 2.20.0 on
2026-11-23 with other work). The 8 font pairings in §3 ("Font pairings") were **confirmed by Joshua
on 2026-11-24** (decision 15).
**What the Website is:** the church's public site at `www.<church's address>` (or
`<church>.crosscode.co.za` on the Cross Code address), plus its admin at `/admin`. Admins sign in
through the church's Accounts. The church picks one of **four templates** and makes it its own with
@@ -17,7 +21,7 @@ prove it repeats. Then it goes on sale (crosscode-site, ROADMAP §9).
**Done when:**
- `website@1.0.0`, `contracts@1.16.0`, `accounts@1.7.0`, `events@3.7.0` and Hub `v2.12.0` are
- `website@1.0.0`, `contracts@1.17.0`, `accounts@1.7.0`, `events@3.7.0` and Hub `v2.21.0` are
tagged; the Hub installs the Website from New install (after Accounts) and lists its releases.
- All four templates pass the same checks (§13) at phone, tablet and desktop sizes: layout, axe, the
§11 SEO checks, and Lighthouse (SEO 100, accessibility 95+, performance 90+).
@@ -88,7 +92,7 @@ them (phase 6–7).
| Shared: `crosscode.church/1` | Website-only |
|---|---|
| Already there: name, short name, logo, icon, colours, campuses, service times, contact, social, links | Template, section variants, style settings other than fonts and corners (§3), homepage order |
| **New in contracts 1.16.0:** `branding.style`: `fontPairing` (an id from the shared list, §3) and `corners` (`sharp` / `soft` / `round`). Optional and additive, so a minor version | Pages, sections and blocks, navigation, custom pages |
| **New in contracts 1.17.0:** `branding.style`: `fontPairing` (an id from the shared list, §3) and `corners` (`sharp` / `soft` / `round`). Optional and additive, so a minor version | Pages, sections and blocks, navigation, custom pages |
| | About (story, mission, vision, values, beliefs), Plan your visit, Leaders, Ministries, Give |
| | Messages and series (§7), simple events (§8), media library, per-page SEO |
| | Drafts, published versions, preview links |
@@ -156,6 +160,56 @@ in 1.x (they're part of the product, ROADMAP §1 rule 3).
heroes). The duotone treatment makes uneven photos look consistent. Every image needs alt text.
Uploads are resized into responsive sizes (WebP and JPEG).
### Font pairings (confirmed 2026-11-24)
Eight pairings, a heading font and a body font each. All are **SIL Open Font License 1.1** (free to
self-host and bundle; the licence text ships with them), all are **variable fonts** (one file per
style covers every weight) and all cover **Latin Extended** (Afrikaans ê, ë, ô and names from other
languages). The id is what `branding.style.fontPairing` stores, so ids never change once released;
names and fonts shown to churches can.
| Id | Shown as | Headings | Body | Feel | Recommended for |
|----|----------|----------|------|------|-----------------|
| `classic` | Classic | Lora | Source Sans 3 | Traditional serif headings, a plain readable body | Heritage, Clean |
| `scholarly` | Scholarly | EB Garamond | EB Garamond | Old-style book type throughout; dignified | Heritage |
| `editorial` | Editorial | Playfair Display | Inter | High-contrast magazine headlines over a neutral body | Heritage, Bold |
| `impact` | Impact | Oswald | Source Sans 3 | Tall condensed headlines, uppercase-friendly; loud over photos | Bold |
| `contemporary` | Contemporary | Outfit | DM Sans | Geometric, modern, light-handed | Bold, Community, Clean |
| `friendly` | Friendly | Nunito | Nunito | Rounded ends throughout; warm and informal | Community |
| `warm` | Warm | Fraunces (soft) | Nunito Sans | A soft, characterful serif with a gentle sans | Community |
| `modern` | Modern | Inter | Inter | One neutral sans, tight headings; lets colour and photos lead | Clean |
Each template recommends three (its first is the default when a church picks that template):
| Template | Recommended (default first) |
|----------|-----------------------------|
| Heritage | `classic`, `scholarly`, `editorial` |
| Bold | `impact`, `contemporary`, `editorial` |
| Community | `friendly`, `warm`, `contemporary` |
| Clean | `modern`, `classic`, `contemporary` |
**Why these:** two each of traditional serif, display serif, strong sans and soft sans, so every
template has a real choice of mood; every pairing is recommended at least once. Avoided: script and
handwritten faces (hard to read, poor in long text), fonts that only exist as static weights (many
files, slower), and very thin display faces (fail contrast at small sizes).
**How they're served** (`packages/ui`):
- From the `@fontsource-variable/*` npm packages, pinned in the lockfile and copied into each app's
build; no request leaves the church's site (decision 13).
- Only the Latin and Latin Extended subsets, `woff2` only. A pairing is at most four files (heading
and body, upright and italic; one family = two). Budget: **≤ 160 KB per pairing** for the files a
page actually uses; checked in CI.
- The heading font is preloaded; the body font is not. `font-display: swap` with a metric-matched
fallback (`size-adjust`, `ascent-override`) on Georgia or Arial, so swapping doesn't shift the
layout (CLS, the Lighthouse target in §13).
- CSS variables `--cc-font-heading` and `--cc-font-body` from the profile, next to the colours and
`--cc-radius` (corners).
**A church without a `fontPairing`** (every church today): the Website uses its template's default;
Events and Accounts keep the system fonts they use now, so Events 3.7 and Accounts 1.7 look the same
until an admin picks a pairing. `corners` missing means `soft`.
## 4. Drafts, preview and publish
Decision 2: **one Publish for the whole site.**
@@ -293,7 +347,7 @@ only freed when neither the working copy nor the last 10 published versions use
- **Hub protocol v2, product `website`.** The heartbeat's `websiteStatsSchema` is already in the
contracts (pages, messages, events, editors, storage). A Website licence needs the church's
Accounts, installed first (as Events 3.x).
- **Hub 2.12.0:** New install offers the Website; release sync for `website@` tags and
- **Hub 2.21.0:** New install offers the Website; release sync for `website@` tags and
`apps/website/WHATS-NEW.md`; its env template; the Website's price (R99) and the storage add-on
(R20 per extra 5 GB, sent to the site with the licence as its storage limit, and the "Get more storage"
request with its email to Joshua) in `frontend/src/lib/tiers.ts` and `backend/src/utils/billing/tiers.js`, in
@@ -317,13 +371,13 @@ only freed when neither the working copy nor the last 10 published versions use
| Repo | Change | Version |
|------|--------|---------|
| `crosscode-platform` `apps/website` | New (§1–§11), with `CHANGELOG.md`, `WHATS-NEW.md`, `env.template.json`, e2e, demo data | `website@1.0.0` |
| `crosscode-platform` `packages/contracts` | `branding.style` (`fontPairing`, `corners`) on `crosscode.church/1`, the font pairing ids, a `website` part of the church export | `contracts@1.16.0` |
| `crosscode-platform` `packages/contracts` | `branding.style` (`fontPairing`, `corners`) on `crosscode.church/1`, the font pairing ids, a `website` part of the church export | `contracts@1.17.0` |
| `crosscode-platform` `packages/ui` | Fonts (self-hosted), the theme from the profile (colours, fonts, corners as CSS variables), `ChurchFooter`, links between products, the public site's building blocks | workspace |
| `crosscode-platform` `packages/seo` | `Church`, `VideoObject`, `PodcastEpisode`, `BreadcrumbList` builders, the generated share image | workspace |
| `crosscode-platform` `apps/accounts` | `branding.style` in the church profile, the shared fonts and footer, the Website's admins saving the profile | `accounts@1.7.0` |
| `crosscode-platform` `apps/events` | Public pages with the shared fonts, corners and footer | `events@3.7.0` |
| `crosscode-platform` `scripts/` | `products/website.sh`, `website.env.template.json`, bats tests | — |
| `events-hub` | Website in New install, its releases, env template, prices and storage add-on, FastPanel email | Hub `v2.12.0` |
| `events-hub` | Website in New install, its releases, env template, prices and storage add-on, FastPanel email | Hub `v2.21.0` |
| `crosscode-site` | Church Website on sale (ROADMAP §9): its page, prices, a page per template, screenshots of the demo church, FAQ, `SoftwareApplication` JSON-LD | `v1.7.0` |
## 13. Testing
@@ -349,8 +403,8 @@ only freed when neither the working copy nor the last 10 published versions use
## 14. Releasing and rolling it out
1. `contracts@1.16.0`, then `accounts@1.7.0` (the profile's brand style), then `events@3.7.0`.
2. Hub `v2.12.0` (vendored contracts 1.16.0) deployed.
1. `contracts@1.17.0`, then `accounts@1.7.0` (the profile's brand style), then `events@3.7.0`.
2. Hub `v2.21.0` (vendored contracts 1.17.0) deployed.
3. `website@1.0.0` tagged after the e2e, Lighthouse and VM runs.
4. **Hope Family Church:** Accounts 1.7.0 and Events 3.7.0 first, then New install → Website. The
site shows Coming soon while the church builds it, and goes live with its first publish.
@@ -391,9 +445,14 @@ Proposed and confirmed on 2026-11-21 (12 changed):
pairings (§3).
14. **Coming soon is a real page (HTTP 200) with `noindex`,** not a 503 (§5).
Confirmed on 2026-11-24:
15. **The 8 font pairings** in §3: `classic`, `scholarly`, `editorial`, `impact`, `contemporary`,
`friendly`, `warm`, `modern`, three recommended per template. A church without one keeps
the system fonts in Events and Accounts; `corners` defaults to `soft`.
## Still open
- The 8 font pairings and the exact variants per template: settled with the template designs, early
in the build.
- The exact section variants per template: settled with the template designs, early in the build.
- Whether the App (phase 6) moves leaders, ministries and giving into `crosscode.church/1` or reads
them from the Website. Decide with the App plan.
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@crosscode/contracts",
"version": "1.15.0",
"version": "1.16.0",
"description": "The shared JSON formats used by every Cross Code product: zod schemas, JSON Schema, TypeScript types and sample payloads",
"license": "UNLICENSED",
"type": "commonjs",
+42
View File
@@ -1177,6 +1177,20 @@
"exportId": {
"type": "string",
"pattern": "^exp_[A-Za-z0-9_-]{8,64}$"
},
"products": {
"minItems": 1,
"maxItems": 4,
"type": "array",
"items": {
"type": "string",
"enum": [
"events",
"website",
"app",
"accounts"
]
}
}
},
"required": [
@@ -1273,6 +1287,20 @@
"church": {
"type": "string",
"pattern": "^[a-z][a-z0-9-]{1,30}$"
},
"products": {
"minItems": 1,
"maxItems": 4,
"type": "array",
"items": {
"type": "string",
"enum": [
"events",
"website",
"app",
"accounts"
]
}
}
},
"required": [
@@ -1368,6 +1396,20 @@
"church": {
"type": "string",
"pattern": "^[a-z][a-z0-9-]{1,30}$"
},
"products": {
"minItems": 1,
"maxItems": 4,
"type": "array",
"items": {
"type": "string",
"enum": [
"events",
"website",
"app",
"accounts"
]
}
}
},
"required": [
+17 -6
View File
@@ -84,6 +84,13 @@ export const ENV_SET_MAX = 50;
/** The first agent that runs `frp-read`, `frp-write` and `probe-ports` jobs (an older one refuses the unknown types). */
export const FRP_JOBS_MIN_AGENT = "1.4.0";
/**
* The first agent that takes `products` on `export`, `uninstall` and `purge` (only those products
* go; the church keeps its others). An older one refuses the key, and uninstalls the whole church
* without it.
*/
export const PRODUCT_UNINSTALL_MIN_AGENT = "1.5.0";
/**
* Where frps (central server) or frpc (church server) keeps its config: an absolute path to a file
* whose name starts with `frp` and ends in `.ini` or `.toml` (`/etc/frp/frps.toml`).
@@ -162,12 +169,16 @@ export const jobArgsSchemas = {
if (secret) issue(`${secret} is a secret: it can't be changed from the Hub`);
if (a.unset.some((n) => Object.prototype.hasOwnProperty.call(a.set, n))) issue("A name can't be both set and removed");
}),
/** `crosscode export <church> --out <zip> --json`; the agent encrypts the ZIP and uploads it under `exportId`. */
export: z.strictObject({ church: shortNameSchema, exportId: z.string().regex(/^exp_[A-Za-z0-9_-]{8,64}$/) }),
/** `crosscode uninstall <church> --json` */
uninstall: z.strictObject({ church: shortNameSchema }),
/** `crosscode purge <church> --json` (deletes what uninstall kept for 30 days) */
purge: z.strictObject({ church: shortNameSchema }),
/** `crosscode export <church> [products] --out <zip> --json`; the agent encrypts the ZIP and uploads it under `exportId`. */
export: z.strictObject({ church: shortNameSchema, exportId: z.string().regex(/^exp_[A-Za-z0-9_-]{8,64}$/), products: z.array(productSchema).min(1).max(4).optional() }),
/**
* `crosscode uninstall <church> [products] --json`. With `products` (agent 1.5.0, {@link
* PRODUCT_UNINSTALL_MIN_AGENT}) only those go and the church keeps its others; without it, or
* naming every product, the whole church goes.
*/
uninstall: z.strictObject({ church: shortNameSchema, products: z.array(productSchema).min(1).max(4).optional() }),
/** `crosscode purge <church> [products] --json` (deletes what uninstall kept for 30 days: with `products`, only what was kept of those) */
purge: z.strictObject({ church: shortNameSchema, products: z.array(productSchema).min(1).max(4).optional() }),
/** The agent updates itself to that tag. */
"update-agent": z.strictObject({ version: agentTagSchema }),
/**
+14
View File
@@ -275,3 +275,17 @@ describe("frp config and free ports (1.15.0)", () => {
expect(agent.probePortsResultSchema.safeParse({ ports: [{ port: 20000, free: false, reason: "in use" }], configPath: null }).success).toBe(true);
});
});
describe("uninstalling one product (contracts 1.16.0)", () => {
const ok = (type: "export" | "uninstall" | "purge", args: unknown) => agent.jobArgsSchemas[type].safeParse(args).success;
it("export, uninstall and purge take the products, or none (the whole church)", () => {
for (const type of ["uninstall", "purge"] as const) {
expect(ok(type, { church: "hope" })).toBe(true);
expect(ok(type, { church: "hope", products: ["events"] })).toBe(true);
expect(ok(type, { church: "hope", products: [] })).toBe(false);
expect(ok(type, { church: "hope", products: ["everything"] })).toBe(false);
}
expect(ok("export", { church: "hope", exportId: "exp_abcdefgh", products: ["accounts"] })).toBe(true);
expect(agent.PRODUCT_UNINSTALL_MIN_AGENT).toBe("1.5.0");
});
});
+5 -3
View File
@@ -98,9 +98,11 @@ crosscode: Cross Code installs on this server ($(git -C "${CROSSCODE_FROM:-.}" r
crosscode restart <church> [events] reload the PM2 processes
crosscode demo <church> --profile <profile> replace Events' data with a demo set
crosscode env <church> <product> [--set NAME=value] show or change a product's .env values
crosscode export <church> --out <file.zip> the church's data and uploads
crosscode uninstall <church> --confirm <church> remove it (a final backup is kept 30 days)
crosscode purge <church> --confirm <church> delete what uninstall kept
crosscode export <church> [product …] --out <zip> the church's data and uploads
crosscode uninstall <church> [product …] --confirm <church>
remove it, or only those products (a final
backup is kept 30 days)
crosscode purge <church> [product …] --confirm <church> delete what uninstall kept
crosscode help [<command>] this, or a command's options
Every command takes --json (a report at the end) and --config <file> (settings from the Hub).
+131 -48
View File
@@ -15,12 +15,18 @@ crosscode env <church> <product> [--file backend/.env] --set NAME=value … [--u
change values (a copy is kept; never secrets or
generated values). The frontend's file rebuilds it.
If it doesn't start again, the file is put back.
crosscode export <church> --out <file.zip> the church's data (crosscode.church-export/1) and uploads
crosscode uninstall <church> --confirm <church>
crosscode export <church> [product …] --out <file.zip>
the church's data (crosscode.church-export/1) and
uploads: every product, or only those named
crosscode uninstall <church> [product …] --confirm <church>
final backup and uploads kept in
/var/www/sites/.removed/<church>-<date>/ (30 days),
then PM2, tunnels, database and folders removed
crosscode purge <church> --confirm <church> delete what uninstall kept
then PM2, tunnels, database and folders removed.
With products named only those go, and the church
keeps its others (naming every one = the church)
crosscode purge <church> [product …] --confirm <church>
delete what uninstall kept (with products named:
only what was kept of those)
All take --json (a report at the end; the log goes to stderr).
EOF
@@ -36,6 +42,21 @@ manage_products() {
return 0
}
# manage_check_named <product …>: stops unless the church (loaded) has each product named. Call it
# directly, not in $(…): die only stops the shell it runs in.
manage_check_named() {
local p
for p in "$@"; do
is_supported_product "$p" || die "Unknown product \"$p\" (this version handles: ${SUPPORTED_PRODUCTS[*]})."
church_has_product "$p" || die "$(cenv CHURCH) has no $p (its products: $(cenv PRODUCTS))."
done
}
# manage_named [product …]: those products in deploy order; none named: every product.
manage_named() {
if [ $# -gt 0 ]; then in_product_order "$@"; else manage_products; fi
}
cmd_restart() {
local church="" p
local -a named=()
@@ -198,14 +219,22 @@ cmd_env() {
die "$product didn't start with the new values, so $file was put back as it was."
}
# json_words <word …>: a JSON array of plain words (product names), e.g. ["accounts","events"].
json_words() {
local w out=""
for w in "$@"; do out+="${out:+,}\"$w\""; done
printf '[%s]' "$out"
}
cmd_export() {
local church="" out="" p tmp dir user bytes
local -a named=() products=()
while [ $# -gt 0 ]; do
case "$1" in
--out) [ $# -ge 2 ] || die "--out needs a file."; out="$2"; shift 2 ;;
-h|--help) manage_usage; return 0 ;;
-*) die "Unknown option $1 (crosscode help export)." ;;
*) [ -z "$church" ] || die "One church at a time."; church="$1"; shift ;;
*) if [ -z "$church" ]; then church="$1"; else named+=("$1"); fi; shift ;;
esac
done
[ -n "$church" ] || die "Name the church."
@@ -213,6 +242,9 @@ cmd_export() {
[ ! -e "$out" ] || die "$out exists already."
require_root
load_church "$church"
manage_check_named "${named[@]}"
mapfile -t products < <(manage_named "${named[@]}")
[ "${#products[@]}" -gt 0 ] || die "$church has nothing to export."
command -v zip >/dev/null || die "zip isn't installed (apt-get install zip)."
tmp="$(mktemp -d)"
chmod 755 "$tmp"
@@ -220,7 +252,7 @@ cmd_export() {
set +e
(
set -e
for p in $(manage_products); do
for p in "${products[@]}"; do
# shellcheck source=/dev/null
source "$CROSSCODE_HOME/products/$p.sh"
dir="$(pvar "$p" DIR)"; user="$(pvar "$p" USER)"
@@ -233,8 +265,8 @@ cmd_export() {
done
step "Zipping"
# One product: its folder is the ZIP's top level (export.json, uploads/, README.txt).
if [ "$(manage_products | wc -l)" = 1 ]; then
(cd "$tmp/$(manage_products)" && zip -qr "$out" .)
if [ "${#products[@]}" = 1 ]; then
(cd "$tmp/${products[0]}" && zip -qr "$out" .)
else
(cd "$tmp" && zip -qr "$out" .)
fi
@@ -247,31 +279,71 @@ cmd_export() {
bytes="$(stat -c %s "$out")"
report_result file "$out"
report_result_json bytes "$bytes"
step "Exported $church to $out ($bytes bytes)"
report_result_json products "$(json_words "${products[@]}")"
step "Exported $church (${products[*]}) to $out ($bytes bytes)"
}
# uninstall_product <church> <product>: stops and removes one product, once its final backup is
# kept: PM2, frpc tunnels, nginx site, database, and the old folder from an adopt.
uninstall_product() {
local church="$1" p="$2" user db old name
# shellcheck source=/dev/null
source "$CROSSCODE_HOME/products/$p.sh"
user="$(pvar "$p" USER)"; db="$(pvar "$p" DB)"
step "$p: stopping and removing the PM2 processes"
# shellcheck disable=SC2046 # the PM2 names are a space-separated list
run_as "$user" / pm2 delete $("${p}_pm2_names") >/dev/null 2>&1 || true
run_as "$user" / pm2 save --force >/dev/null 2>&1 || true
if [ -f "$FRPC_INI" ] && frpc_has_block "$church" "$p"; then
step "$p: removing the frpc tunnels"
frpc_remove "$church" "$p"
frpc_reload
fi
name="$church-$p"
if [ -f "/etc/nginx/sites-available/$name" ]; then
step "$p: removing the nginx site"
rm -f "/etc/nginx/sites-enabled/$name" "/etc/nginx/sites-available/$name"
if nginx -t >/dev/null 2>&1; then systemctl reload nginx; else warn "nginx didn't reload: check nginx -t."; fi
fi
if [ -n "$db" ]; then
step "$p: dropping the database $db"
db_drop "$db"
fi
old="$(pvar "$p" OLD_DIR)"
if [ -n "$old" ] && [ -d "$old" ]; then rm -rf -- "$old"; info "Removed the old folder $old."; fi
}
cmd_uninstall() {
local church="" confirm="" p dir user db kept old name
local church="" confirm="" p dir user kept key
local -a named=() products=() order=() left=()
while [ $# -gt 0 ]; do
case "$1" in
--confirm) [ $# -ge 2 ] || die "--confirm needs the church's name."; confirm="$2"; shift 2 ;;
-h|--help) manage_usage; return 0 ;;
-*) die "Unknown option $1 (crosscode help uninstall)." ;;
*) [ -z "$church" ] || die "One church at a time."; church="$1"; shift ;;
*) if [ -z "$church" ]; then church="$1"; else named+=("$1"); fi; shift ;;
esac
done
[ -n "$church" ] || die "Name the church."
[ "$confirm" = "$church" ] || die "Uninstalling removes $church's sites and databases: add --confirm $church."
require_root
load_church "$church"
manage_check_named "${named[@]}"
mapfile -t products < <(manage_named "${named[@]}")
# What the church keeps: every product of it not named (also ones this version can't handle).
for p in $(cenv PRODUCTS); do
[[ " ${products[*]} " == *" $p "* ]] || left+=("$p")
done
kept="$CROSSCODE_REMOVED/$church-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$kept"
chmod 700 "$CROSSCODE_REMOVED" "$kept"
report_result kept "$kept"
report_result_json products "$(json_words "${products[@]}")"
report_result_json remaining "$(json_words "${left[@]}")"
# 1. Keep a final backup, the uploads and the .env files (the backup needs JWT_SECRET to read
# stored secrets) for 30 days. Nothing is removed until this has worked for every product.
for p in $(manage_products); do
for p in "${products[@]}"; do
# shellcheck source=/dev/null
source "$CROSSCODE_HOME/products/$p.sh"
dir="$(pvar "$p" DIR)"; user="$(pvar "$p" USER)"
@@ -282,37 +354,30 @@ cmd_uninstall() {
done
# 2. Remove, last product first.
local -a order
mapfile -t order < <(manage_products | tac)
for p in "${order[@]}"; do
# shellcheck source=/dev/null
source "$CROSSCODE_HOME/products/$p.sh"
dir="$(pvar "$p" DIR)"; user="$(pvar "$p" USER)"; db="$(pvar "$p" DB)"
step "$p: stopping and removing the PM2 processes"
# shellcheck disable=SC2046 # the PM2 names are a space-separated list
run_as "$user" / pm2 delete $("${p}_pm2_names") >/dev/null 2>&1 || true
run_as "$user" / pm2 save --force >/dev/null 2>&1 || true
if [ -f "$FRPC_INI" ] && frpc_has_block "$church" "$p"; then
step "$p: removing the frpc tunnels"
frpc_remove "$church" "$p"
frpc_reload
fi
name="$church-$p"
if [ -f "/etc/nginx/sites-available/$name" ]; then
step "$p: removing the nginx site"
rm -f "/etc/nginx/sites-enabled/$name" "/etc/nginx/sites-available/$name"
if nginx -t >/dev/null 2>&1; then systemctl reload nginx; else warn "nginx didn't reload: check nginx -t."; fi
fi
if [ -n "$db" ]; then
step "$p: dropping the database $db"
db_drop "$db"
fi
old="$(pvar "$p" OLD_DIR)"
if [ -n "$old" ] && [ -d "$old" ]; then rm -rf -- "$old"; info "Removed the old folder $old."; fi
done
mapfile -t order < <(printf '%s\n' "${products[@]}" | tac)
for p in "${order[@]}"; do uninstall_product "$church" "$p"; done
# 3a. The church keeps other products: only the removed ones' folders and church.env lines go.
if [ "${#left[@]}" -gt 0 ]; then
for p in "${order[@]}"; do
dir="$(pvar "$p" DIR)"
if [ -n "$dir" ] && [ "$(dirname "$dir")" = "$(church_dir "$church")" ] && [ -d "$dir" ]; then
step "$p: removing $dir"
rm -rf -- "$dir"
fi
for key in "${!CENV[@]}"; do
[[ "$key" == "$(upper "$p")_"* ]] && church_env_unset "$key"
done
done
church_env_set PRODUCTS "${left[*]}"
church_env_write "$(church_env_path "$church")"
step "Uninstalled ${products[*]} of $church, which keeps ${left[*]}. Kept until purged (30 days): $kept"
return 0
fi
# 3b. Nothing is left: the church goes.
step "Removing $(church_dir "$church")"
user="$(pvar events USER)"
user="$(pvar events USER "$(pvar accounts USER)")"
rm -rf -- "$(church_dir "$church")"
# The app user goes too when crosscode made it for this church (cc-<church>).
if [ "$user" = "cc-$church" ] && id "$user" >/dev/null 2>&1; then
@@ -325,27 +390,45 @@ cmd_uninstall() {
}
cmd_purge() {
local church="" confirm="" d n=0
local church="" confirm="" d p n=0
local -a named=()
while [ $# -gt 0 ]; do
case "$1" in
--confirm) [ $# -ge 2 ] || die "--confirm needs the church's name."; confirm="$2"; shift 2 ;;
-h|--help) manage_usage; return 0 ;;
-*) die "Unknown option $1 (crosscode help purge)." ;;
*) [ -z "$church" ] || die "One church at a time."; church="$1"; shift ;;
*) if [ -z "$church" ]; then church="$1"; else named+=("$1"); fi; shift ;;
esac
done
[ -n "$church" ] || die "Name the church."
valid_slug "$church" || die "\"$church\" isn't a church name."
for p in "${named[@]}"; do is_known_product "$p" || die "Unknown product \"$p\"."; done
[ "$confirm" = "$church" ] || die "Purging deletes $church's last backup for good: add --confirm $church."
require_root
[ ! -f "$(church_env_path "$church")" ] || die "$church is still installed here; purge only deletes what uninstall kept."
if [ "${#named[@]}" -eq 0 ]; then
[ ! -f "$(church_env_path "$church")" ] || die "$church is still installed here; purge only deletes what uninstall kept (name the products that were uninstalled)."
elif church_env_read "$(church_env_path "$church")"; then
for p in "${named[@]}"; do
! church_has_product "$p" || die "$church still has $p here; purge only deletes what uninstall kept."
done
fi
for d in "$CROSSCODE_REMOVED/$church"-*; do
[ -d "$d" ] || continue
[[ "$(basename "$d")" =~ ^${church}-[0-9]{8}-[0-9]{6}$ ]] || continue
step "Deleting $d"
rm -rf -- "$d"
n=$((n + 1))
if [ "${#named[@]}" -eq 0 ]; then
step "Deleting $d"
rm -rf -- "$d"
n=$((n + 1))
continue
fi
for p in "${named[@]}"; do
[ -d "$d/$p" ] || continue
step "Deleting $d/$p"
rm -rf -- "${d:?}/$p"
n=$((n + 1))
done
rmdir -- "$d" 2>/dev/null || true
done
report_result_json deleted "$n"
[ "$n" -gt 0 ] || info "Nothing kept for $church."
[ "$n" -gt 0 ] || info "Nothing kept for $church${named[*]:+ (${named[*]})}."
}
+1 -1
View File
@@ -62,7 +62,7 @@ json() { node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>{const
@test "help lists the new commands" {
run bash "$CC" help
[[ "$output" == *"crosscode uninstall <church> --confirm <church>"* ]]
[[ "$output" == *"crosscode uninstall <church> [product …] --confirm <church>"* ]]
[[ "$output" == *"--json"* ]]
run bash "$CC" help export
[[ "$output" == *"crosscode.church-export/1"* ]]
+102
View File
@@ -0,0 +1,102 @@
#!/usr/bin/env bats
# crosscode uninstall / purge (lib/manage.sh) with products named: only those go, and the church
# keeps the others in church.env. Naming every product removes the church, as before.
setup() {
export CROSSCODE_NO_UPDATE=1 CROSSCODE_TEST=1
TMP="$BATS_TEST_TMPDIR"
CALLS="$TMP/calls"
: > "$CALLS"
export CROSSCODE_SITES="$TMP/sites" FRPC_INI="$TMP/frpc.ini"
# shellcheck source=../lib/common.sh
source "$BATS_TEST_DIRNAME/../lib/common.sh"
# shellcheck source=../lib/frpc.sh
source "$BATS_TEST_DIRNAME/../lib/frpc.sh"
# shellcheck source=../lib/manage.sh
source "$BATS_TEST_DIRNAME/../lib/manage.sh"
# A church with Accounts and Events, and the products' hooks recording what they'd do.
export CROSSCODE_HOME="$TMP/home"
mkdir -p "$CROSSCODE_HOME/products" "$TMP/sites/hope/accounts" "$TMP/sites/hope/events"
for p in accounts events; do
cat > "$CROSSCODE_HOME/products/$p.sh" <<EOF
${p}_backup() { echo "backup $p" >> "$CALLS"; }
${p}_keep() { mkdir -p "\$2"; echo "keep $p" >> "$CALLS"; }
${p}_pm2_names() { echo "hope-$p-backend hope-$p-frontend"; }
EOF
done
cat > "$TMP/sites/hope/church.env" <<EOF
CHURCH=hope
PRODUCTS="accounts events"
ADDRESS=hope.co.za
ACCOUNTS_DIR=$TMP/sites/hope/accounts
ACCOUNTS_DB=hope_accounts
ACCOUNTS_DOMAIN=accounts.hope.co.za
ACCOUNTS_USER=cc-hope
EVENTS_DIR=$TMP/sites/hope/events
EVENTS_DB=hope_events
EVENTS_DOMAIN=events.hope.co.za
EVENTS_USER=cc-hope
EOF
run_as() { echo "run $3 $4" >> "$CALLS"; }
db_drop() { echo "drop $1" >> "$CALLS"; }
}
@test "one product named: only it goes, the church keeps the other" {
run cmd_uninstall hope events --confirm hope
[ "$status" -eq 0 ]
grep -q "backup events" "$CALLS"
! grep -q "backup accounts" "$CALLS"
grep -q "drop hope_events" "$CALLS"
! grep -q "drop hope_accounts" "$CALLS"
[ ! -e "$TMP/sites/hope/events" ]
[ -d "$TMP/sites/hope/accounts" ]
grep -q '^PRODUCTS=accounts$' "$TMP/sites/hope/church.env"
! grep -q '^EVENTS_' "$TMP/sites/hope/church.env"
grep -q '^ACCOUNTS_DB=hope_accounts$' "$TMP/sites/hope/church.env"
[[ "$output" == *"which keeps accounts"* ]]
ls -d "$TMP/sites/.removed"/hope-*/events
}
@test "then the other: the church goes" {
run cmd_uninstall hope events --confirm hope
[ "$status" -eq 0 ]
run cmd_uninstall hope accounts --confirm hope
[ "$status" -eq 0 ]
[ ! -e "$TMP/sites/hope" ]
[[ "$output" == *"Uninstalled hope."* ]]
}
@test "no product named: the whole church, as before" {
run cmd_uninstall hope --confirm hope
[ "$status" -eq 0 ]
grep -q "drop hope_events" "$CALLS"
grep -q "drop hope_accounts" "$CALLS"
[ ! -e "$TMP/sites/hope" ]
}
@test "a product the church doesn't have is refused before anything happens" {
sed -i 's/^PRODUCTS=.*/PRODUCTS=accounts/' "$TMP/sites/hope/church.env"
run cmd_uninstall hope events --confirm hope
[ "$status" -eq 1 ]
[[ "$output" == *"hope has no events"* ]]
[ ! -s "$CALLS" ]
run cmd_uninstall hope website2 --confirm hope
[ "$status" -eq 1 ]
}
@test "purge with a product: only what was kept of it, also while the church is still here" {
run cmd_uninstall hope events --confirm hope
[ "$status" -eq 0 ]
kept="$(ls -d "$TMP/sites/.removed"/hope-*)"
mkdir -p "$kept/accounts"
run cmd_purge hope events --confirm hope
[ "$status" -eq 0 ]
[ ! -e "$kept/events" ]
[ -d "$kept/accounts" ]
# Accounts is still installed: its kept copy isn't purged, nor the whole church.
run cmd_purge hope accounts --confirm hope
[ "$status" -eq 1 ]
run cmd_purge hope --confirm hope
[ "$status" -eq 1 ]
}