Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(medusa): Add health endpoint for all running modes of medusa #10737

Merged
merged 1 commit into from
Dec 26, 2024

Conversation

sradevski
Copy link
Member

@sradevski sradevski commented Dec 26, 2024

When running the service in eg. K8s, we need a way to check the readiness of the service, regardless if it runs in server, shared, or worker mode. This allows for that, as previously we only registered the health endpoint in shared or server mode.

@sradevski sradevski requested a review from a team as a code owner December 26, 2024 05:24
Copy link

vercel bot commented Dec 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference 🔄 Building (Inspect) Visit Preview 💬 Add feedback Dec 26, 2024 5:26am
medusa-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 26, 2024 5:26am
5 Skipped Deployments
Name Status Preview Comments Updated (UTC)
api-reference-v2 ⬜️ Ignored (Inspect) Dec 26, 2024 5:26am
docs-ui ⬜️ Ignored (Inspect) Visit Preview Dec 26, 2024 5:26am
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Dec 26, 2024 5:26am
medusa-docs ⬜️ Ignored (Inspect) Dec 26, 2024 5:26am
resources-docs ⬜️ Ignored (Inspect) Visit Preview Dec 26, 2024 5:26am

Copy link

changeset-bot bot commented Dec 26, 2024

⚠️ No Changeset found

Latest commit: 1217825

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

@thetutlage thetutlage left a comment

Choose a reason for hiding this comment

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

Yeah. Looks good to me, given we already start the express server and the /health endpoint just returns a 200 OK.

@thetutlage
Copy link
Contributor

@sradevski A quick question.

Do we use the /health endpoint to check if we should send traffic to this specific server? If yes, then it might cause some issues. For example:

  • The start command will register the /health endpoint and respond with 200.
  • The loaders are not yet ready (because booting the app might take a couple of seconds)
  • The infra starts sending traffic to this new instance and it won't respond until the entire boot process is finished.

WDYT?

@sradevski
Copy link
Member Author

@thetutlage yes I agree, as I wrote in the comment, just sending a 200 isn't ideal due to the scenario you described.

However, I do think at this point everything should be loaded though, right? If we were to eg. start the server first, and then eg. run the loaders it would be a problem.

@sradevski
Copy link
Member Author

/snapshot-this

@thetutlage
Copy link
Contributor

However, I do think at this point everything should be loaded though, right? If we were to eg. start the server first, and then eg. run the loaders it would be a problem.

Yeah, I think you are right. We load everything and then we call app.listen, so we are all sorted then 👍

Copy link
Contributor

🚀 A snapshot release has been made for this PR

Test the snapshots by updating your package.json with the newly published versions:

yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]

Latest commit: 699bb6d

@sradevski sradevski merged commit c8f9938 into develop Dec 26, 2024
24 checks passed
@sradevski sradevski deleted the feat/add-health-endpoint-for-all-modes branch December 26, 2024 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants