Skip to content

Added stripe to yarn dev:forward#25661

Merged
cmraible merged 7 commits intomainfrom
add-stripe-yarn-dev-forward
Jan 14, 2026
Merged

Added stripe to yarn dev:forward#25661
cmraible merged 7 commits intomainfrom
add-stripe-yarn-dev-forward

Conversation

@cmraible
Copy link
Collaborator

@cmraible cmraible commented Dec 8, 2025

no issue

Currently to run Ghost locally with Stripe with the new yarn dev:forward setup, you need to install and run the Stripe CLI locally, and pass the webhook secret to Ghost via environment variable. This change makes it easier to run Ghost with Stripe with the yarn dev:forward command.


To use:

  • Add COMPOSE_PROFILES=stripe to .env file at root of repo
  • Add STRIPE_SECRET_KEY to .env file at root of repo (or export it in your shell)
  • Run yarn dev:forward

How it works

  • The stripe CLI runs in docker. The entrypoint file runs to fetch the WEBHOOK_SECRET required by Ghost to verify Stripe webhooks, and saves it to a shared volume
  • When ghost-dev starts, the entrypoint reads WEBHOOK_SECRET from the shared volume into its environment before booting Ghost

Note

Enables local Stripe integration without a host-installed CLI by wiring a Dockerized Stripe CLI to Ghost via a shared config volume.

  • Adds stripe service (profile stripe) running stripe/stripe-cli with an entrypoint that fetches STRIPE_WEBHOOK_SECRET, writes it to shared-config/.env.stripe, and forwards webhooks to ${GHOST_URL}/members/webhooks/stripe/
  • Updates ghost-dev entrypoint to read STRIPE_WEBHOOK_SECRET from shared config and export it as WEBHOOK_SECRET
  • Mounts shared-config into ghost-dev and adds optional depends_on for stripe; healthcheck waits for .env.stripe
  • In compose.yml, sets GHOST_URL for the stripe service; .env.example hints enabling the stripe profile

Written by Cursor Bugbot for commit 06adeb1. This will update automatically on new commits. Configure here.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 8, 2025

Walkthrough

Adds a new stripe service to the development Compose file using stripe/stripe-cli:latest with a custom entrypoint, profile stripe, environment variables (GHOST_URL, STRIPE_SECRET_KEY, STRIPE_PUBLISHABLE_KEY, STRIPE_ACCOUNT_ID), and a healthcheck that verifies /mnt/shared-config/.env.stripe. Introduces a top-level shared-config volume and mounts it into ghost-dev (read-only) and stripe. Updates docker/ghost-dev/entrypoint.sh to source /mnt/shared-config/.env.stripe and export a webhook secret when present. Updates docker/stripe/entrypoint.sh to forward webhooks to ${GHOST_URL}/members/webhooks/stripe/. .env.example default COMPOSE_PROFILES value changed.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding Stripe integration to the yarn dev:forward setup through Docker and a shared volume configuration.
Description check ✅ Passed The description is directly related to the changeset, explaining the motivation, usage instructions, and implementation details of adding Stripe Docker integration to yarn dev:forward.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7cb6654 and 06adeb1.

