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

AIO-interface: add Unhealthy container state #5307

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

docjyJ
Copy link
Collaborator

@docjyJ docjyJ commented Sep 21, 2024

@szaimen szaimen added 3. to review Waiting for reviews enhancement New feature or request labels Sep 25, 2024
@szaimen szaimen added this to the next milestone Sep 25, 2024
@szaimen szaimen changed the title Ench/noid/heathcheck AIO: add IContainerState Sep 25, 2024
@docjyJ docjyJ self-assigned this Sep 28, 2024
@docjyJ docjyJ requested a review from szaimen September 28, 2024 18:21
Copy link
Member

@st3iny st3iny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Jean-Yves, Simon asked me to have a look at your changes. I left some feedback regarding the code itself.

I really like you refactoring the container state logic from an interface to an enum. However, I think that both concerns could have been split into separate PRs. One PR to refactor the interface and another one to implement the new healthy states. But the code is already there so why not.

Looks good otherwise but did not test.

php/src/Container/Container.php Outdated Show resolved Hide resolved
php/src/Controller/DockerController.php Outdated Show resolved Hide resolved
php/src/Docker/DockerActionManager.php Outdated Show resolved Hide resolved
php/src/Docker/DockerActionManager.php Outdated Show resolved Hide resolved
php/src/Docker/DockerActionManager.php Outdated Show resolved Hide resolved
php/src/Docker/DockerActionManager.php Outdated Show resolved Hide resolved
php/README.md Outdated Show resolved Hide resolved
php/src/Container/IContainerState.php Outdated Show resolved Hide resolved
@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 1, 2024

Hi,

Thanks for the answer, as soon as I have time I'll look into it.

I will try to separate and make several PR.

Take care,

@docjyJ docjyJ added 2. developing Work in progress blocked and removed 3. to review Waiting for reviews labels Oct 2, 2024
@docjyJ docjyJ marked this pull request as draft October 2, 2024 13:11
@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 2, 2024

I keep this PR open for the unhealthy state.
See #5372 for enum

@docjyJ docjyJ changed the title AIO: add IContainerState AIO: add Unhealthy container state Oct 7, 2024
@szaimen
Copy link
Collaborator

szaimen commented Oct 8, 2024

Conflicts :/

@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 8, 2024

Don't worry, i'll handle it.

@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 8, 2024

Solved and up to date and ready (to be tested anyway...)

@docjyJ docjyJ marked this pull request as ready for review October 8, 2024 09:24
@docjyJ docjyJ added 3. to review Waiting for reviews and removed 2. developing Work in progress blocked labels Oct 8, 2024
@szaimen szaimen changed the title AIO: add Unhealthy container state AIO-interface: add Unhealthy container state Oct 8, 2024
@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 8, 2024

I have podman on my machine and I can't launch the container... I can't test it and I don't have time to debug...

@szaimen
Copy link
Collaborator

szaimen commented Oct 8, 2024

I have podman on my machine and I can't launch the container...

Why may I ask? Do you run into an issue here?

@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 8, 2024

Why may I ask? Do you run into an issue here?

podman run \
--rm \
--name nextcloud-aio-mastercontainer \
--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config:z \
--volume /var/run/user/1000/podman/podman.sock:/var/run/docker.sock:z \
--env WATCHTOWER_DOCKER_SOCKET_PATH=/var/run/user/1000/podman/podman.sock \
nextcloud/all-in-one:latest
Trying to fix docker.sock permissions internally...
Adding internal www-data to group root
Cannot connect to the docker socket. Cannot proceed.
Did you maybe remove group read permissions for the docker socket? AIO needs them in order to access the docker socket.
If SELinux is enabled on your host, see https://github.com/nextcloud/all-in-one#are-there-known-problems-when-selinux-is-enabled
If you are on TrueNas SCALE, see https://github.com/nextcloud/all-in-one#can-i-run-aio-on-truenas-scale

I don't know what happen

@szaimen
Copy link
Collaborator

szaimen commented Oct 8, 2024

Why may I ask? Do you run into an issue here?

podman run \
--rm \
--name nextcloud-aio-mastercontainer \
--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config:z \
--volume /var/run/user/1000/podman/podman.sock:/var/run/docker.sock:z \
--env WATCHTOWER_DOCKER_SOCKET_PATH=/var/run/user/1000/podman/podman.sock \
nextcloud/all-in-one:latest
Trying to fix docker.sock permissions internally...
Adding internal www-data to group root
Cannot connect to the docker socket. Cannot proceed.
Did you maybe remove group read permissions for the docker socket? AIO needs them in order to access the docker socket.
If SELinux is enabled on your host, see https://github.com/nextcloud/all-in-one#are-there-known-problems-when-selinux-is-enabled
If you are on TrueNas SCALE, see https://github.com/nextcloud/all-in-one#can-i-run-aio-on-truenas-scale

I don't know what happen

Maybe this helps? https://github.com/nextcloud/all-in-one?tab=readme-ov-file#are-there-known-problems-when-selinux-is-enabled

@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 8, 2024

image
🙄 🙄 🙄 🙄

thank 😅

@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 9, 2024

It doesn't work, I give up.
Can you test this?
One way to test would be to go into the Nextcloud container and add exit 1 in the heathcheck.sh script.

According to the docker documentation: https://docs.docker.com/reference/api/engine/version/v1.45/#tag/Container/operation/ContainerInspect

State - Health - Status

Status is one of none, starting, healthy or unhealthy

"none" Indicates there is no healthcheck
"starting" Starting indicates that the container is not yet ready
"healthy" Healthy indicates that the container is running correctly
"unhealthy" Unhealthy indicates that the container has a problem

Adding this information would be good for detecting potential problems and for debugging.

@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 9, 2024

Another question Why not use starting state and restarting state from docker ?

Enum: "created" "running" "paused" "restarting" "removing" "exited" "dead"

String representation of the container state. Can be one of "created", "running", "paused", "restarting", "removing", "exited", or "dead".

Could we use this indicator?
It would be easier to maintain.
If you agree, I can try to rewrite the functions GetContainerRestartingState, GetContainerRunningState, GetContainerRestartingState.

@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 9, 2024

Docker doc for meaning of state https://docs.docker.com/reference/cli/docker/container/ls/#status

@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 9, 2024

A proposal in commit b903cc3.

(I renamed the enums to match the getters name, it's more consistent but I can rollback)

@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 10, 2024

A proposal in commit b903cc3.

What do you think @szaimen ?

@szaimen
Copy link
Collaborator

szaimen commented Oct 10, 2024

Another question Why not use starting state and restarting state from docker ?

Enum: "created" "running" "paused" "restarting" "removing" "exited" "dead"
String representation of the container state. Can be one of "created", "running", "paused", "restarting", "removing", "exited", or "dead".

Could we use this indicator? It would be easier to maintain. If you agree, I can try to rewrite the functions GetContainerRestartingState, GetContainerRunningState, GetContainerRestartingState.

I overread this. Yes sounds good imo :)

Signed-off-by: Jean-Yves <7360784+docjyJ@users.noreply.github.com>
Signed-off-by: Jean-Yves <7360784+docjyJ@users.noreply.github.com>
Signed-off-by: Jean-Yves <7360784+docjyJ@users.noreply.github.com>
@szaimen szaimen modified the milestones: v9.7.0, next Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants