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 an healthcheck to server container #1943

Closed
2 tasks
6543 opened this issue Jul 7, 2023 · 6 comments · Fixed by #2030
Closed
2 tasks

Add an healthcheck to server container #1943

6543 opened this issue Jul 7, 2023 · 6 comments · Fixed by #2030
Labels
feature add new functionality good first issue Likely to be an easy fix server

Comments

@6543
Copy link
Member

6543 commented Jul 7, 2023

like the agent:

HEALTHCHECK CMD ["/bin/woodpecker-agent", "ping"]

ref https://docs.docker.com/engine/reference/builder/#healthcheck

TODO:

@6543 6543 added server feature add new functionality labels Jul 7, 2023
@6543 6543 mentioned this issue Jul 7, 2023
5 tasks
@lonix1
Copy link
Contributor

lonix1 commented Jul 7, 2023

Background info:

  • Option 1 is to burn it into the image:
    Dockerfile :

    HEALTHCHECK CMD # ...
    
  • Option 2 is to call API endpoint (which already exists at /api/healthz but is currently faulty) from compose:
    docker-compose.yml:

    healthcheck:
      start_period: 5s
      interval: 30s
      timeout: 10s
      retries: 3
      test: 'wget --no-verbose --tries=1 --spider http://localhost:8000/api/healthz || exit 1'

@6543
Copy link
Member Author

6543 commented Jul 7, 2023

Yes but we cant use wget and need a build in func for tje from-scratch container

@lonix1
Copy link
Contributor

lonix1 commented Jul 8, 2023

next-45319b24cd-alpine is based on alpine which has wget (busybox implementation). Are you going to swap to scratch?

@6543
Copy link
Member Author

6543 commented Jul 8, 2023

but next-45319b24cd is not ... and so if we officially want to support it ... we have to do it that way

@lafriks
Copy link
Contributor

lafriks commented Jul 9, 2023

The best option would be to add a command line option that would call the health check endpoint and return the exit code based on response

@6543
Copy link
Member Author

6543 commented Jul 9, 2023

That's exactly whatvi try to write 😅

@6543 6543 added the good first issue Likely to be an easy fix label Jul 9, 2023
6543 added a commit that referenced this issue Jul 25, 2023
Fixes: #1943

Note: Kubernetes ignores the container `HEALTHCHECK` by default.

---------

Co-authored-by: 6543 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature add new functionality good first issue Likely to be an easy fix server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants