Self-hosted fitness tracker. Log workouts, track nutrition, and monitor progress. Docker deployment, mobile-friendly.
Cloudflare infra (Terraform)
Manages the Cloudflare Pages project (and, later, the lyftr.dev custom domain + DNS).
State lives in Cloudflare R2 (free tier). Run by .github/workflows/infra.yml:
terraform plan on PRs, terraform apply on main and on-demand (workflow_dispatch).
Content is deployed separately — site.yml runs wrangler pages deploy against this project.
One-time bootstrap
Do these once (the workflow steps skip until the secrets exist):
- R2 bucket for state —
wrangler r2 bucket create lyftr-tfstate(or dashboard → R2 → Create bucket). Enabling R2 is free; Cloudflare may ask for a card on file. - R2 API token — R2 → Manage R2 API Tokens → create an Object Read & Write token → copy the Access Key ID + Secret Access Key.
- Cloudflare API token — My Profile → API Tokens → Edit Cloudflare Pages template. Note the Account ID (Workers & Pages sidebar).
- GitHub repo secrets (UI or
gh secret setin a real terminal — never paste into a chat/PR):Secret Value CLOUDFLARE_API_TOKENthe Pages-edit token CLOUDFLARE_ACCOUNT_IDaccount ID R2_ACCESS_KEY_IDR2 token access key R2_SECRET_ACCESS_KEYR2 token secret - Create the project — Actions → Infra (Cloudflare) → Run workflow (on
main). Thisapplycreates thelyftrPages project. After that,site.ymldeploys work (prod + previews).
Notes
- The R2 endpoint (which contains the account ID) is written to
backend.hclat CI time from the account-ID secret, so it never lives in source.backend.hcl, state, and*.tfvarsare gitignored. - Locking uses the S3 backend's native
use_lockfile(Terraform ≥ 1.10) — no DynamoDB. - If a
lyftrproject already exists (e.g. created manually), import it before the first apply:terraform import cloudflare_pages_project.lyftr <account_id>/lyftr. - Next: add
cloudflare_pages_domain+cloudflare_recordforlyftr.dev, and setSITE_URL=https://lyftr.devinsite.yml.