📒 Files selected for processing (1)
  • .env.example
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: CR
Repo: TryGhost/Ghost PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:28:50.351Z
Learning: Frontend dev servers and foundation libraries run on host machine during `yarn dev:forward`, while Ghost Core backend, MySQL, Redis, Mailpit, and Caddy run in Docker
Learnt from: CR
Repo: TryGhost/Ghost PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:28:50.351Z
Learning: Use `yarn dev:forward` for hybrid Docker + host development with backend in Docker and frontend dev servers on host
Learnt from: cmraible
Repo: TryGhost/Ghost PR: 23546
File: compose.yml:58-59
Timestamp: 2025-05-27T18:08:00.458Z
Learning: Services that are dependencies for both Ghost Docker Compose profiles (`ghost` and `split`) need to include both profiles in their `profiles` configuration to ensure they start correctly under either profile.
Learnt from: cmraible
Repo: TryGhost/Ghost PR: 23546
File: compose.yml:58-59
Timestamp: 2025-05-27T18:08:00.458Z
Learning: The Ghost Docker Compose setup has two independent profiles: `ghost` profile (v0, runs all apps in a single container) and `split` profile (work in progress, runs Ghost server, admin, and frontend apps in separate services). The `split` profile will eventually replace `ghost` as the default.
Learnt from: jonatansberg
Repo: TryGhost/Ghost PR: 25485
File: compose.dev.yaml:0-0
Timestamp: 2025-11-25T13:09:33.918Z
Learning: In the Ghost Docker Compose development setup (compose.dev.yaml), the analytics service (ghost/traffic-analytics:1.0.20) requires `platform: linux/amd64` to be explicitly set, as this platform specification is necessary for now.
Learnt from: CR
Repo: TryGhost/Ghost PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:28:50.351Z
Learning: Use Docker Compose file composition for optional services: `yarn dev:analytics` for Tinybird, `yarn dev:storage` for MinIO, `yarn dev:all` for all optional services
📚 Learning: 2025-05-27T18:08:00.458Z
Learnt from: cmraible
Repo: TryGhost/Ghost PR: 23546
File: compose.yml:58-59
Timestamp: 2025-05-27T18:08:00.458Z
Learning: The Ghost Docker Compose setup has two independent profiles: `ghost` profile (v0, runs all apps in a single container) and `split` profile (work in progress, runs Ghost server, admin, and frontend apps in separate services). The `split` profile will eventually replace `ghost` as the default.

Applied to files:

  • .env.example
📚 Learning: 2025-05-27T18:08:00.458Z
Learnt from: cmraible
Repo: TryGhost/Ghost PR: 23546
File: compose.yml:58-59
Timestamp: 2025-05-27T18:08:00.458Z
Learning: Services that are dependencies for both Ghost Docker Compose profiles (`ghost` and `split`) need to include both profiles in their `profiles` configuration to ensure they start correctly under either profile.

Applied to files:

  • .env.example
📚 Learning: 2025-11-25T13:09:33.918Z
Learnt from: jonatansberg
Repo: TryGhost/Ghost PR: 25485
File: compose.dev.yaml:0-0
Timestamp: 2025-11-25T13:09:33.918Z
Learning: In the Ghost Docker Compose development setup (compose.dev.yaml), the analytics service (ghost/traffic-analytics:1.0.20) requires `platform: linux/amd64` to be explicitly set, as this platform specification is necessary for now.

Applied to files:

  • .env.example
📚 Learning: 2025-11-25T14:28:50.351Z
Learnt from: CR
Repo: TryGhost/Ghost PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:28:50.351Z
Learning: Use Docker Compose file composition for optional services: `yarn dev:analytics` for Tinybird, `yarn dev:storage` for MinIO, `yarn dev:all` for all optional services

Applied to files:

  • .env.example
📚 Learning: 2025-11-25T14:28:50.351Z
Learnt from: CR
Repo: TryGhost/Ghost PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:28:50.351Z
Learning: Run `yarn docker:dev` to start Ghost in Docker with hot reload

Applied to files:

  • .env.example
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Cursor Bugbot
🔇 Additional comments (1)
.env.example (1)

7-7: The COMPOSE_PROFILES example change from ghost to stripe is correct and should not be reverted.

The ghost-dev service runs by default without requiring any profile configuration. The stripe service is the optional add-on that requires profiles: ["stripe"] to activate. Uncommenting COMPOSE_PROFILES=stripe will properly start Ghost (which runs by default) along with the Stripe service. The original example showing COMPOSE_PROFILES=ghost was incorrect since no "ghost" profile exists in the compose.dev.yaml file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cmraible cmraible changed the title Add stripe yarn dev forward Added stripe to yarn dev:forward Dec 8, 2025
@cmraible cmraible marked this pull request as ready for review December 8, 2025 22:12
@cmraible cmraible marked this pull request as draft December 8, 2025 22:12
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
docker/stripe/entrypoint.sh (1)

90-91: Add validation for GHOST_URL environment variable.

The webhook forwarding URL uses ${GHOST_URL} without checking if it's set. If GHOST_URL is missing, the stripe listen command could fail with a confusing error message. While compose files always set this variable, defensive validation would improve robustness.

