Add healthcheck command #2856
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "ScribblerCoder/vikunja:main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Currently vikunja has a
/health
endpoint that was added in #998. Currently docker/compose cannot utilize this feature, vikunja's docker image doesn't have curl/wget as it is pruned which is great for the image size. This PR adds ahealthcheck
command that send an http request to/health
and exits with 0 or non-zero depending on the resultWelcome! Thanks for the PR. I have a few nits, but nothing too substantial.
@ -0,0 +45,4 @@
}
port := strings.Split(config.ServiceInterface.GetString(), ":")
url := "http://localhost:%s/health"
resp, err := client.Get(fmt.Sprintf(url, port[len(port)-1]))
Can't you always do
port[0]
here?Or why not add the interface config directly? Since it also contains a
:
. That would simplify the url building.looks like adding the entire interface works. if it is
:3456
then the request is sent tolocalhost:3456
@ -0,0 +55,4 @@
// Check the response status
if resp.StatusCode == http.StatusOK {
fmt.Println("API server is healthy")
os.Exit(0)
Can you add an early return here? Similar to the error handling.
makes sense, will do.
Hi ScribblerCoder!
Thank you for creating a PR!
I've deployed the frontend changes of this PR on a preview environment under this URL: https://2856-main--vikunja-frontend-preview.netlify.app
You can use this url to view the changes live and test them out.
You will need to manually connect this to an api running somewhere. The easiest to use is https://try.vikunja.io/.
This preview does not contain any changes made to the api, only the frontend.
Have a nice day!
Almost ready, can you add the command to the docker image's healthcheck?
https://docs.docker.com/reference/dockerfile/#healthcheck
Thanks!