Docs: adopt builds next to the install and switches over; adopt --undo (decisions 25-26)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+30
-18
@@ -518,6 +518,7 @@ own migrations), so a Website install never builds Events.
|
||||
| `crosscode install <church> --products events,website --domain … ` | A new church (from today's `install.sh`): Accounts always, plus the products named; databases, `.env` files, PM2, nginx and certificates; prints the DNS records needed |
|
||||
| `crosscode add <church> app` | Adds a product to an existing church |
|
||||
| `crosscode adopt <church> --events-dir /var/www/<old folder>` | Once per existing Cross Events install: moves it onto the monorepo and into `/var/www/sites/<church>/events` (below) |
|
||||
| `crosscode adopt <church> --undo` | Goes back to the old folder and the 2.1.x it ran, while the old folder is kept (14 days) |
|
||||
|
||||
Before Accounts exists (until phase 3), "always Accounts" is skipped for churches that don't have
|
||||
it yet.
|
||||
@@ -537,28 +538,32 @@ it yet.
|
||||
reached.
|
||||
|
||||
**Moving existing Cross Events installs (Events 2.2.0, `crosscode adopt`).** Once per server
|
||||
install, run by Joshua. It:
|
||||
install, run by Joshua. **The new checkout is built next to the running install, then PM2 switches
|
||||
over** (decided 2026-11-05, decision 25). The running folder is never moved, because moving it
|
||||
underneath PM2 would break everything the running processes read from disk later, so the site
|
||||
would be down for the whole build. The steps are in
|
||||
[EVENTS-2.2-PLAN.md](./EVENTS-2.2-PLAN.md) §5. In short:
|
||||
|
||||
1. Moves the install's folder from `/var/www/<old folder>` to `/var/www/sites/<church>/events`
|
||||
(skipped if it's already there, e.g. moved by hand) and writes `church.env`.
|
||||
2. Changes the checkout's remote to `crosscode-platform` and moves the install's own files to
|
||||
the new paths: `backend/.env` → `apps/events/backend/.env`, likewise the frontend `.env`,
|
||||
`backend/public/uploads/`, `backend/backups/`, `backend/data/*.json`, and
|
||||
`ecosystem.config.js` with its `cwd` paths updated.
|
||||
3. Checks out `events@2.2.0`, builds, and **re-registers the PM2 processes** under their existing
|
||||
names from the new folder (`pm2 delete` + `pm2 start` + `pm2 save`: PM2 remembers the folder a
|
||||
process was started from, so a reload isn't enough after a move).
|
||||
1. Checks: the old folder is a `hope-events` checkout at a `v2.1.x` tag with no files changed by
|
||||
hand. Reads the PM2 names, ports and database name the install already has, and writes
|
||||
`church.env`.
|
||||
2. A fresh checkout of `crosscode-platform` at `events@2.2.0` in
|
||||
`/var/www/sites/<church>/events`. The install's own files are copied into `apps/events/`:
|
||||
`backend/.env` and the frontend `.env`, `backend/data/*.json`, `backend/backups/`,
|
||||
`ecosystem.config.js` (absolute `cwd`s rewritten), and the uploads (`rsync`). Then it builds.
|
||||
The old install keeps serving throughout.
|
||||
3. Switch over (a few seconds of downtime): database backup → a final `rsync` of the uploads and
|
||||
data files → no pending migrations → `pm2 delete` + `pm2 start` from the new folder +
|
||||
`pm2 save` (PM2 remembers the folder a process was started from, so a reload isn't enough) →
|
||||
`/health` reports 2.2.0. If that fails, PM2 starts from the old folder again, which was never
|
||||
changed.
|
||||
4. The old folder is kept as `<old>.pre-2.2.0` for 14 days. **`crosscode adopt <church> --undo`**
|
||||
(decision 26) goes back to it within that time, copying back uploads added since.
|
||||
`crosscode status` reminds you to remove it afterwards.
|
||||
|
||||
The PM2 names, nginx config (it only proxies to ports, so it doesn't change when the folder
|
||||
moves), database and its name stay the same. If anything fails it moves everything back, returns
|
||||
to the `hope-events` remote and the version it was on, and starts PM2 from the old folder again.
|
||||
The PM2 names, nginx config (it only proxies to ports), database and its name stay the same.
|
||||
Installs that haven't moved yet keep working with `deploy.sh` on the archived repo.
|
||||
|
||||
**Moving a folder by hand before 2.2.0** works too: move it into `/var/www/sites/<church>/events`,
|
||||
then `pm2 delete` its two processes, `pm2 start ecosystem.config.js` from the new folder and
|
||||
`pm2 save`. `deploy.sh` works from wherever the install is, and `adopt` later sees it's already in
|
||||
place.
|
||||
|
||||
---
|
||||
|
||||
## 9. Build order
|
||||
@@ -773,6 +778,13 @@ ranking.
|
||||
| 23 | Deploying | **One `crosscode` script** for every product, with every church under `/var/www/sites/<church>/<product>`: `crosscode deploy <church> [events] [website] [app]` always updates Accounts and then the products named, in a fixed order, each rolled back on its own if it fails. Still git checkouts of tags, still run by Joshua; the Hub never deploys (§8) |
|
||||
| 24 | Product requirements | A release can require a minimum version of a sibling (`— requires accounts 1.2.0` in `WHATS-NEW.md`). The Hub **disables Request update** until it's met, and the script refuses to deploy without it (§5, §8) |
|
||||
|
||||
**Added 2026-11-05**
|
||||
|
||||
| # | Question | Decision |
|
||||
|---|----------|----------|
|
||||
| 25 | Moving existing Events installs | `crosscode adopt` **builds the new checkout next to the running install and switches PM2 over** (seconds of downtime) instead of moving the running folder; the old folder is untouched, so a failure just starts it again (§8) |
|
||||
| 26 | Undoing a move | **`crosscode adopt <church> --undo`** goes back to the old folder and its 2.1.x while it's kept (14 days) (§8) |
|
||||
|
||||
## Still open
|
||||
|
||||
Nothing. crosscode-site is updated at the end of each phase (§9, "Updating crosscode-site"); the
|
||||
|
||||
Reference in New Issue
Block a user