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

Add healthcheck on web to restart based on curl #373

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

oscgonfer
Copy link
Contributor

@oscgonfer oscgonfer commented Nov 1, 2024

This is another attempt to help with web not restarting when app falls over. It adds a healthcheck on runtime to the web container. It seems that the depends_on done in #360 only works for docker compose operations, not in runtime.

This is indicated in the documentation: https://docs.docker.com/reference/compose-file/services/#depends_on

restart: When set to true Compose restarts this service after it updates the dependency service. This applies to an explicit restart controlled by a Compose operation, and excludes automated restart by the container runtime after the container dies. Introduced in Docker Compose version 2.17.0.

Copy link
Contributor

@timcowlishaw timcowlishaw left a comment

Choose a reason for hiding this comment

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

Aha nice! this looks good - only thing to check is that curl is installed in that container!

@oscgonfer
Copy link
Contributor Author

oscgonfer commented Nov 1, 2024

All good!

$ doco exec web bash
root@8e1d51748359:/# curl http://app:3000 -v
*   Trying 172.22.0.11:3000...
* Connected to app (172.22.0.11) port 3000 (#0)
> GET / HTTP/1.1
> Host: app:3000
> User-Agent: curl/7.88.1
> Accept: */*
> 
< HTTP/1.1 301 Moved Permanently
< Content-Type: text/html
< Location: https://app:3000/
< Content-Length: 0
< 
* Connection #0 to host app left intact

@oscgonfer oscgonfer merged commit c3aca08 into master Nov 5, 2024
2 checks passed
@oscgonfer oscgonfer deleted the enhancement/docker-web-healthcheck branch November 5, 2024 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants