Skip to content

Fresh-account deploy fixes: TF cycle, CI, SPIP public URL, cron, docs - #2

Merged
psantus merged 7 commits into
mainfrom
fix/deploy-validated
Sep 8, 2026
Merged

Fresh-account deploy fixes: TF cycle, CI, SPIP public URL, cron, docs#2
psantus merged 7 commits into
mainfrom
fix/deploy-validated

Conversation

@psantus

@psantus psantus commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Everything found and fixed by dogfooding the repo on a clean AWS account (eu-west-3), verified live.

  • TF cycle broken (CloudFront↔Lambda) — stage name is a constant local.
  • CI (ci.yml): fmt/validate + php -l + bash -n + no-push docker build; deploy.yml skips until an env is configured.
  • SpipCles overlay dropped (broke SPIP core secret_des_actions()).
  • CloudFront default behavior → AllViewerExceptHostHeader (was 403).
  • Option A: SPIP_PUBLIC_URL pinned into HTTP_HOST (prepend.php) + adresse_site meta at bootstrap → SPIP absolute links correct behind CloudFront (login works).
  • EventBridge cron re-added (rate 5min → /spip.php?action=cron) — was missing so the SPIP queue never ran. Applied + verified on test.
  • Docs: bilingual README (FR primary + EN), repo-vs-online model, plugins/ vs plugins-dist/, custom-domain propagation, prerequisites, state-bucket step.

Verified end-to-end on eu-west-3: install/schema/admin, login+admin, S3 upload, CloudWatch logs, X-Ray (63 traces), EventBridge cron rule ENABLED.

Paul Santus added 7 commits September 8, 2026 12:14
…t-3)

Found by cloning the repo into a new folder and running the docs step by step
against a clean AWS account:

- Dockerfile: DROP the SpipCles overlay COPY (+ delete the dead overlay file). It
  overrode SPIP core's complete class with a partial one missing secret_des_actions(),
  which fatals during plugin/queue init. Keys already come from SPIP_CLES via
  prepend.php each boot, so the SSM write-back overlay was both redundant and harmful.
- cloudfront.tf: default behavior must use Managed-AllViewerExceptHostHeader (not
  AllViewer) — forwarding the viewer Host to the execute-api origin makes API Gateway
  return 403. Fixes CloudFront -> 403 with no custom domain.
- bootstrap-db.php: include_spip('inc/texte'/'inc/filtres') before plugin_installes_meta
  so typo()/propre() are defined in the CLI context (else Fatal: undefined typo()).
- docs/db-bootstrap.md: fix the container command (was 'php -d ...' after --entrypoint
  php => ran 'php php'); now '-d ...'.
- README: expand Prerequisites (Docker running, Terraform >=1.14 not 1.5, AWS CLI v2
  active session) and add the 'create the Terraform state bucket' first step.

Verified: static + build + push + assets + app + bootstrap + CloudFront all green;
public site and /spip.php?page=login return 200 through CloudFront.
…tion A)

Without a custom domain, CloudFront strips the viewer Host (AllViewerExceptHostHeader,
required so API Gateway accepts the request), so SPIP saw the execute-api host and
built absolute URLs (login 'converser', redirects, canonical, emails) on the wrong
host/without the stage — the login POST 403'd.

- prepend.php: pin $_SERVER HTTP_HOST/SERVER_NAME/HTTPS from SPIP_PUBLIC_URL before
  SPIP boots, so url_de_base() emits the real public host.
- app/locals.tf: SPIP_PUBLIC_URL env = https://<custom domain | cloudfront domain>.
- bootstrap-db.php: set the adresse_site meta from SPIP_PUBLIC_URL (CLI install can't
  infer it; was 'http://' → 'http:///' in logo/canonical/email links).
- db-bootstrap.md: pass -e SPIP_PUBLIC_URL in the bootstrap run.

Verified on the eu-west-3 test stack: no execute-api URLs emitted, adresse_site =
the CloudFront URL, http:/// gone.
prepend.php disables the queue on web requests (_DEBUG_BLOCK_QUEUE) and expects an
external trigger, but cron.tf had been dropped when building the bare repo — so SPIP's
scheduled jobs never ran. Re-add the generic rule: EventBridge -> synthetic
/spip.php?action=cron event -> Lambda, which is the one path that runs the queue.

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR successfully addresses critical deployment issues discovered during fresh-account testing. The infrastructure fixes resolve the Terraform cycle, correct CloudFront request forwarding, and ensure SPIP generates proper absolute URLs behind the CDN. The EventBridge cron restoration ensures scheduled jobs run reliably.

Key fixes verified:

  • Terraform cycle resolved by making stage_name a constant local
  • CloudFront origin policy correctly set to AllViewerExceptHostHeader
  • SPIP_PUBLIC_URL properly injected into HTTP_HOST to fix login/redirects
  • EventBridge cron rule re-added with correct Lambda invocation
  • Bootstrap script sets adresse_site meta and includes missing dependencies

All changes appear correctly implemented for production deployment.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@psantus
psantus merged commit 318bde1 into main Sep 8, 2026
5 checks passed
@psantus
psantus deleted the fix/deploy-validated branch September 8, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant