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

Why using supervisord inside docker? #104

Open
ProtocolNebula opened this issue Dec 19, 2024 · 4 comments
Open

Why using supervisord inside docker? #104

ProtocolNebula opened this issue Dec 19, 2024 · 4 comments
Labels
question Further information is requested

Comments

@ProtocolNebula
Copy link

Hi,

This seems to be a stupid question, so let me explain:

Docker itself is designed to handle the service stops, if it stops, the docker get stopped BUT it will automatically restart (if is well configured). So I cannot understand the need of using supervisord at start-container.

Also, there is a healthcheck in case of something weird, that will force docker to reboot again.

@smortexa
Copy link
Member

Hi,

It is essential for managing multiple processes (services) within a container or executing one-time commands efficiently. Could you please provide more detailed information about healthcheck problem?

@smortexa smortexa added the question Further information is requested label Dec 20, 2024
@ProtocolNebula
Copy link
Author

I’ve replied this in the PR instead here… so copy / pasted…:

No real issues with health check, it’s just managed by docker

I didn’t know that you must run supervisor in order to support multiple workers, I though it was part of the service.

In that the case, this PR can be closed, but maybe a bit more of investigation is required.

@KnudH
Copy link

KnudH commented Dec 26, 2024

I will help a little here with some clarifications.

I think you should not use services and processes as synonyms. The recommended policy of docker is, that each container should only execute one service but can execute multiple processes (e.g., multiple processes). Services and processes are something different in their naming.

From: https://docs.docker.com/engine/containers/multi-service_container/:

A container's main running process is the ENTRYPOINT and/or CMD at the end of the Dockerfile. It's best practice to separate areas of concern by using one service per container. That service may fork into multiple processes (for example, Apache web server starts multiple worker processes). It's ok to have multiple processes, but to get the most benefit out of Docker, avoid one container being responsible for multiple aspects of your overall application. You can connect multiple containers using user-defined networks and shared volumes.

So it's not a good idea to pack different services inside a container. This gets even worse if you use container orchestration like Kubernetes. If the main process will never crash, even if the container is in a non-working state, k8s is unable to detect this and unable to do the self-healing. You can work around with a health check, like you did here, but it's important that this health check is binary (running / not running) and not something like “partial running”. But I don't see an issue here.

@ProtocolNebula
Copy link
Author

I will help a little here with some clarifications.

I think you should not use services and processes as synonyms. The recommended policy of docker is, that each container should only execute one service but can execute multiple processes (e.g., multiple processes). Services and processes are something different in their naming.

From: https://docs.docker.com/engine/containers/multi-service_container/:

A container's main running process is the ENTRYPOINT and/or CMD at the end of the Dockerfile. It's best practice to separate areas of concern by using one service per container. That service may fork into multiple processes (for example, Apache web server starts multiple worker processes). It's ok to have multiple processes, but to get the most benefit out of Docker, avoid one container being responsible for multiple aspects of your overall application. You can connect multiple containers using user-defined networks and shared volumes.

So it's not a good idea to pack different services inside a container. This gets even worse if you use container orchestration like Kubernetes. If the main process will never crash, even if the container is in a non-working state, k8s is unable to detect this and unable to do the self-healing. You can work around with a health check, like you did here, but it's important that this health check is binary (running / not running) and not something like “partial running”. But I don't see an issue here.

Hi, thanks for reply, but I did not created the dockerfile, just commented that supervisord was used and I'm not sure if it's necessary.
What you comment about use a docker for a single kind of service is partially done in this repo, of course, maybe not in the best way, but you can only start the docker container for one specific task, so you should run at least 4 dockers to run everything.

What I still not know if it's required supervisord, but I finally didn't use this for my production application because octane have some issues with livewire.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants