-
I have an nginx Unit+Php container with the following docker file
And If I run this, it works fine, index.php loads correctly. Now, I want to use supervisor to start a php script to run as daemon. This is a kafkaConsumer with a while loop. Below are the files
And a simple php script for testing.
However, If I add the following line to Dockerfile to start supervisor,
Then, the daemon php script does start, but the php server (http://localhost/) stops responding, with the following message
Any help much appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 14 replies
-
Which service is listening on port 80? Can you share your Unit configuration? |
Beta Was this translation helpful? Give feedback.
-
Sorry, I should have added it in the first place.
Compose
|
Beta Was this translation helpful? Give feedback.
-
I tried with user=root, www-data, unit, etc in the supervisord. If I specified user, and it was anything other than root, then the log would show permission denied, so I just left it without specifying the user. And for how I knew the daemon php was running? My original phpdaemon is a bit longer, with a function that writes some text with timestamp to a txt file on each iteration, and I can do cat someTextFile.txt from inside the container, and see that the file keeps getting new lines with timestamps. |
Beta Was this translation helpful? Give feedback.
-
OK, looks like unitd is running :) But there's no sign of any configuration being applied. I would expect to see
I suspect that when you added
it replaced the default So now you have both services but Unit has an empty configuration. Confirm by running
To resolve this, you'll need to apply the configuration in the Dockerfile. I recommend COPY config.json init.json
RUN nohup /bin/sh -c "unitd --no-daemon --pid init.pid --log /dev/stdout --control unix:init.unit.sock &" && \
curl -fsX PUT [email protected] --unix-socket init.unit.sock _/config && \
rm init.* |
Beta Was this translation helpful? Give feedback.
OK, looks like unitd is running :)
But there's no sign of any configuration being applied. I would expect to see
I suspect that when you added
it replaced the default
CMD
which is to run the Unit entrypoint script.So now you have both services but Unit has an empty configuration. Confirm by running
To resolve this, you'll need to apply the configuration in the Dockerfile. I recommend