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

[💡 FEATURE REQUEST]: server.on_init with an option to crash the server #2075

Closed
wizardist opened this issue Nov 28, 2024 · 7 comments · Fixed by roadrunner-server/server#95
Assignees
Labels
C-feature-request Category: feature requested, but need to be discussed
Milestone

Comments

@wizardist
Copy link

Plugin

Server

I have an idea!

Per documentation,

If the on_init command fails (i.e., returns a non-zero exit code), RoadRunner will log the error but continue execution. This ensures that a failure during initialization does not interrupt the application's operation.

While this makes sense for many use cases, we want to use server.on_init to make preflight checks when a Kubernetes pod starts. While we could do an init container instead, we want to use RoadRunner as much as possible, and crashing PID 1 would work just fine in our case.

I suggest to add server.on_init.fail_on_error boolean configuration option that will relay the exit code from the on_init script and will exit the master process, thereby crashing the container.

I hope that others with containerized environments may benefit from this too. I would like to get a go-ahead from the community before we submit a pull request with necessary changes.

@wizardist wizardist added the C-feature-request Category: feature requested, but need to be discussed label Nov 28, 2024
@rustatian
Copy link
Member

Hey @wizardist 👋🏻
Yeah, it makes sense for me. Will be in the next release.

@rustatian rustatian added this to the v2024.3 milestone Nov 28, 2024
@rustatian rustatian moved this to 🔖 Ready in Jira 😄 Nov 28, 2024
@wizardist
Copy link
Author

@rustatian just to confirm, have you assigned the FR to yourself to work on it? 😊 This is really great.

@rustatian
Copy link
Member

Sure, why not 😄 You want to try it yourself?

@wizardist
Copy link
Author

@rustatian we're onboarding RoadRunner for production workloads, and making the teams familiar with the RR codebase is beneficial. Let me check with the Legal, and if we have a green light to contribute to RR codebase, I'll assign one of my team members, or myself, to this issue.

Let me unassign you from it so there's clarity on this. If we hit a red light, I'll ping you and re-assign you back. But I really doubt it will happen. ☺️

@rustatian
Copy link
Member

I've already implemented this 😄
But still, if you wanted to help, just reach out to me (or just use help-wanted issues tag search).

@github-project-automation github-project-automation bot moved this from 🔖 Ready to ✅ Done in Jira 😄 Nov 28, 2024
@rustatian
Copy link
Member

You may build your RR binary with Velox (roadrunner-server/velox + you may check our docs for the instuction) with that change (just use master branch for the server plugin) if you wanted to try it right now, w/o waiting for the release.

@AleksandrKosovS
Copy link

Thank you. I built it from master and it successfully fails if init script returns error with exit_on_error true 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: feature requested, but need to be discussed
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

3 participants