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 readiness check for memcached #642

Merged
merged 2 commits into from
Jun 5, 2023

Conversation

penguincoder
Copy link
Contributor

This adds a simple bash-based readiness check. It will fail if the server is faulted for whatever reason. I chose bash over nc because it is fairly prevalent throughout all of nixpkgs and you are likely to have it already loaded in your store.

process-compose = {
readiness_probe = {
exec.command = ''
${pkgs.bash}/bin/bash -c 'exec 3<>/dev/tcp/${cfg.bind}/${toString cfg.port}; printf "stats\nquit\n" >&3; cat <&3'
Copy link
Contributor

Choose a reason for hiding this comment

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

On *nix-es process-compose already executes the commands via bash, so no need for the extra process.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I didn't realize that. While I was at it, I added memcached to the process-compose example so that it's available to see the readiness probe.

@domenkozar domenkozar merged commit 92ae356 into cachix:main Jun 5, 2023
95 checks passed
@penguincoder penguincoder deleted the memcached-readiness-check branch June 7, 2023 14:02
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.

None yet

3 participants