Spinning out as a task from this series of comments on review thread
To quote @tstarling
In PHP-FPM, stdout and stderr may either be /dev/null (the default) or they can both be pipes that go to the parent process, which forwards lines to FPM's log system. There's no obvious way to write directly to stdout or stderr of a controlling terminal that started a service. The best we can do is have a shell script that starts the server and then tails a FIFO. PHP can write to the FIFO and tail -f will forward those writes to the controlling terminal. I think this can be done with the logFile option.
In CGI mode, stdout is forwarded to HTTP. logToStderr is at least guaranteed to not mess up the output.
The question is: which process is supposed to produce logs on stdout for k8s's consumption? The answer is not the FastCGI worker process, k8s doesn't have access to that, even if it could be implemented. Presumably k8s is running something that is supposed to produce logs on stdout. So the question is, what is that thing and how can we make that happen?
I have looked up solutions to this problem, and found a few relevant links:
- https://pracucci.com/php-on-kubernetes-application-logging-via-unix-pipe.html provides two options for how php-fit could be set up to get the logs from worker processes.
- https://github.com/docker-library/httpd/blob/b13054c7de5c74bbaa6d595dbe38969e6d4f860c/2.2/Dockerfile#L72-L75 - the official httpd image
serviceops please advise. A more generic question, how do we intend to run shellbox on k8s? What php infrastructure do we intend to use? Having that answer I can go search for more relevant solution ideas.