-
-
Notifications
You must be signed in to change notification settings - Fork 218
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
Issue with restarting VPN container #91
Comments
You need to set your other containers to have some sort of health check in place to indicate they are unhealthy for autoheal to pick up there is a problem. By default, it would go in order. Simplest way would be to ping your VPN container or a port that can be accessed if everything is working properly. |
Here is how I did it: |
@mfizz1 that solution you are propossing seems interesting, could you expand on that? do you know how to add a health check to a container running from docker-compose? For example I am running qbittorrent which is dependent on gluetun, and I would like to mark the qbittorrent container as unhealthy when the qbittorrent port is not responding so autoheal can restart it, how can I do that? This is my docker-compose.yaml file:
|
its good to cover self + all dependencies within healthcheck, not via depends_on but via test within healthcheck. e.g. am testing withing qbittorrent healthcheck if http of gluetun 8888 is ok, if ever not autoheal will attempt restart qbittorrent. You'd need gluetun own healthcheck if you want autoheal to pickup when unhealthy and restart. e.g.
depends_on is more linked to startup order/control, ref: https://docs.docker.com/compose/startup-order/
|
@hasnat thanks for the quick reply, why are you using "http://gluetun:8888" instead of localhost:8888 or similar? http://gluetun:8888 is not a correct url, right? I have tried to run "curl -f http://gluetun:8888" within the container and got the error "Could not resolve host: gluetun" (as expected tbh). I also tried using |
Finally I found the way to do it. For anyone coming here with the same issue, the key was to add the parameter
@amberflag48 you might want to close this defect as it is solved now |
@heisenberg2980 that was only a demonstration note, suggesting you can test/curl other containers in compose file/stack to validate health of the container. I didn't use IPs since containers were all in same compose file/network; accessible via container-name as hostname by eachother. |
Thanks for the clarification, I also thought about that but as autoheal restarts gluetun automatically within seconds as soon as it becomes unhealthy, the healtcheck in qbittorrent wouldn´t even realised gluetun was down, so the only way is for each container (qbittorrent in this case) to check its own external port. Regarding using the container name as hostname to ping/curl, I didn´t know that was possible, and I have tried different combinations inside the qbittorrent container (i.e. |
@heisenberg2980 those prots might not exist, even if they did might not be http for curl to understand; I only made them up for examples to show how to structure your health checks. same like for mysql+php stack, you could netcat mysql 3306 port (which isn't http) from php container. good luck with it |
Hello,
I have autoheal set to restart my VPN container when it goes down. It is also configured to restart the containers linked to it when they go down.
The issue is when the VPN goes down, it gets restart, that is fine and expected. It does not however restart the containers depending to it. This is an issue because the web UI ports of those containers are mapped to the VPN container so I can access them like normal.
So for those web UI ports to be available back those containers need to be started AFTER the VPN container starts. With this configuration, only the VPN container is restarted since the other ones are still healthy anyway.
Is there a solution for that?
Thanks!
The text was updated successfully, but these errors were encountered: