-
Notifications
You must be signed in to change notification settings - Fork 211
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
Polling readiness for PHP-FPM, NGINX, and Apache #482
Comments
On vacation at the moment, sorry for the brief answer. The
(this is a translation of your current run script that will work with s6-notifyoncheck) |
Thank you very much! This helps out a ton. I have some examples working locally that I will push up once I figure out how to have PHP-FPM tell me what I need it to π I will loop back with my examples once I have them complete. Feel free to use them to help others if needed. I'll keep you posted, enjoy your vacation! βοΈπ |
Update: I got it working πThanks for your help @skarnet! You pushed me in the right direction and I was able to get everything functioning. I'm currently beta testing my changes, but here's the most important notes for others that are coming here for PHP-FPM healthchecks: How I am defining "healthy" for PHP-FPMWe all know PHP-FPM isn't the most modern daemon out there, so defining "healthy" can be challenging. I was able to do it with After I had things configured, I ran into another errorPHP-FPM was throwing this error on container start up:
I assumed it had something to do with the timing of Thankfully I noticed this in the docs:
Taking a wild guess (because I know PHP-FPM has a parent and child processes), enabling Here is an example of my #!/command/execlineb -P
with-contenv
s6-notifyoncheck -d
exec /usr/sbin/php-fpm8.1 --nodaemonize Source codeFor anyone who needs to reference how I solved the full solution, here's all of my source code: https://github.com/serversideup/docker-php/tree/dev/dist/8.1 I am very grateful for this project by all of it's contributors. π Feel free to use my source code as an example for others or submit any improvements if you see any areas that could use work. Thanks again! |
Congrats on getting it to work! And yes, the Note that you can still use Cheers! |
Thanks for your feedback!
I removed that extra
When I made this change, I get this error:
Probable CauseI set a setting in PHP-FPM to redirect output to stdout/stderr: (my workaround to run as Question
I am grateful for your advice and expertise π |
If fpm closes its stdout/stderr and can only reopen them by specifying Ideally, fpm would not do that, and you could just tell it to write its access logs to stdout and its error logs to stderr, without doing the close/reopen dance; in which case you could drop privileges before running it. But it looks like it's neither the first nor the last of fpm's misdesigns, and we just have to live with it. |
We are definitely on the same page about PHP-FPM's design! π I greatly appreciate your comments and help on PHP-FPM (even though it's completely out of scope of this project). Thank you so much for this incredible project! π |
β° Background
π Problem I am trying to solve
π€ My Approach to a Solution
Below details how I am approaching to solve this problem:
Upgrade & Convert "Longrun" services to 3.x standards
In my source code, I converted my "longrun" services to the new standard. This went well, thanks!
I need to create "readiness" script
According @jprjr to a post in 2018 (#245 (comment)), PHP-FPM needs to be polled because of the poor design of PHP-FPM.
I found the documentation on
notifywhenup
: https://skarnet.org/software/s6/notifywhenup.htmlIt talks about creating a polling script:
I am confused if this directory structure is with the new 3.x standards and where
foo-check
comes from.β‘οΈ S6 Overlay Version
π¨βπ» My Source Code
All on GitHub: https://github.com/serversideup/docker-php/tree/dev/dist/8.1
Note: The
fpm-nginx
image is built from thefpm
image (so you understand the image dependency and what's included).Easily pull and inspect any Docker image with
bash
β Questions
Thanks for your help!
The text was updated successfully, but these errors were encountered: