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

Improved tailscale healthcheck #44

Merged
merged 6 commits into from
Jan 2, 2025
Merged

Conversation

adamsthws
Copy link
Contributor

Improvment To Tailscale Healthcheck

Summary

This change provides a more robust and accurate way to monitor the health of the tailscale service, improving the reliability and observability of the deployment.

This pull request updates the healthcheck configuration to use:

healthcheck:
  test: ["CMD", "wget", "--spider", "-q", "http://127.0.0.1:8080/healthz"]

instead of:

healthcheck:
  test: ["CMD", "tailscale", "status"]

Reasons for the Change

  • Checking 'tailscale status' only verifies that the Tailscale daemon is running, not that the service is functioning correctly or that the service is reachable or working as expected.

  • The new healthcheck ensures that the application or service behind Tailscale is reachable by probing a specific health endpoint (e.g., /healthz), providing a more meaningful validation of the system's operational state.

  • The new method makes use of the HTTP health endpoint that is explicitly designed to signal service health. This endpoint returns 200 OK if the node has at least one Tailnet IP address assigned, otherwise, it returns 503. This provides a direct indication of the node's connectivity to the Tailnet.

Updated tailscale healthcheck to be more robust
@adamsthws
Copy link
Contributor Author

adamsthws commented Dec 29, 2024

Hello,
Should you choose to accept this PR for the Pi-Hole service, I'd be happy to make subsequent updates to the other services in this repo too.
Thanks, Adam

@crypt0rr crypt0rr added the enhancement New feature or request label Dec 30, 2024
@crypt0rr crypt0rr self-requested a review December 30, 2024 13:11
Copy link
Member

@crypt0rr crypt0rr left a comment

Choose a reason for hiding this comment

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

Please see comments.

services/pihole/docker-compose.yml Outdated Show resolved Hide resolved
services/pihole/docker-compose.yml Outdated Show resolved Hide resolved
@crypt0rr
Copy link
Member

For reference: https://tailscale.com/kb/1282/docker#ts_healthcheck_addr_port / This functionality is available in Tailscale 1.78 and later.

@crypt0rr
Copy link
Member

Hello, Should you choose to accept this PR for the Pi-Hole service, I'd be happy to make subsequent updates to the other services in this repo too. Thanks, Adam

Thanks for the PR. Please check comments/suggestions and subsequent update the other services, thanks!

Updated tailscale healthcheck port to reduce the chance of it clashing with another service
This is deprecated:
```TS_HEALTHCHECK_ADDR_PORT```

From v1.78, use instead: ```TS_ENABLE_HEALTH_CHECK```
```TS_LOCAL_ADDR_PORT```

See here for reference:
https://tailscale.com/kb/1282/docker#ts_healthcheck_addr_port
@adamsthws
Copy link
Contributor Author

adamsthws commented Dec 31, 2024

This is recently deprecated:
TS_HEALTHCHECK_ADDR_PORT

From v1.78, use instead:
TS_ENABLE_HEALTH_CHECK
TS_LOCAL_ADDR_PORT

As the services in this repo are using the 'latest' tailscale image tag, it's best to make use the new method.
(At the time of writing, 'latest' is v1.78.3).

See here for reference:
https://tailscale.com/kb/1282/docker#ts_healthcheck_addr_port

Thanks

@crypt0rr
Copy link
Member

This is recently deprecated: TS_HEALTHCHECK_ADDR_PORT

From v1.78, use instead: TS_ENABLE_HEALTH_CHECK TS_LOCAL_ADDR_PORT

As the services in this repo are using the 'latest' tailscale image tag, it's best to make use the new method. (At the time of writing, 'latest' is v1.78.3).

See here for reference: https://tailscale.com/kb/1282/docker#ts_healthcheck_addr_port

Thanks

Looks good! If you could update the rest of the services, please 🚀

@adamsthws
Copy link
Contributor Author

This is recently deprecated: TS_HEALTHCHECK_ADDR_PORT
From v1.78, use instead: TS_ENABLE_HEALTH_CHECK TS_LOCAL_ADDR_PORT
As the services in this repo are using the 'latest' tailscale image tag, it's best to make use the new method. (At the time of writing, 'latest' is v1.78.3).
See here for reference: https://tailscale.com/kb/1282/docker#ts_healthcheck_addr_port
Thanks

Looks good! If you could update the rest of the services, please 🚀

All done :)

@crypt0rr crypt0rr self-requested a review January 2, 2025 06:01
Copy link
Member

@crypt0rr crypt0rr left a comment

Choose a reason for hiding this comment

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

Thanks @adamsthws 🚀

@crypt0rr crypt0rr merged commit 4249707 into 2Tiny2Scale:main Jan 2, 2025
1 check passed
@jackspiering
Copy link
Member

Thank you very much @adamsthws!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants