docs: trim CLAUDE.md files to what the code doesn't show
Following the Claude Code memory docs: drop architecture lists, generic commands and CI details Claude can read from the code, keep the reasons behind decisions, and fix the outdated provider and pfSense SDK statements.
This commit is contained in:
1 parent
5cd50c31ff
commit
897813a916
6 files changed
+26
-208
No files matched your search
@@ -1,20 +1,12 @@
|
||||
# CLAUDE.md
|
||||
|
||||
Repository-wide instructions. Each stack directory has its own `CLAUDE.md` with stack-specific commands and architecture.
|
||||
<!-- Notes for the human, stripped before this file reaches Claude:
|
||||
- Start Claude Code sessions from the repository root: the permission rules and
|
||||
hooks in .claude/settings.json only load from there.
|
||||
- Keep this file to what Claude can't work out from the code. Stack-specific notes
|
||||
go in the stack's own CLAUDE.md, which loads when Claude touches that stack. -->
|
||||
|
||||
## Project overview
|
||||
|
||||
Pulumi (TypeScript) IaC for a Proxmox-based k3s homelab. Independent Pulumi projects ("stacks"), each with its own `Pulumi.yaml`/`package.json`, deployed in order and linked via `pulumi.StackReference`:
|
||||
|
||||
| # | Directory | Pulumi stack | Purpose |
|
||||
| --- | --- | --- | --- |
|
||||
| 1 | `01-proxmox-infra` | `proxmox-infra` | Provisions k3s VMs + DHCP on Proxmox/pfSense |
|
||||
| 2 | `02-k8s-bootstrap` | `k8s-bootstrap` | Installs k3s on the VMs over SSH |
|
||||
| 3 | `03-k8s-infra` | `k8s-infra` | Cluster infra: storage, cert-manager, kube-vip |
|
||||
| 4 | `04-k8s-apps` | `k8s-apps` | Application workloads (e.g. heimdall) |
|
||||
| 5 | `05-monitoring` | `monitoring` | kube-prometheus-stack (Prometheus + Grafana) |
|
||||
|
||||
All stacks use the Pulumi stack name `dev`.
|
||||
Pulumi (TypeScript) IaC for a Proxmox-based k3s homelab. Each `0N-*` directory is an independent Pulumi project ("stack"), all using the Pulumi stack name `dev`.
|
||||
|
||||
## Deployment order & StackReferences
|
||||
|
||||
@@ -23,23 +15,22 @@ proxmox-infra → k8s-bootstrap → k8s-infra
|
||||
↘ k8s-apps → monitoring
|
||||
```
|
||||
|
||||
- `k8s-bootstrap` reads VM IDs, Proxmox credentials, and the SSH private key from `proxmox-infra` via StackReference.
|
||||
- `k8s-infra`, `k8s-apps`, and `monitoring` all read `kubeconfig` from `k8s-bootstrap` via StackReference (`requireOutput("kubeconfig")`) — never set `kubeconfig` as Pulumi config in these stacks.
|
||||
- `monitoring` additionally reads `domain` from `k8s-apps` via StackReference.
|
||||
- `k8s-bootstrap` reads VM IDs, node IPs, Proxmox credentials, and the SSH private key from `proxmox-infra`.
|
||||
- `k8s-infra`, `k8s-apps`, and `monitoring` read `kubeconfig` from `k8s-bootstrap` (`requireOutput("kubeconfig")`). Never set `kubeconfig` as Pulumi config in these stacks.
|
||||
- `monitoring` additionally reads `domain` from `k8s-apps`.
|
||||
- StackReference format: `${pulumi.getOrganization()}/<stack-name>/dev`.
|
||||
|
||||
A stack's outputs must exist (i.e. it must have been deployed) before any downstream stack referencing it will succeed.
|
||||
- A stack's outputs must exist (it must have been deployed) before a downstream stack referencing it will succeed.
|
||||
|
||||
## Shared conventions
|
||||
|
||||
- **TypeScript**: `strict: true`, `target: es2024`, `module`/`moduleResolution: nodenext`, `noImplicitReturns`, `noFallthroughCasesInSwitch` — functions need explicit return types where TS can't infer them.
|
||||
- **Secrets**: read via `config.requireSecret()`, never via environment variables or hardcoded values.
|
||||
- **`Pulumi.dev.yaml`**: gitignored (contains the encryption salt) — never delete it or secrets become unrecoverable. Encrypted with `PULUMI_CONFIG_PASSPHRASE`.
|
||||
- **Backend**: self-hosted Postgres state backend, set via `PULUMI_BACKEND_URL`.
|
||||
- **`Pulumi.dev.yaml`**: gitignored (contains the encryption salt). Never delete it or secrets become unrecoverable. CI restores it from a base64 Gitea secret `<STACK>_PULUMI_DEV_YAML`; after changing local config, remind me to update that secret.
|
||||
- **Environment**: `PULUMI_BACKEND_URL` (self-hosted Postgres backend) and `PULUMI_CONFIG_PASSPHRASE` must be set.
|
||||
- **CI**: PRs run `pulumi preview`. `03`–`05` deploy on push to `main`; `01`/`02` deploy only via manual dispatch.
|
||||
|
||||
## Git conventions
|
||||
|
||||
Branch names, commit messages and PR titles follow @CONVENTIONS.md. Don't add a co-author when committing to git.
|
||||
Branch names, commit messages and PR titles follow @CONVENTIONS.md. The commit-msg hook needs `git config core.hooksPath .githooks` once per clone.
|
||||
|
||||
Only commit when I explicitly say "commit" for that change. A yes to a question that also mentioned committing is not enough; when unsure, ask.
|
||||
|
||||
@@ -62,32 +53,3 @@ The remote is a self-hosted Gitea, so `gh` doesn't work. For PRs and their CI st
|
||||
After editing a stack, run `npm run typecheck` in that stack's directory, then `pulumi preview`, and show the output of both. A passing typecheck only proves the code compiles; the preview is what shows which resources would be created, updated or replaced.
|
||||
|
||||
Don't silence a check to make it pass (`@ts-ignore`, `as any`, `git commit --no-verify`) without a stated reason and my OK.
|
||||
|
||||
## Common commands (run from a stack directory)
|
||||
|
||||
```bash
|
||||
git config core.hooksPath .githooks # once per clone, from the repo root: enforces CONVENTIONS.md
|
||||
npm install
|
||||
npm run typecheck
|
||||
pulumi preview
|
||||
pulumi up --yes # run by the user or CI
|
||||
pulumi destroy # run by the user
|
||||
pulumi stack output
|
||||
pulumi config
|
||||
```
|
||||
|
||||
Requires `PULUMI_BACKEND_URL` and `PULUMI_CONFIG_PASSPHRASE` in the environment (or `pulumi login`).
|
||||
|
||||
Start Claude Code sessions from the repository root: the permission rules and the live-infra hook in `.claude/settings.json` only load from there.
|
||||
|
||||
## CI/CD (Gitea Actions)
|
||||
|
||||
One workflow per stack: `.gitea/workflows/0N-deploy-<stack>.yaml`, scoped to changes under that stack's directory.
|
||||
|
||||
- **Pull request → `main`**: `pulumi preview` only.
|
||||
- `01`/`02` (VM provisioning / cluster bootstrap — riskier to automate): deploy only via manual `workflow_dispatch`.
|
||||
- `03`–`05`: deploy on push to `main` *or* `workflow_dispatch` — `pulumi refresh` then `pulumi up`.
|
||||
- Each workflow restores `Pulumi.dev.yaml` from a base64-encoded Gitea secret (`<STACK>_PULUMI_DEV_YAML`). After changing local config, re-encode and update the secret:
|
||||
```bash
|
||||
base64 -w 0 0N-<stack>/Pulumi.dev.yaml
|
||||
```
|
||||
Reference in new issue
Block a user