Skip to content

[TRAIN-3456] Add healthchecks. Add functionality to Makefile. Refactor Puppeteer.#122

Draft
briannadelvalle-datadog wants to merge 49 commits into
mainfrom
TRAIN-3546-Update-Storedog
Draft

[TRAIN-3456] Add healthchecks. Add functionality to Makefile. Refactor Puppeteer.#122
briannadelvalle-datadog wants to merge 49 commits into
mainfrom
TRAIN-3546-Update-Storedog

Conversation

@briannadelvalle-datadog

@briannadelvalle-datadog briannadelvalle-datadog commented Oct 15, 2025

Copy link
Copy Markdown

Description

  1. Use healthchecks instead of wait-for-it -- reduces chance of bad race conditions breaking storedog in labs
  2. Add Makefile functionality
  3. Add scripts to generate docker-compose.yml files from docker-compose.dev.yaml. (One is intended for pre-release, another is for testing the frontend prod build target while using the dev docker compose file.)
  4. Update readme and add service-level readmes (and a FEATURES.md file)
  5. Improve frontend service image: multilayer builds, use build targets
  6. Add a simple env.development.template for TCD use.
  7. Migrate puppeteer service from rum-retention-filters branch — replaces the monolithic puppeteer.js (841-line single script + shell wrapper) with a modular traffic generator architecture. Key changes:
    • Upgrade Puppeteer base image from v20 to v24
    • Add package.json with proper npm dependency management
    • Modular session system: SessionManager, BrowserPool, BaseSession class, and 10 individual session types (browsing, taxonomy, frustration, homePage, short, vip, bot, cartAbandonment, earlyError, lateError)
    • Memory-aware concurrency profiles (8GB/16GB/32GB) with configurable ramp-up
    • New environment variables for session control, debugging, and concurrency tuning (see services/puppeteer/README.md)
    • Updated docker-compose service definitions (both dev and prod) with all new env vars
    • RUM credentials (RUM_APP_ID/RUM_CLIENT_TOKEN) mapped from existing NEXT_PUBLIC_DD_APPLICATION_ID/NEXT_PUBLIC_DD_CLIENT_TOKEN

Frontend build times

Tested with the help of Cursor/Claude.

Dockerfile Clean build Build env vars change (second build) Source code change (third build)
Production build target 39.35s 8.01s 9.67s
Old Dockerfile 47.43s 27.48s 18.90s

Image Sizes

Tested with the help of Cursor/Claude.

Dockerfile Size
Production (Multi-stage) 301.4 MB
Old Dockerfile (Single-stage) 812.8 MB

How to test

Test the healthchecks

  1. Run make up to build the dev containers.

Test the frontend prod build target

  1. In the Makefile, set ENV=dev-frontend-prod.
  2. Run make up clean.

Test the dockerfile generation script

  1. Run make prepare-release.
  2. Check the docker-compose.generated.yml file and answer Y/N in the terminal.

Test the Makefile updates

  1. Run make help to see the commands.

Test the puppeteer migration

  1. Run make up (or docker compose -f docker-compose.dev.yml up --build puppeteer)
  2. Set PUPPETEER_LOOP=single and PUPPETEER_DEBUG=true in .env for a quick smoke test
  3. Check logs for the session manager startup table and session execution

console.error(e)
setLoading(false)
}
}, [adsPath, getRandomArbitrary, setData, setLoading])

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

React said that this wasn't needed here.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Makes sense, it's not a dependency

@@ -1,29 +1,134 @@
FROM node:20 AS builder
FROM node:lts-alpine AS base

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

To mitigate a security vulnerability in other image

@briannadelvalle-datadog briannadelvalle-datadog marked this pull request as ready for review October 21, 2025 19:25
@@ -1,4 +1,5 @@
module.exports = {
output: 'standalone',

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is for the optimized production builds (production build target)

@briannadelvalle-datadog briannadelvalle-datadog marked this pull request as draft October 21, 2025 19:52
Comment thread .gitignore Outdated

settings.json

docker-compose.dev.frontend-prod.yml No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Was this last one left here on purpose?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yeah, this is only for testing the frontend prod build target.
Can't test it with the regular docker-compose.yml because it's not in the storedog image.
Can't test it with the docker-compose.dev.yml because of the volume mounts.
I'm adding a script and a make command to generate this file, but there's no reason to add it to source control.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

For more context, the prod build creates a server.js file and the command is node server.js. If we're mounting the entire service directory, we end up losing that file.

Comment thread docker-compose.dev.yml Outdated
Comment thread .gitignore Outdated
@briannadelvalle-datadog briannadelvalle-datadog changed the title [TRAIN-3456] Add healthchecks. Add functionality to Makefile. [TRAIN-3456] Add healthchecks. Add functionality to Makefile. Refactor Puppeteer. Apr 7, 2026
…tation; add transform_compose.py script and unit tests for compose transformations.
…nction for generated files in transform_compose.py
…rget, and build args in docker-compose template; refine regex pattern for build section replacement in transformation logic.
…opment and production environments, including environment variable configurations and dependency installations.
… function for selecting the appropriate Docker Compose file based on the ENV variable. Simplify commands for starting, stopping, and managing containers in both development and production environments.
…ariables for frontend service; add port mapping for local development.
briannadelvalle-datadog and others added 25 commits April 7, 2026 14:38
…th NEXT_PUBLIC_DD variables for frontend service configuration.
…nv var stuff to env templates, move feature stuff to feature.md
…BLIC_DD variables for consistency in frontend service configuration.
… with NEXT_PUBLIC_DD variables for consistency in frontend service configuration.
… NEXT_PUBLIC prefix and enhance transformation logic for development to production changes.
…g, and improve documentation for better usability.
…og configurations for cleaner logging setup.
…, simplifying the setup for Datadog logging.
…filters branch

Replaces the monolithic puppeteer.js script with a modular traffic generator
featuring a SessionManager, BrowserPool, and 10 configurable session types.
Upgrades Puppeteer from v20 to v24 and adds memory-aware concurrency profiles.
Updates docker-compose service definitions with new environment variables.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
briannadelvalle-datadog and others added 4 commits April 7, 2026 14:50
…vices

These tags are unnecessary since DD_SERVICE, DD_VERSION, and DD_ENV are
already set as environment variables on these containers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix NEXT_PUBLIC_CLIENT_TOKEN -> NEXT_PUBLIC_DD_CLIENT_TOKEN in .env.development.template
- Remove unused getRandomArbitrary function and leftover console.logs in Ad.tsx
- Fix .PHONY to match actual Makefile targets (remove dd-dev, dd-prod, prepare-frontend-prod; add frontend-prod)
- Deduplicate node_modules and .env entries in .gitignore, add trailing newline
- Fix copy-paste error in discounts README (ads.py -> discounts.py)

Co-Authored-By: Claude Opus 4.6 (1M context) <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.

2 participants