@brunosouzas/stackledger 0.0.0-stage → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +261 -2
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +97 -0
- package/dist/cli.js.map +1 -0
- package/dist/control.d.ts +2 -0
- package/dist/control.js +22 -0
- package/dist/control.js.map +1 -0
- package/dist/discover-command.d.ts +7 -0
- package/dist/discover-command.js +60 -0
- package/dist/discover-command.js.map +1 -0
- package/dist/discovery/annotations.d.ts +24 -0
- package/dist/discovery/annotations.js +37 -0
- package/dist/discovery/annotations.js.map +1 -0
- package/dist/discovery/host.d.ts +47 -0
- package/dist/discovery/host.js +56 -0
- package/dist/discovery/host.js.map +1 -0
- package/dist/discovery/index.d.ts +15 -0
- package/dist/discovery/index.js +30 -0
- package/dist/discovery/index.js.map +1 -0
- package/dist/discovery/machine.d.ts +14 -0
- package/dist/discovery/machine.js +17 -0
- package/dist/discovery/machine.js.map +1 -0
- package/dist/discovery/run.d.ts +39 -0
- package/dist/discovery/run.js +130 -0
- package/dist/discovery/run.js.map +1 -0
- package/dist/discovery/snapshot.d.ts +60 -0
- package/dist/discovery/snapshot.js +161 -0
- package/dist/discovery/snapshot.js.map +1 -0
- package/dist/discovery/sources/apps.d.ts +3 -0
- package/dist/discovery/sources/apps.js +136 -0
- package/dist/discovery/sources/apps.js.map +1 -0
- package/dist/discovery/sources/brew.d.ts +15 -0
- package/dist/discovery/sources/brew.js +69 -0
- package/dist/discovery/sources/brew.js.map +1 -0
- package/dist/discovery/sources/common.d.ts +39 -0
- package/dist/discovery/sources/common.js +70 -0
- package/dist/discovery/sources/common.js.map +1 -0
- package/dist/discovery/sources/index.d.ts +8 -0
- package/dist/discovery/sources/index.js +12 -0
- package/dist/discovery/sources/index.js.map +1 -0
- package/dist/discovery/sources/launchd.d.ts +3 -0
- package/dist/discovery/sources/launchd.js +65 -0
- package/dist/discovery/sources/launchd.js.map +1 -0
- package/dist/discovery/sources/mas.d.ts +9 -0
- package/dist/discovery/sources/mas.js +25 -0
- package/dist/discovery/sources/mas.js.map +1 -0
- package/dist/discovery/sources/mise.d.ts +5 -0
- package/dist/discovery/sources/mise.js +64 -0
- package/dist/discovery/sources/mise.js.map +1 -0
- package/dist/discovery/sources/npm.d.ts +12 -0
- package/dist/discovery/sources/npm.js +34 -0
- package/dist/discovery/sources/npm.js.map +1 -0
- package/dist/discovery/sources/pipx.d.ts +4 -0
- package/dist/discovery/sources/pipx.js +82 -0
- package/dist/discovery/sources/pipx.js.map +1 -0
- package/dist/discovery/types.d.ts +73 -0
- package/dist/discovery/types.js +10 -0
- package/dist/discovery/types.js.map +1 -0
- package/dist/discovery/write.d.ts +50 -0
- package/dist/discovery/write.js +196 -0
- package/dist/discovery/write.js.map +1 -0
- package/dist/drift-command.d.ts +62 -0
- package/dist/drift-command.js +375 -0
- package/dist/drift-command.js.map +1 -0
- package/dist/drift-formats.d.ts +3 -0
- package/dist/drift-formats.js +54 -0
- package/dist/drift-formats.js.map +1 -0
- package/dist/drift.d.ts +95 -0
- package/dist/drift.js +206 -0
- package/dist/drift.js.map +1 -0
- package/dist/errors.d.ts +15 -0
- package/dist/errors.js +26 -0
- package/dist/errors.js.map +1 -0
- package/dist/graph.d.ts +103 -0
- package/dist/graph.js +181 -0
- package/dist/graph.js.map +1 -0
- package/dist/ics.d.ts +18 -0
- package/dist/ics.js +103 -0
- package/dist/ics.js.map +1 -0
- package/dist/identity.d.ts +18 -0
- package/dist/identity.js +36 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/map/badges.d.ts +20 -0
- package/dist/map/badges.js +95 -0
- package/dist/map/badges.js.map +1 -0
- package/dist/map/command.d.ts +8 -0
- package/dist/map/command.js +86 -0
- package/dist/map/command.js.map +1 -0
- package/dist/map/heap.d.ts +15 -0
- package/dist/map/heap.js +57 -0
- package/dist/map/heap.js.map +1 -0
- package/dist/map/ink.d.ts +11 -0
- package/dist/map/ink.js +10 -0
- package/dist/map/ink.js.map +1 -0
- package/dist/map/labels.d.ts +43 -0
- package/dist/map/labels.js +172 -0
- package/dist/map/labels.js.map +1 -0
- package/dist/map/layout.d.ts +64 -0
- package/dist/map/layout.js +228 -0
- package/dist/map/layout.js.map +1 -0
- package/dist/map/model.d.ts +46 -0
- package/dist/map/model.js +84 -0
- package/dist/map/model.js.map +1 -0
- package/dist/map/neighbourhood.d.ts +18 -0
- package/dist/map/neighbourhood.js +137 -0
- package/dist/map/neighbourhood.js.map +1 -0
- package/dist/map/parallel.d.ts +35 -0
- package/dist/map/parallel.js +261 -0
- package/dist/map/parallel.js.map +1 -0
- package/dist/map/pieces.d.ts +12 -0
- package/dist/map/pieces.js +15 -0
- package/dist/map/pieces.js.map +1 -0
- package/dist/map/relations.d.ts +39 -0
- package/dist/map/relations.js +122 -0
- package/dist/map/relations.js.map +1 -0
- package/dist/map/route.d.ts +25 -0
- package/dist/map/route.js +165 -0
- package/dist/map/route.js.map +1 -0
- package/dist/map/strip.d.ts +29 -0
- package/dist/map/strip.js +120 -0
- package/dist/map/strip.js.map +1 -0
- package/dist/map/suggest.d.ts +21 -0
- package/dist/map/suggest.js +97 -0
- package/dist/map/suggest.js.map +1 -0
- package/dist/map/svg.d.ts +29 -0
- package/dist/map/svg.js +203 -0
- package/dist/map/svg.js.map +1 -0
- package/dist/map/themes.d.ts +64 -0
- package/dist/map/themes.js +94 -0
- package/dist/map/themes.js.map +1 -0
- package/dist/map/xml.d.ts +6 -0
- package/dist/map/xml.js +57 -0
- package/dist/map/xml.js.map +1 -0
- package/dist/map/zones.d.ts +19 -0
- package/dist/map/zones.js +46 -0
- package/dist/map/zones.js.map +1 -0
- package/dist/mcp.d.ts +2 -0
- package/dist/mcp.js +145 -0
- package/dist/mcp.js.map +1 -0
- package/dist/money.d.ts +32 -0
- package/dist/money.js +91 -0
- package/dist/money.js.map +1 -0
- package/dist/report-command.d.ts +3 -0
- package/dist/report-command.js +85 -0
- package/dist/report-command.js.map +1 -0
- package/dist/report-formats.d.ts +11 -0
- package/dist/report-formats.js +157 -0
- package/dist/report-formats.js.map +1 -0
- package/dist/reports.d.ts +105 -0
- package/dist/reports.js +247 -0
- package/dist/reports.js.map +1 -0
- package/dist/scaffold.d.ts +30 -0
- package/dist/scaffold.js +140 -0
- package/dist/scaffold.js.map +1 -0
- package/dist/schema.d.ts +345 -0
- package/dist/schema.js +120 -0
- package/dist/schema.js.map +1 -0
- package/dist/secrets.d.ts +7 -0
- package/dist/secrets.js +68 -0
- package/dist/secrets.js.map +1 -0
- package/dist/site/build.d.ts +22 -0
- package/dist/site/build.js +198 -0
- package/dist/site/build.js.map +1 -0
- package/dist/site/command.d.ts +2 -0
- package/dist/site/command.js +221 -0
- package/dist/site/command.js.map +1 -0
- package/dist/site/data.d.ts +225 -0
- package/dist/site/data.js +243 -0
- package/dist/site/data.js.map +1 -0
- package/dist/site/fs-ops.d.ts +35 -0
- package/dist/site/fs-ops.js +26 -0
- package/dist/site/fs-ops.js.map +1 -0
- package/dist/site/owners.d.ts +5 -0
- package/dist/site/owners.js +50 -0
- package/dist/site/owners.js.map +1 -0
- package/dist/site/paths.d.ts +34 -0
- package/dist/site/paths.js +48 -0
- package/dist/site/paths.js.map +1 -0
- package/dist/site/policy.d.ts +17 -0
- package/dist/site/policy.js +26 -0
- package/dist/site/policy.js.map +1 -0
- package/dist/site/publish.d.ts +14 -0
- package/dist/site/publish.js +90 -0
- package/dist/site/publish.js.map +1 -0
- package/dist/site/relative.d.ts +14 -0
- package/dist/site/relative.js +265 -0
- package/dist/site/relative.js.map +1 -0
- package/dist/site/skills-build.d.ts +22 -0
- package/dist/site/skills-build.js +126 -0
- package/dist/site/skills-build.js.map +1 -0
- package/dist/site/skills-data.d.ts +89 -0
- package/dist/site/skills-data.js +94 -0
- package/dist/site/skills-data.js.map +1 -0
- package/dist/site/staging.d.ts +19 -0
- package/dist/site/staging.js +76 -0
- package/dist/site/staging.js.map +1 -0
- package/dist/site/ui-icons.d.ts +4 -0
- package/dist/site/ui-icons.js +19 -0
- package/dist/site/ui-icons.js.map +1 -0
- package/dist/skills/command.d.ts +8 -0
- package/dist/skills/command.js +64 -0
- package/dist/skills/command.js.map +1 -0
- package/dist/skills/frontmatter.d.ts +37 -0
- package/dist/skills/frontmatter.js +219 -0
- package/dist/skills/frontmatter.js.map +1 -0
- package/dist/skills/graph.d.ts +39 -0
- package/dist/skills/graph.js +100 -0
- package/dist/skills/graph.js.map +1 -0
- package/dist/skills/ignore.d.ts +34 -0
- package/dist/skills/ignore.js +138 -0
- package/dist/skills/ignore.js.map +1 -0
- package/dist/skills/lines.d.ts +53 -0
- package/dist/skills/lines.js +221 -0
- package/dist/skills/lines.js.map +1 -0
- package/dist/skills/map-command.d.ts +28 -0
- package/dist/skills/map-command.js +533 -0
- package/dist/skills/map-command.js.map +1 -0
- package/dist/skills/mermaid.d.ts +29 -0
- package/dist/skills/mermaid.js +261 -0
- package/dist/skills/mermaid.js.map +1 -0
- package/dist/skills/metro.d.ts +8 -0
- package/dist/skills/metro.js +93 -0
- package/dist/skills/metro.js.map +1 -0
- package/dist/skills/read.d.ts +17 -0
- package/dist/skills/read.js +54 -0
- package/dist/skills/read.js.map +1 -0
- package/dist/skills/rules.d.ts +28 -0
- package/dist/skills/rules.js +57 -0
- package/dist/skills/rules.js.map +1 -0
- package/dist/skills/source.d.ts +66 -0
- package/dist/skills/source.js +281 -0
- package/dist/skills/source.js.map +1 -0
- package/dist/skills/walk.d.ts +64 -0
- package/dist/skills/walk.js +281 -0
- package/dist/skills/walk.js.map +1 -0
- package/dist/source.d.ts +40 -0
- package/dist/source.js +199 -0
- package/dist/source.js.map +1 -0
- package/dist/stdout.d.ts +2 -0
- package/dist/stdout.js +24 -0
- package/dist/stdout.js.map +1 -0
- package/dist/validate.d.ts +45 -0
- package/dist/validate.js +321 -0
- package/dist/validate.js.map +1 -0
- package/dist/views.d.ts +25 -0
- package/dist/views.js +58 -0
- package/dist/views.js.map +1 -0
- package/examples/catalogue-repository/.github/workflows/stackledger.yml +122 -0
- package/examples/catalogue-repository/README.md +96 -0
- package/examples/catalogue-repository/catalog/catalog-info.yaml +12 -0
- package/examples/hosting/Caddyfile +69 -0
- package/examples/northwind/catalog-info.yaml +680 -0
- package/examples/northwind/stackledger.yaml +16 -0
- package/examples/northwind-machine/snapshot.json +309 -0
- package/examples/northwind-skills/agents/builder.md +10 -0
- package/examples/northwind-skills/agents/reviewer.md +10 -0
- package/examples/northwind-skills/designer/SKILL.md +8 -0
- package/examples/northwind-skills/editor/SKILL.md +8 -0
- package/examples/northwind-skills/engineering/SKILL.md +12 -0
- package/examples/northwind-skills/linter/SKILL.md +8 -0
- package/examples/northwind-skills/linter/rules.md +5 -0
- package/examples/northwind-skills/publishing/SKILL.md +12 -0
- package/examples/northwind-skills/publishing/rules.md +5 -0
- package/examples/northwind-skills/spec-writer/SKILL.md +8 -0
- package/examples/northwind-skills/stackledger-skills.yaml +51 -0
- package/examples/northwind-skills/tester/SKILL.md +10 -0
- package/examples/northwind-skills/writer/SKILL.md +8 -0
- package/examples/northwind-skills/writer/rules.md +6 -0
- package/npm-shrinkwrap.json +5016 -0
- package/package.json +52 -4
- package/site/LICENSE-astroplate +21 -0
- package/site/README.md +18 -0
- package/site/package.json +6 -0
- package/site/public/brand-mark-dark.svg +7 -0
- package/site/public/favicon.svg +6 -0
- package/site/public/home-banner.svg +93 -0
- package/site/public/link-icons/email-dark.svg +7 -0
- package/site/public/link-icons/email-light.svg +6 -0
- package/site/public/link-icons/github-dark.svg +8 -0
- package/site/public/link-icons/github-light.svg +7 -0
- package/site/public/link-icons/linkedin-dark.svg +8 -0
- package/site/public/link-icons/linkedin-light.svg +7 -0
- package/site/public/link-icons/website-dark.svg +8 -0
- package/site/public/link-icons/website-light.svg +7 -0
- package/site/src/components/Footer.astro +25 -0
- package/site/src/components/Header.astro +35 -0
- package/site/src/components/Impact.astro +55 -0
- package/site/src/components/LinkOrText.astro +12 -0
- package/site/src/components/SkillItem.astro +141 -0
- package/site/src/components/SubNav.astro +40 -0
- package/site/src/components/ThemeSwitch.astro +13 -0
- package/site/src/components/Themed.astro +15 -0
- package/site/src/layouts/Base.astro +52 -0
- package/site/src/lib/site.ts +25 -0
- package/site/src/pages/[reports].astro +222 -0
- package/site/src/pages/agents/[file].astro +14 -0
- package/site/src/pages/index.astro +72 -0
- package/site/src/pages/journeys/[name].astro +50 -0
- package/site/src/pages/journeys/index.astro +37 -0
- package/site/src/pages/licences/[name].astro +56 -0
- package/site/src/pages/map/index.astro +78 -0
- package/site/src/pages/playbooks/[file].astro +14 -0
- package/site/src/pages/rules/[...rules].astro +61 -0
- package/site/src/pages/skill-map/[...map].astro +101 -0
- package/site/src/pages/skills/[...list].astro +75 -0
- package/site/src/pages/skills/[file].astro +14 -0
- package/site/src/pages/software/[name].astro +155 -0
- package/site/src/pages/software/index.astro +71 -0
- package/site/src/scripts/diagram.ts +8 -0
- package/site/src/scripts/links.ts +31 -0
- package/site/src/scripts/map.ts +133 -0
- package/site/src/scripts/software.ts +32 -0
- package/site/src/scripts/theme.ts +52 -0
- package/site/src/styles/base.css +481 -0
- package/site/src/styles/fonts.css +60 -0
- package/site/src/styles/override.css +1 -0
- package/site/src/styles/pages.css +315 -0
- package/site/src/styles/tokens.css +87 -0
- package/skills/stackledger/SKILL.md +155 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Catalogue repository template
|
|
2
|
+
|
|
3
|
+
A starting point for a Git repository that holds your [stackledger](https://github.com/brunosouzas/stackledger) catalogue and publishes its sites with GitHub Actions to Cloudflare Pages, behind Cloudflare Access.
|
|
4
|
+
|
|
5
|
+
Copy everything in this folder, including `.github/` and `.gitignore`, to the root of a new **private** repository. Read access to the repository means reading the whole catalogue, costs included.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
.github/workflows/stackledger.yml the workflow
|
|
9
|
+
catalog/ the catalogue: every YAML file below it is read
|
|
10
|
+
README.md this file; replace it with your own
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The catalogue lives in `catalog/` so that stackledger never reads the workflow's own YAML (0.3.0 and earlier read hidden folders such as `.github/`; this template pins 0.5.0 (`@brunosouzas/stackledger`), which skips them, so the folder now only keeps the catalogue apart from the repository files). `catalog/catalog-info.yaml` holds one fictitious component, so the copy validates and builds as it is; replace it with yours ([catalogue format](https://github.com/brunosouzas/stackledger/blob/main/docs/catalogue-format.md)).
|
|
14
|
+
|
|
15
|
+
## Personal or corporate
|
|
16
|
+
|
|
17
|
+
Choose one before the first deploy.
|
|
18
|
+
|
|
19
|
+
- **Personal**: you are the only reader. stackledger builds one site, `full`, with everything in it, costs included. Add `catalog/stackledger.yaml`:
|
|
20
|
+
|
|
21
|
+
```yaml
|
|
22
|
+
apiVersion: stackledger/v1alpha1
|
|
23
|
+
kind: Settings
|
|
24
|
+
metadata:
|
|
25
|
+
name: settings
|
|
26
|
+
spec:
|
|
27
|
+
sites: [full]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
You need one Cloudflare Access application that lets in only you. The address `/` takes you to `/full/`.
|
|
31
|
+
- **Corporate** (the default, when `sites` is not set): a company where only some people may see costs. stackledger builds two sites: `full` for finance and `staff`, without costs and contract details, for everyone else. You need two Access applications: finance on `/full/*`, staff on the rest. The address `/` takes people to `/staff/`.
|
|
32
|
+
|
|
33
|
+
Both modes and the `_redirects` file need stackledger 0.1.0 or later, the version the workflow pins. You can switch later by changing `sites`; the next deploy publishes the new set of sites. Change Cloudflare Access first, so no site is ever open to the wrong people.
|
|
34
|
+
|
|
35
|
+
## What the workflow does
|
|
36
|
+
|
|
37
|
+
| When | `site` job | `deploy` job |
|
|
38
|
+
| --- | --- | --- |
|
|
39
|
+
| Pull request | scan, validate, build | does not run |
|
|
40
|
+
| Push to `main` | scan, validate, build | deploys |
|
|
41
|
+
| Every Monday, 06:00 UTC | scan, validate, build | deploys, so renewal windows move without a commit |
|
|
42
|
+
| Manual start (Run workflow) | scan, validate, build | deploys only when started on `main` |
|
|
43
|
+
|
|
44
|
+
The `site` job:
|
|
45
|
+
|
|
46
|
+
1. scans the repository and its whole history for secrets with [gitleaks](https://github.com/gitleaks/gitleaks), a pinned release checked against its SHA-256; a finding fails the job;
|
|
47
|
+
2. runs `stackledger validate catalog`: an error fails the job before the build, a warning does not;
|
|
48
|
+
3. builds the sites dated today in UTC, into a folder outside the repository;
|
|
49
|
+
4. hands on only `full/`, `staff/` (corporate mode only), `_headers`, `robots.txt` and `_redirects` (it sends `/` to the right site), with the build date.
|
|
50
|
+
|
|
51
|
+
The `deploy` job runs on a fresh runner without a checkout. It installs wrangler with `--ignore-scripts` before any secret is present, then runs it from a folder that holds only the site. Each deployment is labelled with the commit and the build date, for example `stackledger 2026-10-21 <commit>`.
|
|
52
|
+
|
|
53
|
+
A re-run on the same UTC day deploys the same files.
|
|
54
|
+
|
|
55
|
+
## Setup
|
|
56
|
+
|
|
57
|
+
Do these steps in this order, so the sites are never public.
|
|
58
|
+
|
|
59
|
+
1. **Protect the sites first.** Create the Cloudflare Pages project empty and set up Cloudflare Access for it, as [docs/hosting.md](https://github.com/brunosouzas/stackledger/blob/main/docs/hosting.md) describes for your mode, on every address of the project: one Access application for you (personal), or two, one for `/full/*` and one for the rest (corporate). Do this **before** the first deploy.
|
|
60
|
+
2. **API token.** In the Cloudflare dashboard, My Profile → API Tokens → Create Token → Custom token, with the single permission Account → Cloudflare Pages → Edit, for one account only ([Cloudflare docs](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/)).
|
|
61
|
+
3. **Repository secrets and variable.** In the repository settings, Secrets and variables → Actions:
|
|
62
|
+
- secret `CLOUDFLARE_API_TOKEN`: the token from step 2;
|
|
63
|
+
- secret `CLOUDFLARE_ACCOUNT_ID`: your Cloudflare account ID (on the account's overview page);
|
|
64
|
+
- variable `PAGES_PROJECT`: the name of the Pages project from step 1.
|
|
65
|
+
|
|
66
|
+
Only the deploy step reads them. Pull requests never deploy.
|
|
67
|
+
4. **Push to `main`.** The first run deploys. Then check the sites as `docs/hosting.md` says: anonymous requests must be sent to the sign-in page, and, in the corporate mode, a staff identity must be refused on `/full/`.
|
|
68
|
+
|
|
69
|
+
## Versions
|
|
70
|
+
|
|
71
|
+
The versions are set once, in `env` at the top of the workflow:
|
|
72
|
+
|
|
73
|
+
| Variable | What |
|
|
74
|
+
| --- | --- |
|
|
75
|
+
| `STACKLEDGER` | the stackledger release the job runs, with `npx --yes`; the job log names it |
|
|
76
|
+
| `WRANGLER` | the wrangler release used to deploy |
|
|
77
|
+
| `GITLEAKS_VERSION`, `GITLEAKS_SHA256` | the gitleaks release and the SHA-256 of its `linux_x64` archive, from the release's `checksums.txt` |
|
|
78
|
+
|
|
79
|
+
Actions are pinned by commit SHA. Change a version in a pull request, so the change is reviewed and its run checks it.
|
|
80
|
+
|
|
81
|
+
## Rolling back
|
|
82
|
+
|
|
83
|
+
Cloudflare Pages keeps every deployment. To go back to an earlier one: open the Pages project → Deployments → the previous production deployment (find it by commit and date) → Rollback to this deployment ([Cloudflare docs](https://developers.cloudflare.com/pages/configuration/rollbacks/)).
|
|
84
|
+
|
|
85
|
+
To fix forward, revert the bad commit on `main`; the push deploys the result. Starting the workflow by hand on an older branch or tag does not deploy: the deploy job runs only for `main`.
|
|
86
|
+
|
|
87
|
+
## Running the checks locally
|
|
88
|
+
|
|
89
|
+
With Node.js 22.12 or later:
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
npx --yes @brunosouzas/stackledger@0.5.0 validate catalog
|
|
93
|
+
npx --yes @brunosouzas/stackledger@0.5.0 build catalog --out ../catalogue-site --date "$(date -u +%F)"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Build outside the repository, so the build is never committed.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# One fictitious component, so a fresh copy of this template validates and builds as it is.
|
|
2
|
+
# Replace it with your own catalogue: the format is in docs/catalogue-format.md of stackledger.
|
|
3
|
+
apiVersion: backstage.io/v1alpha1
|
|
4
|
+
kind: Component
|
|
5
|
+
metadata:
|
|
6
|
+
name: northwind-wiki
|
|
7
|
+
title: Northwind Wiki
|
|
8
|
+
description: The team wiki of the fictitious Northwind company.
|
|
9
|
+
spec:
|
|
10
|
+
type: tool
|
|
11
|
+
lifecycle: active
|
|
12
|
+
owner: group:northwind
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# stackledger behind Caddy and oauth2-proxy: a fictitious example (Northwind, example.org).
|
|
2
|
+
# The recipe, with the oauth2-proxy flags, is in docs/hosting.md.
|
|
3
|
+
#
|
|
4
|
+
# Every request is authenticated first, by oauth2-proxy at 127.0.0.1:4180. Only the groups that
|
|
5
|
+
# oauth2-proxy returns in X-Auth-Request-Groups count:
|
|
6
|
+
# /full/* finance
|
|
7
|
+
# every other staff or finance
|
|
8
|
+
# anything else 403
|
|
9
|
+
# A request without a session is sent to the sign-in page. When oauth2-proxy cannot be reached,
|
|
10
|
+
# Caddy answers 502 and serves nothing (it fails closed).
|
|
11
|
+
#
|
|
12
|
+
# /srv/stackledger/publish holds only full/, staff/, _headers and robots.txt from stackledger build.
|
|
13
|
+
# Tested by test/integration/hosting-caddy.test.ts.
|
|
14
|
+
|
|
15
|
+
catalogue.example.org {
|
|
16
|
+
root * /srv/stackledger/publish
|
|
17
|
+
|
|
18
|
+
# oauth2-proxy's own pages: sign-in, callback, sign-out.
|
|
19
|
+
handle /oauth2/* {
|
|
20
|
+
reverse_proxy 127.0.0.1:4180 {
|
|
21
|
+
header_up X-Real-IP {remote_host}
|
|
22
|
+
header_up X-Forwarded-Uri {uri}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
handle {
|
|
27
|
+
# route keeps the order below as written.
|
|
28
|
+
route {
|
|
29
|
+
# Drop any groups header the client sent: only oauth2-proxy's answer counts.
|
|
30
|
+
request_header -X-Auth-Request-Groups
|
|
31
|
+
|
|
32
|
+
forward_auth 127.0.0.1:4180 {
|
|
33
|
+
uri /oauth2/auth
|
|
34
|
+
copy_headers X-Auth-Request-Groups X-Auth-Request-Email
|
|
35
|
+
|
|
36
|
+
@signed_out status 401
|
|
37
|
+
handle_response @signed_out {
|
|
38
|
+
redir * /oauth2/sign_in?rd={scheme}://{host}{uri} 302
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
# oauth2-proxy sends the groups as a comma-separated list.
|
|
43
|
+
@full_refused {
|
|
44
|
+
path /full /full/*
|
|
45
|
+
not header_regexp X-Auth-Request-Groups (^|,)\s*finance\s*(,|$)
|
|
46
|
+
}
|
|
47
|
+
respond @full_refused 403
|
|
48
|
+
|
|
49
|
+
@refused not header_regexp X-Auth-Request-Groups (^|,)\s*(staff|finance)\s*(,|$)
|
|
50
|
+
respond @refused 403
|
|
51
|
+
|
|
52
|
+
# The host has no page at /.
|
|
53
|
+
redir / /staff/ 302
|
|
54
|
+
|
|
55
|
+
# The same headers stackledger writes into _headers, which Caddy does not read.
|
|
56
|
+
header {
|
|
57
|
+
Content-Security-Policy "default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' data:; font-src 'self'; connect-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'"
|
|
58
|
+
X-Content-Type-Options nosniff
|
|
59
|
+
Referrer-Policy no-referrer
|
|
60
|
+
X-Robots-Tag "noindex, nofollow"
|
|
61
|
+
Permissions-Policy "camera=(), microphone=(), geolocation=()"
|
|
62
|
+
}
|
|
63
|
+
@calendar path *.ics
|
|
64
|
+
header @calendar Content-Type "text/calendar; charset=utf-8"
|
|
65
|
+
|
|
66
|
+
file_server
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|