+++ title = "Deploy edu mdbook to Cloudflare Pages at vibebooks.elijah.run" priority = 5 status = "todo" ticket_type = "project" dependencies = [] +++ ## Background From `edu/TODO.md`: - Host the mdbook on Cloudflare Pages - Host on vibebooks.elijah.run - Create an `infra/` directory containing opentofu configs for the above - Add a big disclaimer about the content being AI-generated ## Sub-tasks ### 1. Add AI-generated disclaimer Add a prominent disclaimer page or preface to the mdbook. The disclaimer should say (in the user's words): > these [chapters] are AI generated and not intended to be definitive, trustworthy, or even good, just an experiment in generating tailored educational content about topics I am interested in but not sure where to start, and with a practical focus on exercises with Rust since that is the language I use most often Placement options: - A dedicated `src/disclaimer.md` page added first in `src/SUMMARY.md` - Or a callout block at the top of every chapter (requires mdbook preprocessor) - Recommended: `src/disclaimer.md` as the first page, with a short note in each chapter's preamble ### 2. Create `edu/infra/` with OpenTofu configs Follow the pattern from `quotesdb/infra/` (Cloudflare provider, tofu modules). Minimal resources: - `cloudflare_pages_project` — create the Pages project named `vibedbooks` - `cloudflare_pages_domain` — bind `vibebooks.elijah.run` to the Pages project - `cloudflare_record` — CNAME DNS record pointing `vibebooks` at the Pages subdomain File layout: ``` edu/infra/ ├── main.tf # provider config, cloudflare_pages_project ├── dns.tf # cloudflare_record and cloudflare_pages_domain ├── variables.tf # cloudflare_account_id, cloudflare_zone_id, etc. ├── outputs.tf # pages subdomain URL └── .gitignore # *.tfstate, .terraform/ ``` All `resource` and `data` blocks must have a comment explaining their purpose (per CLAUDE.md conventions). ### 3. Configure mdbook build for CF Pages Cloudflare Pages can auto-build mdbook sites if given the right build command and output directory. Set in the Pages project config: - Build command: `mdbook build` - Build output directory: `book` - Root directory: `edu/` Alternatively, use a CI/CD pipeline (GitHub Actions / Gitea Actions) to build and push to the Pages project via `wrangler pages deploy`. ### 4. Add edu/justfile Add a `release` recipe to `edu/justfile` (see justfiles ticket) that triggers the Pages deployment once infra is configured. ## Relevant files - `edu/book.toml` — mdbook configuration - `edu/src/SUMMARY.md` — add disclaimer page - `edu/src/disclaimer.md` (new) - `edu/infra/` (new directory) - Cloudflare dashboard: Pages project, DNS zone `elijah.run` ## Validation - `tofu validate && tofu plan` from `edu/infra/` - `mdbook build` from `edu/` — builds without errors - After deploy: `curl -I https://vibebooks.elijah.run` returns 200