Consider adding a validation check before the stripe listen command:

+# Check if GHOST_URL is set
+if [ -z "${GHOST_URL:-}" ]; then
+    echo "ERROR: GHOST_URL is not set"
+    exit 1
+fi
+
 # Start stripe listen in the background
 echo "Starting Stripe webhook listener forwarding to ${GHOST_URL}/members/webhooks/stripe/"
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5a8a9c0 and 7cb6654.

📒 Files selected for processing (4)
  • compose.dev.yaml (2 hunks)
  • compose.yml (1 hunks)
  • docker/ghost-dev/entrypoint.sh (1 hunks)
  • docker/stripe/entrypoint.sh (1 hunks)
🧰 Additional context used
🧠 Learnings (10)
📓 Common learnings
Learnt from: CR
Repo: TryGhost/Ghost PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:28:50.351Z
Learning: Use `yarn dev:forward` for hybrid Docker + host development with backend in Docker and frontend dev servers on host
Learnt from: CR
Repo: TryGhost/Ghost PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:28:50.351Z
Learning: Frontend dev servers and foundation libraries run on host machine during `yarn dev:forward`, while Ghost Core backend, MySQL, Redis, Mailpit, and Caddy run in Docker
Learnt from: cmraible
Repo: TryGhost/Ghost PR: 23546
File: compose.yml:58-59
Timestamp: 2025-05-27T18:08:00.458Z
Learning: Services that are dependencies for both Ghost Docker Compose profiles (`ghost` and `split`) need to include both profiles in their `profiles` configuration to ensure they start correctly under either profile.
Learnt from: cmraible
Repo: TryGhost/Ghost PR: 23546
File: compose.yml:58-59
Timestamp: 2025-05-27T18:08:00.458Z
Learning: The Ghost Docker Compose setup has two independent profiles: `ghost` profile (v0, runs all apps in a single container) and `split` profile (work in progress, runs Ghost server, admin, and frontend apps in separate services). The `split` profile will eventually replace `ghost` as the default.
Learnt from: cmraible
Repo: TryGhost/Ghost PR: 24862
File: .github/workflows/ci-docker.yml:320-324
Timestamp: 2025-09-10T21:24:49.363Z
Learning: In GitHub Actions workflows using docker compose, the `docker compose pull` command works correctly with fork PRs even when some images (like the Ghost development image) are only loaded locally and not available in remote registries. The command doesn't fail when it encounters locally-loaded images during the pull process.
Learnt from: jonatansberg
Repo: TryGhost/Ghost PR: 25485
File: compose.dev.yaml:0-0
Timestamp: 2025-11-25T13:09:33.918Z
Learning: In the Ghost Docker Compose development setup (compose.dev.yaml), the analytics service (ghost/traffic-analytics:1.0.20) requires `platform: linux/amd64` to be explicitly set, as this platform specification is necessary for now.
📚 Learning: 2025-05-27T18:08:00.458Z
Learnt from: cmraible
Repo: TryGhost/Ghost PR: 23546
File: compose.yml:58-59
Timestamp: 2025-05-27T18:08:00.458Z
Learning: Services that are dependencies for both Ghost Docker Compose profiles (`ghost` and `split`) need to include both profiles in their `profiles` configuration to ensure they start correctly under either profile.

Applied to files:

  • compose.dev.yaml
  • compose.yml
📚 Learning: 2025-05-27T18:08:00.458Z
Learnt from: cmraible
Repo: TryGhost/Ghost PR: 23546
File: compose.yml:58-59
Timestamp: 2025-05-27T18:08:00.458Z
Learning: The Ghost Docker Compose setup has two independent profiles: `ghost` profile (v0, runs all apps in a single container) and `split` profile (work in progress, runs Ghost server, admin, and frontend apps in separate services). The `split` profile will eventually replace `ghost` as the default.

Applied to files:

  • compose.dev.yaml
