Infrastructure & CI/CD
Terraform (tf/)
Single consolidated module:
| File | Purpose |
|---|---|
tf/main.tf |
Lambda, API Gateway (REST, EDGE), S3, IAM, CloudWatch, optional API logging |
tf/variables.tf |
Environment, runtime (nodejs22.x), secrets, toggles |
tf/envs/*.tfvars |
Per-environment names, memory, timeouts, buckets |
tf/envs/*.backend.hcl |
Remote state (S3 + DynamoDB lock) |
Typical resources: Lambda (VPC), API Gateway {proxy+} → Lambda proxy integration, S3 static bucket with CORS, IAM for Lambda + deploy, CloudWatch logs.
Local deploy (maintainers):
./deploy.sh dev
./deploy.sh stage
./deploy.sh prod
CI normally runs deploy.sh after a tsup (esbuild) Lambda build on the default branch (see that branch’s package.json and workflows for exact job names).
Moxie documentation (GitHub Pages)
The public Moxie docs at moxiedocs.foxnews.com are not part of the Lambda deploy. They are built and published from the pages branch:
| Workflow | github-pages.yaml |
| Build | bash build.sh (Astro docs/dist + Inspector in docs/dist/inspector/) |
| Host | GitHub Actions + actions/deploy-pages (artifact upload). Custom domain: docs/public/CNAME. The repo’s Settings → Pages should use the GitHub Actions source (not a legacy Deploy from branch to gh-pages — the separate “pages build and deployment” job for that branch is not used for the current flow). |
| Redundancy | Optional Surge deploy in the same job (subdomain in repo secrets) |
GitHub Actions (summary)
These workflows live on the default (Lambda) branch — the pages docs-only tree may not include all of them.
| Workflow | Trigger | Action |
|---|---|---|
develop.yaml |
Push to develop (src/ changes) |
tsup dev build → Terraform → dev Lambda |
develop-static.yaml |
Push to develop (static/) |
Sync static to dev S3 |
staging.yaml |
Push to release-v* (src/) |
Stage build → stage Lambda |
staging-static.yaml |
Push to release-v* (static/) |
Sync to stage S3 |
production.yaml |
GitHub Release | Prod build → prod Lambda + static sync |
Lambda workflows clone foxnews/fn-digital-terraform-modules for shared Terraform modules.
Environment resources (illustrative)
| Dev | Stage | Prod | |
|---|---|---|---|
| Static S3 | dev-fnd-moxie-static |
stage-fnd-moxie-api-static |
prod-fnd-moxie-api-static |
| Lambda timeout | 30s | 60s | 60s |
| Lambda memory | 256 MB | 1024 MB | 1024 MB |
| API Gateway execution logs | On | Off | Off |
Exact values belong in tf/envs/*.tfvars — treat the table as a mental model.
Caching (application layer)
Policies under src/settings/caching/ (e.g. standard, mobile, liveblog, disabled) drive CDN/browser headers such as max-age, stale-while-revalidate, and stale-if-error.
Related
- Architecture — request path through Lambda.