crosscode: the Church App (app.sh, add, demo) and the App's changelog

scripts/products/app.sh and app.env.template.json; app in
SUPPORTED_PRODUCTS; crosscode add <church> app (Accounts first);
crosscode demo <church> app --profile <s>, and the App's turn, last,
in a whole demo scenario. app.bats and demo.bats; app.sh linted.
The full bats suite wasn't run (stopped for low memory); app.bats and
demo.bats pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 16:11:41 +02:00
co-authored by Claude Opus 5.5
parent acd3b259a1
commit 71f2f02ee5
11 changed files with 407 additions and 25 deletions
+11 -7
View File
@@ -214,6 +214,7 @@ install_product() {
events) install_events "$@" ;;
accounts) install_accounts "$@" ;;
website) install_website "$@" ;;
app) install_app_product "$@" ;;
*) die "This version of crosscode can't install $product." ;;
esac
}
@@ -242,7 +243,7 @@ install_done() {
info "DNS (if not set yet): $domain → this server (A record, or a CNAME)."
fi
case "$product" in
website) info "Open https://$domain/admin and sign in with the admin email the Hub was given: that account becomes the first Owner." ;;
website|app) info "Open https://$domain/admin and sign in with the admin email the Hub was given: that account becomes the first Owner." ;;
*) info "Open https://$domain/setup to create the admin account." ;;
esac
if [ "$product" = accounts ]; then info "Updates: crosscode deploy $church (Accounts is always updated first)"; else info "Updates: crosscode deploy $church $product"; fi
@@ -252,10 +253,10 @@ add_usage() {
cat <<'EOF'
crosscode add <church> <product> [options]
Adds a product to a church already installed here (Accounts next to Events, the Website next to
Accounts), in
its own folder, database, PM2 processes and site, run by the church's app user. If a step fails,
what this run made is removed again; the church's other products aren't touched.
Adds a product to a church already installed here (Accounts next to Events, the Website or the
App next to Accounts), in its own folder, database, PM2 processes and site, run by the church's
app user. If a step fails, what this run made is removed again; the church's other products
aren't touched.
--domain <domain> where it's served (default: <product>.<the church's address>; the
Website: www.<address>, or the address itself on a Cross Code address)
@@ -298,13 +299,15 @@ cmd_add() {
[ -n "$church" ] && [ -n "$product" ] || { add_usage; die "Name the church and the product."; }
valid_slug "$church" || die "\"$church\" isn't a church name."
is_known_product "$product" || die "Unknown product \"$product\"."
case "$product" in events|accounts|website) ;; *) die "This version of crosscode can only add events, accounts and website." ;; esac
case "$product" in events|accounts|website|app) ;; *) die "This version of crosscode can only add events, accounts, website and app." ;; esac
install_check_options "$product" "$ssl" "$email" "$version" "$main" "$frp" "$api" "$web"
require_root
load_church "$church"
! church_has_product "$product" || die "$church already has $product (crosscode status $church)."
# The Website signs in through the church's Accounts and can't be reached without it (WEBSITE-1.0-PLAN §11).
[ "$product" != website ] || church_has_product accounts || die "The Website needs the church's Accounts: add it first (crosscode add $church accounts)."
# The App too: everyone signs in through Accounts, and its licence needs the church's Accounts (APP-1.0-PLAN §12).
[ "$product" != app ] || church_has_product accounts || die "The App needs the church's Accounts: add it first (crosscode add $church accounts)."
local address user="" existing
address="$(cenv ADDRESS)"
[ -n "$domain" ] || [ -n "$address" ] || die "--domain is needed: the church has no address in church.env."
@@ -448,9 +451,10 @@ install_events() {
install_accounts() { install_app accounts Accounts ACCOUNTS_SECRET "$@"; }
install_website() { install_app website Website WEBSITE_SECRET "$@"; }
install_app_product() { install_app app App APP_SECRET "$@"; }
# install_app <product> <title> <generated secret> <church> <user> <domain> <api> <web> <version>
# <main> <ssl> <email> <frp>: Accounts and the Website (and later the App), which share one shape:
# <main> <ssl> <email> <frp>: Accounts, the Website and the App, which share one shape:
# a checkout of crosscode-platform, apps/<product>/{backend,frontend}, ecosystem.config.cjs, and
# one secret generated here that never leaves the server.
install_app() {