📚 Learning: 2025-11-25T13:09:33.918Z
Learnt from: jonatansberg
Repo: TryGhost/Ghost PR: 25485
File: compose.dev.yaml:0-0
Timestamp: 2025-11-25T13:09:33.918Z
Learning: In the Ghost Docker Compose development setup (compose.dev.yaml), the analytics service (ghost/traffic-analytics:1.0.20) requires `platform: linux/amd64` to be explicitly set, as this platform specification is necessary for now.

Applied to files:

  • compose.dev.yaml
  • compose.yml
📚 Learning: 2025-12-01T08:42:35.320Z
Learnt from: jonatansberg
Repo: TryGhost/Ghost PR: 25552
File: e2e/helpers/environment/service-managers/dev-ghost-manager.ts:210-247
Timestamp: 2025-12-01T08:42:35.320Z
Learning: In e2e/helpers/environment/service-managers/dev-ghost-manager.ts, the hardcoded volume name 'ghost-dev_shared-config' at line 231 is intentional. E2E tests run under the 'ghost-dev-e2e' project namespace but deliberately mount the shared-config volume from the main 'ghost-dev' project to access Tinybird credentials created by yarn dev:forward. This is cross-project volume sharing by design.

Applied to files:

  • compose.dev.yaml
📚 Learning: 2025-11-25T14:28:50.351Z
Learnt from: CR
Repo: TryGhost/Ghost PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:28:50.351Z
Learning: Frontend dev servers and foundation libraries run on host machine during `yarn dev:forward`, while Ghost Core backend, MySQL, Redis, Mailpit, and Caddy run in Docker

Applied to files:

  • compose.dev.yaml
📚 Learning: 2025-10-07T12:19:15.174Z
Learnt from: kevinansfield
Repo: TryGhost/Ghost PR: 25031
File: ghost/core/test/utils/fixtures/config/defaults.json:68-80
Timestamp: 2025-10-07T12:19:15.174Z
Learning: In Ghost's configuration system (ghost/core/core/shared/config/), environment-specific config files (e.g., config.development.json, config.production.json) automatically fall back to values defined in defaults.json. It's only necessary to specify changed overrides on a per-env basis. Missing keys in env configs are not an issue—they're intentional and will use the default values.

Applied to files:

  • compose.dev.yaml
📚 Learning: 2025-11-25T14:28:50.351Z
Learnt from: CR
Repo: TryGhost/Ghost PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:28:50.351Z
Learning: Run `yarn docker:dev` to start Ghost in Docker with hot reload

Applied to files:

  • compose.dev.yaml
📚 Learning: 2025-02-06T10:30:53.440Z
Learnt from: allouis
Repo: TryGhost/Ghost PR: 22127
File: .github/scripts/release-apps.js:72-74
Timestamp: 2025-02-06T10:30:53.440Z
Learning: In the Ghost repository, the path to defaults.json is correctly structured as 'ghost/core/core/shared/config/defaults.json' with an intentional double 'core' in the path.

Applied to files:

  • compose.dev.yaml
📚 Learning: 2025-11-25T14:28:50.351Z
Learnt from: CR
Repo: TryGhost/Ghost PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:28:50.351Z
Learning: Use Docker Compose file composition for optional services: `yarn dev:analytics` for Tinybird, `yarn dev:storage` for MinIO, `yarn dev:all` for all optional services

Applied to files:

  • compose.dev.yaml
🔇 Additional comments (3)
docker/ghost-dev/entrypoint.sh (1)

20-30: Well-implemented optional Stripe configuration.

The webhook secret sourcing follows the established Tinybird pattern, with proper validation and graceful degradation when the config is missing. This maintains backward compatibility while enabling Stripe when the service is active.

compose.yml (1)

288-305: Stripe service configuration is well-structured.

The GHOST_URL correctly references the server service, environment variables follow consistent patterns with defaults, and the healthcheck appropriately validates webhook secret generation. The optional dependency from the server service is correct.

compose.dev.yaml (1)

69-69: Add stripe dependency to ghost-dev service for consistency and reliability.

The server service in compose.yml has a stripe dependency (required: false), but the ghost-dev service in compose.dev.yaml lacks this. Without the dependency, ghost-dev may start before stripe has created /mnt/shared-config/.env.stripe, causing the Stripe configuration to fail silently on startup.

