crosscode: install and add Accounts; agent: Accounts installs and add-product
crosscode install takes --products accounts (one product per install); crosscode add <church> <product> installs a product next to a church's others, as its app user, undoing only its own folder, database, PM2 and site if a step fails. install_events/install_accounts share the checks, ports and nginx site. Agent 1.1.0: install jobs for Accounts, and add-product jobs (behind frp, with the Hub's ports and release). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+17
-11
@@ -11,21 +11,27 @@ export function crosscodeArgs(job: agent.AgentJob, opts: { exportFile?: string }
|
||||
switch (job.type) {
|
||||
case "install": {
|
||||
const a = job.args;
|
||||
if (a.products.length !== 1 || a.products[0] !== "events") throw new Error("This agent can only install Events so far.");
|
||||
const domain = a.domains.events;
|
||||
const ports = a.ports.events;
|
||||
if (!domain || !ports) throw new Error("An Events install needs its domain and ports.");
|
||||
// The church's address: the Events domain without "events." (crosscode uses it for the
|
||||
// church.env ADDRESS; the domain itself goes in --events-domain).
|
||||
const address = domain.startsWith("events.") ? domain.slice("events.".length) : domain;
|
||||
const out = ["install", a.church, "--products", "events", "--domain", address, "--events-domain", domain,
|
||||
const product = a.products[0];
|
||||
if (a.products.length !== 1 || (product !== "events" && product !== "accounts")) throw new Error("This agent installs one product at a time: Events or Accounts.");
|
||||
const domain = a.domains[product];
|
||||
const ports = a.ports[product];
|
||||
if (!domain || !ports) throw new Error(`An install of ${product} needs its domain and ports.`);
|
||||
// The church's address: the product's domain without "<product>." (crosscode keeps it in
|
||||
// church.env ADDRESS for the products added later; the domain itself goes in --<product>-domain).
|
||||
const address = domain.startsWith(`${product}.`) ? domain.slice(product.length + 1) : domain;
|
||||
const out = ["install", a.church, "--products", product, "--domain", address, `--${product}-domain`, domain,
|
||||
"--api-port", String(ports.api), "--web-port", String(ports.web), "--frp"];
|
||||
const v = a.versions?.events;
|
||||
const v = a.versions?.[product];
|
||||
if (v) out.push("--version", v);
|
||||
return out;
|
||||
}
|
||||
case "add-product":
|
||||
return ["add", job.args.church, job.args.product];
|
||||
case "add-product": {
|
||||
// A product next to the church's others (phase 3: Accounts next to Events), behind frp.
|
||||
const a = job.args;
|
||||
const out = ["add", a.church, a.product, "--domain", a.domain, "--api-port", String(a.ports.api), "--web-port", String(a.ports.web), "--frp"];
|
||||
if (a.version) out.push("--version", a.version);
|
||||
return out;
|
||||
}
|
||||
case "deploy": {
|
||||
const out = ["deploy", job.args.church, ...job.args.products];
|
||||
for (const v of job.args.versions ?? []) out.push("--version", v);
|
||||
|
||||
Reference in New Issue
Block a user