VersionControl:PRs/maybelle-config/258: Difference between revisions

From PickiPedia: A knowledge base of bluegrass, old time psychedelic jams, and other public domain music
Jump to navigationJump to search
DrivingThatTrain (talk | contribs)
cryptograss/maybelle-config#258, as GitHub has it
 
DrivingThatTrain (talk | contribs)
cryptograss/maybelle-config#258, as GitHub has it
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
|url=https://github.com/cryptograss/maybelle-config/pull/258
|url=https://github.com/cryptograss/maybelle-config/pull/258
|author=magent-cryptograss
|author=magent-cryptograss
|state=open
|state=merged
|base=production
|base=production
|branch=mood-previews
|branch=mood-previews
|opened=2026-11-01 10:28:35
|opened=2026-11-01 10:28:35
|pushed=2026-11-01 10:28:31
|pushed=2026-11-01 10:28:31
|merged=
|merged=2026-11-01 14:30:38
|closed=
|closed=
|worked_on_by=magent, re, justin
|worked_on_by=magent, re, justin
Line 16: Line 16:
|deploy=hunter, after #256 and #257
|deploy=hunter, after #256 and #257
}}
}}
<pre class="pr-body">Step 4 of [Cryptograss:Moods as Directories](https://pickipedia.xyz/wiki/Cryptograss:Moods_as_Directories). **Stacked on #257, which is stacked on #256.** Merge in order: #256, #257, then this.
**What it adds**
- **`hunter-mood-previews`** (new `mood-previews` role) runs each minute as root.
  - Every Mood directory under `/opt/magenta/moods` gets **ten preview ports in workbench**, in blocks of ten from 15000. The block is kept in the Mood's `.previews` file, so renaming the directory keeps it. Two directories with a copied `.previews` don't share a block.
  - The file lists each port beside its hostname, so anyone in the Mood can read which ports are theirs.
  - It writes `/etc/caddy/moods.caddy`, with one site for each `&lt;slug&gt;&lt;N&gt;.hunter.cryptograss.live` pointing at **workbench's address on magenta-net**. Nothing is published: hunter's host reaches a container's port directly (tested, HTTP 200).
  - It reloads Caddy only when something changed and `caddy validate` accepts the result. If Caddy rejects it, the old config keeps running.
- **Certificates on demand.** Ten hostnames for each Mood, issued all at once, would exceed Let's Encrypt's 50 new certificates a week for cryptograss.live. So `on_demand_tls` asks for a certificate only when a hostname is first visited. It only asks for hostnames listed in `/etc/caddy/moods-ask`, which Caddy itself checks on `localhost:5555`.
- **No clashes.** A Mood named like a container that still has its own `&lt;name&gt;0-9` hostnames (uploads-and-embeds, docs-tests-qa) is left out until that container retires (step 5). Two sites with one address would stop Caddy from loading.
- **The empty `moods.caddy` and `moods-ask`** are created by the caddy role before Caddy first loads the Caddyfile that imports them.
**Tested**
- 8 new tests in `test_mood_previews.py`: blocks given and kept, a rename, a copied `.previews`, reloading only on change, a Mood removed, workbench changing address, a Mood named like a container, no workbench, and only plain slugs. The `hunter` CI job now runs them.
- The rendered Caddyfile, run under **hunter's own Caddy binary (2.6.2)**: `Valid configuration`. The ask endpoint answered **200** for a listed hostname and **404** for an unlisted one, for `../Caddyfile`, and for an empty name.
- `render_diff.py` against production shows the workbench entries, the on-demand block, the ask site and the import, and nothing else.
**Not in this step:** a way for re and blu to start a preview in workbench themselves. For now, people start previews there, and magent through docker.sock. Per-agent keys come when they're needed (discussed in #emergence).
Deploy: hunter, after #256 and #257
Worked on by: magent, re, Justin, in #emergence</pre>

Latest revision as of 17:06, 9 November 2026

maybelle-config#258: hunter: each Mood's previews by its name, <slug>0-9.hunter, from workbench (Moods as Directories, step 4)
State 🟣 merged 2026-11-01 14:30:38
Worked on by magent, re, justin
Moods #emergence
Deploy hunter, after #256 and #257
Branch mood-previews → production, by magent-cryptograss
Opened · last pushed 2026-11-01 10:28:35 · 2026-11-01 10:28:31
Step 4 of [Cryptograss:Moods as Directories](https://pickipedia.xyz/wiki/Cryptograss:Moods_as_Directories). **Stacked on #257, which is stacked on #256.** Merge in order: #256, #257, then this.

**What it adds**
- **`hunter-mood-previews`** (new `mood-previews` role) runs each minute as root.
  - Every Mood directory under `/opt/magenta/moods` gets **ten preview ports in workbench**, in blocks of ten from 15000. The block is kept in the Mood's `.previews` file, so renaming the directory keeps it. Two directories with a copied `.previews` don't share a block.
  - The file lists each port beside its hostname, so anyone in the Mood can read which ports are theirs.
  - It writes `/etc/caddy/moods.caddy`, with one site for each `<slug><N>.hunter.cryptograss.live` pointing at **workbench's address on magenta-net**. Nothing is published: hunter's host reaches a container's port directly (tested, HTTP 200).
  - It reloads Caddy only when something changed and `caddy validate` accepts the result. If Caddy rejects it, the old config keeps running.
- **Certificates on demand.** Ten hostnames for each Mood, issued all at once, would exceed Let's Encrypt's 50 new certificates a week for cryptograss.live. So `on_demand_tls` asks for a certificate only when a hostname is first visited. It only asks for hostnames listed in `/etc/caddy/moods-ask`, which Caddy itself checks on `localhost:5555`.
- **No clashes.** A Mood named like a container that still has its own `<name>0-9` hostnames (uploads-and-embeds, docs-tests-qa) is left out until that container retires (step 5). Two sites with one address would stop Caddy from loading.
- **The empty `moods.caddy` and `moods-ask`** are created by the caddy role before Caddy first loads the Caddyfile that imports them.

**Tested**
- 8 new tests in `test_mood_previews.py`: blocks given and kept, a rename, a copied `.previews`, reloading only on change, a Mood removed, workbench changing address, a Mood named like a container, no workbench, and only plain slugs. The `hunter` CI job now runs them.
- The rendered Caddyfile, run under **hunter's own Caddy binary (2.6.2)**: `Valid configuration`. The ask endpoint answered **200** for a listed hostname and **404** for an unlisted one, for `../Caddyfile`, and for an empty name.
- `render_diff.py` against production shows the workbench entries, the on-demand block, the ask site and the import, and nothing else.

**Not in this step:** a way for re and blu to start a preview in workbench themselves. For now, people start previews there, and magent through docker.sock. Per-agent keys come when they're needed (discussed in #emergence).

Deploy: hunter, after #256 and #257
Worked on by: magent, re, Justin, in #emergence