Add a stripe dependency to the ghost-dev service to match the pattern in compose.yml:

 ghost-dev:
   build:
     context: ./
     dockerfile: docker/ghost-dev/Dockerfile
   container_name: ghost-dev
   working_dir: /home/ghost/ghost/core
   command: ["yarn", "dev"]
   volumes:
     - ./ghost:/home/ghost/ghost
     # ... other volumes ...
     - shared-config:/mnt/shared-config:ro
   environment:
     NODE_ENV: development
     # ... env vars ...
   depends_on:
     mysql:
       condition: service_healthy
     redis:
       condition: service_healthy
     mailpit:
       condition: service_healthy
+    stripe:
+      condition: service_healthy
+      required: false
   healthcheck:
     # ... healthcheck ...

Based on learnings, services that depend on shared configuration should properly order their startup dependencies.

Also applies to: 123-140

⛔ Skipped due to learnings
Learnt from: cmraible
Repo: TryGhost/Ghost PR: 23546
File: compose.yml:58-59
Timestamp: 2025-05-27T18:08:00.458Z
Learning: Services that are dependencies for both Ghost Docker Compose profiles (`ghost` and `split`) need to include both profiles in their `profiles` configuration to ensure they start correctly under either profile.
Learnt from: jonatansberg
Repo: TryGhost/Ghost PR: 25485
File: compose.dev.yaml:0-0
Timestamp: 2025-11-25T13:09:33.918Z
Learning: In the Ghost Docker Compose development setup (compose.dev.yaml), the analytics service (ghost/traffic-analytics:1.0.20) requires `platform: linux/amd64` to be explicitly set, as this platform specification is necessary for now.
Learnt from: cmraible
Repo: TryGhost/Ghost PR: 23546
File: compose.yml:58-59
Timestamp: 2025-05-27T18:08:00.458Z
Learning: The Ghost Docker Compose setup has two independent profiles: `ghost` profile (v0, runs all apps in a single container) and `split` profile (work in progress, runs Ghost server, admin, and frontend apps in separate services). The `split` profile will eventually replace `ghost` as the default.
Learnt from: CR
Repo: TryGhost/Ghost PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:28:50.351Z
Learning: Use Docker Compose file composition for optional services: `yarn dev:analytics` for Tinybird, `yarn dev:storage` for MinIO, `yarn dev:all` for all optional services
Learnt from: jonatansberg
Repo: TryGhost/Ghost PR: 25552
File: e2e/helpers/environment/service-managers/dev-ghost-manager.ts:210-247
Timestamp: 2025-12-01T08:42:35.320Z
Learning: In e2e/helpers/environment/service-managers/dev-ghost-manager.ts, the hardcoded volume name 'ghost-dev_shared-config' at line 231 is intentional. E2E tests run under the 'ghost-dev-e2e' project namespace but deliberately mount the shared-config volume from the main 'ghost-dev' project to access Tinybird credentials created by yarn dev:forward. This is cross-project volume sharing by design.

@cmraible cmraible force-pushed the add-stripe-yarn-dev-forward branch from d8f8255 to 06adeb1 Compare January 13, 2026 00:25
@cmraible cmraible marked this pull request as ready for review January 13, 2026 17:15
## Run `docker compose config --profiles` to see all available profiles
## See https://docs.docker.com/compose/how-tos/profiles/ for more information
COMPOSE_PROFILES=ghost
# COMPOSE_PROFILES=stripe
Copy link
Contributor

Choose a reason for hiding this comment

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

Why remove the default profile? Just because it's not necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep! The default profile is part of the "legacy" docker environment, where by default only mysql + redis run.

Copy link
Contributor

@9larsons 9larsons left a comment

Choose a reason for hiding this comment

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

My only real concern here is mixing our configuration with .env and config.{x} and adding more confusion... however I think we'll never really avoid that since we need .env for Docker, unless we do some patching to pass through the config items.

Overall this looks good 🙌 . Definitely an improvement and step forward towards parity with our non-Docker dev setup.

@cmraible cmraible merged commit b719931 into main Jan 14, 2026
36 checks passed
@cmraible cmraible deleted the add-stripe-yarn-dev-forward branch January 14, 2026 18:29
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