Skip to content

Consolidate leaderboard and overlays into single CloudFront distribution (PR 4 of 4)#168

Open
davidfsmith wants to merge 18 commits intoaws-solutions-library-samples:mainfrom
davidfsmith:feat/consolidate-websites
Open

Consolidate leaderboard and overlays into single CloudFront distribution (PR 4 of 4)#168
davidfsmith wants to merge 18 commits intoaws-solutions-library-samples:mainfrom
davidfsmith:feat/consolidate-websites

Conversation

@davidfsmith
Copy link
Contributor

Summary

Depends on PRs #164, #165, #166 being merged first.

  • Moves website-leaderboard/website/leaderboard/ and website-stream-overlays/website/overlays/, serving all three apps from the existing BaseStack S3 bucket and CloudFront distribution
  • Removes the separate leaderboard and overlay S3 buckets, CloudFront distributions, and Dockerfiles
  • Adds a CloudFront Function on the main distribution to rewrite sub-app deep links to their index.html for SPA routing (/leaderboard/* and /overlays/*)
  • Simplifies the CodePipeline deploy from three separate S3 sync steps to one WebsiteDeployToS3 step
  • Fixes in-race overlay (RaceInfoFooter) not showing on the combined leaderboard view (subscription trackId filter mismatch)
  • Fixes events admin page links pointing to hardcoded CloudFront URLs instead of current origin
  • Fixes landing page URLs to include /leaderboard/ prefix post-consolidation
  • Removes local.docker.config Makefile target (now identical to local.config)
  • Adds drem.install and drem.bootstrap aliases for consistent drem.* naming
  • Updates README for single-container Docker setup and unified local dev workflow

Test plan

  • Full regression: clean deploy from scratch → release/stable → PR1 → PR2 → PR3 → this branch, all deployed cleanly with no DELETE_FAILED resources
  • make local.config — all three Amplify configs generated successfully
  • make local.build — leaderboard and overlays build cleanly
  • make local.run — all three apps accessible at localhost:3000/, /leaderboard/, /overlays/
  • make local.docker.build + docker compose up — single container serves all three apps
  • make drem.clean — both stacks deleted cleanly
  • SSM parameters verified present (19 parameters under /drem-backend-main-base/)

🤖 Generated with Claude Code

davidfsmith and others added 18 commits March 20, 2026 19:07
Writes 14 resource identifiers to SSM Parameter Store under
/${stackName}/<key> at the end of the BaseStack constructor.

This is an additive-only change — no existing CloudFormation exports or
cross-stack references are modified. The SSM parameters are available for
a follow-up PR that migrates DeepracerEventManagerStack to read from SSM
instead of Fn::ImportValue, eliminating the hard CloudFormation dependency
between the two stacks.

Also adds a `comment` description prop to CloudFront distributions in the
Cdn, Leaderboard, and StreamingOverlay constructs for easier identification
in the AWS console.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove T&C checkbox and footer link from Amplify Authenticator sign-up (App.tsx)
- Remove T&C checkbox from admin Create User form (createUser.tsx)
- Remove termsAndConditionsUrl from config generation script
- Remove T&C translation strings from en/translation.json
- Exclude website subdirs from root tsconfig.json to prevent CDK tsc
  from compiling Vite config and React source files in-place

CDK infrastructure (T&C S3 bucket and CloudFront distributions) is
retained and will be removed in a follow-up PR.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace jest.config.js with jest.config.ts for consistency with the
  TypeScript-first codebase
- Fix local.config.python: source .venv/bin/activate has no effect in
  Make (each line runs in its own shell), so pip was installing to the
  host Python. Now uses .venv/bin/pip directly.
- Add $(VENV_PYTHON) file target that creates the venv on demand; make
  local.config and local.config.docker depend on it (order-only) so the
  venv is created automatically before any Python scripts run
- Expand test target to run CDK tests (test.cdk) as well as website tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
drem.clean: destroys pipeline then deletes infra and base stacks in
order, waiting for each deletion to complete before proceeding. This
gives a clean, predictable teardown for testing and re-deployment.
clean now delegates to drem.clean (removes reference to undefined
s3.clean which would have caused make clean to always fail).

pipeline.clean: add --force to skip interactive confirmation prompt.

Venv target: replace file-path-as-target pattern ($(VENV_PYTHON):)
with a sentinel file (.venv/.installed) and a named PHONY alias (venv).
The sentinel depends on pyproject.toml so the venv is rebuilt if
dependencies change. local.config and local.config.docker use
| .venv/.installed as an order-only prerequisite.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Prevents cdk deploy from hanging waiting for interactive IAM approval
when run non-interactively (e.g. from a script or fresh terminal).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Verifies all required SSM parameters are present in the BaseStack
template without Docker or a live AWS account.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Documents:
- What PR 1 does (additive only, safe upgrade)
- SSM Parameter Store console verification (14 params)
- Why PR 2 requires two pipeline runs to remove Fn::ImportValue
- Step-by-step PR 2 migration sequence

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…add PR2/PR3 guides

- Fix SSM parameter count from 14 to 19 (lambda layers and WAF ACL added)
- Add prominent BREAKING CHANGE notice: sequential upgrade required for
  existing deployments — cannot skip directly to latest release
- Add full PR 2 and PR 3 testing guide (testing-ssm-cross-stack-migration-pr2.md)
- Reference PR 3 (restore base-first ordering) in the migration overview

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Requires PR 1 (feat/ssm-cross-stack-sharing) to be deployed first so
the 14 SSM parameters exist when CloudFormation validates infra's
changeset.

Infrastructure stack:
- Reads all 14 shared values from SSM via valueForStringParameter()
- No longer accepts direct cross-stack props beyond baseStackName
- Eliminates all Fn::ImportValue dependencies on BaseStack
- IEventBus type used across all 11 domain constructs (compatible with
  EventBus.fromEventBusArn() which returns IEventBus)

BaseStack:
- Removes T&C CloudFront distribution and S3 bucket (tacCdn)
- Retains all 14 SSM parameters from PR 1

Pipeline stage:
- Passes only baseStackName to DeepracerEventManagerStack
- MIGRATION ordering: baseStack.addDependency(stack) (infra first) so
  infra drops Fn::ImportValue before base removes CfnOutput exports.
  SSM params already exist from PR 1 so infra can resolve them.
  Revert to stack.addDependency(baseStack) after this PR is deployed.
- Removes TermsAndConditionsDeployToS3 pipeline step

Also removes website-terms-and-conditions/ directory and all remaining
T&C CDK references from bin/drem.ts.

CDK tests: all 4 pass (SSM params in base, no Fn::ImportValue in infra,
SSM parameter types used in infra template).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Now that infra reads from SSM (not Fn::ImportValue), base can safely
deploy before infrastructure. This ensures new SSM parameters created
in BaseStack are available when CloudFormation resolves them for
DeepracerEventManagerStack at changeset creation time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
T&C CDK infrastructure was removed in the SSM migration (PR2).
The static website directory was overlooked at the time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move website-leaderboard/ → website/leaderboard/ and
website-stream-overlays/ → website/overlays/ so all three
frontend apps live under a single top-level website/ directory.

Infrastructure changes:
- Remove separate S3 bucket + CloudFront distribution from Leaderboard
  and StreamingOverlay CDK constructs (streaming-overlay.ts deleted)
- Add CloudFront Function to main CDN for sub-app SPA routing:
  /leaderboard/<path> → /leaderboard/index.html
  /overlays/<path>    → /overlays/index.html
- Pipeline LeaderboardDeployToS3 and StreamingOverlayDeployToS3 steps
  now sync to s3://$sourceBucketName/leaderboard/ and .../overlays/
  using the single main distribution for invalidations

Frontend fixes:
- Fix leaderboard event links in trackTable.tsx to use
  window.location.origin instead of hardcoded CloudFront URLs
- Fix RaceInfoFooter subscription to pass undefined instead of
  'combined' as trackId so AppSync filter matches real track UUIDs

Docker: remove separate leaderboard/overlay Dockerfiles and simplify
local.docker.build to depend on local.build (single website service)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
LeaderboardWebsite and streamingOverlayWebsite CloudFormation outputs
were removed when the separate CDN constructs were deleted. The main
website now derives these URLs from window.location.origin at runtime.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace MainSiteDeployToS3, LeaderboardDeployToS3, and
StreamingOverlayDeployToS3 with a single WebsiteDeployToS3 step that:
- Generates all three Amplify configs in one pass
- Runs codegen for all three GraphQL schemas
- Builds leaderboard + overlays into website/public/ before main build
- Syncs once to S3 and does a single /* CloudFront invalidation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix landing page URLs to include /leaderboard/ prefix (qrCode, eventsTableConfig, eventDetailsPanelContent)
- Fix landing page 'Upload your own model' link to use window.location.origin
- Remove unused awsconfig import from landingPage.tsx
- Remove DremWebsite/Urls from leaderboard config script (no longer needed)
- Consolidate compose.yaml to single website container
- Remove local.docker.config target (identical to local.config after Urls removal)
- Remove --docker flag from generate_amplify_config_cfn.py (was unused)
- Fix manual.deploy.website to depend on local.build for sub-apps
- Add drem.install and drem.bootstrap aliases for consistent drem.* naming
- Fix duplicate manual.deploy.website Makefile target
- Add npm install to local.build.leaderboard and local.build.overlays
- Add missing ## doc comments to new Makefile targets
- Update README: Docker setup, local dev URLs, locale paths, remove separate run commands

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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