Skip to content

Add readiness_probe to all service plugins, enabling service dependencies (#2915) - #2917

Open
jefft wants to merge 1 commit into
jetify-com:mainfrom
jefft:jefft/plugin_readiness_probes-fix-2915
Open

Add readiness_probe to all service plugins, enabling service dependencies (#2915)#2917
jefft wants to merge 1 commit into
jetify-com:mainfrom
jefft:jefft/plugin_readiness_probes-fix-2915

Conversation

@jefft

Copy link
Copy Markdown
Contributor

Summary

Adds readiness_probe to mariadb, mysql, redis, valkey (using native CLI
ping commands), and apache, nginx (using http_get probes). PostgreSQL
already had one (pg_isready).

This enables consumers to use condition: process_healthy in their
depends_on configuration, ensuring downstream services do not start
until their dependencies are actually accepting connections.

Fixes (along with #2916) #2915

How was it tested?

First build a devbox with a working #2909 isolated #2906 mariadb plugin (unless those have been merged), plus this PR:

cd /tmp
git clone git@github.com:jetify-com/devbox.git devbox-2915
direnv allow /tmp/devbox-2915
cd devbox-2915
git remote add jefft git@github.com:jefft/devbox.git
git fetch jefft
git checkout -b merge-plugin-fixes main
git merge --no-edit jefft/jefft/nginx-plugin-fix-2908
git merge --no-edit jefft/jefft/mysql-plugin-ignore-etc-mysql
git merge --no-edit jefft/jefft/plugin_readiness_probes-fix-2915
devbox run build

Then to illustrate scripts waiting for their services to come up:

cat > /tmp/testhealth.sh <<'EOF'#!/bin/bash -euif [[ -d /tmp/testhealth ]]; then ( cd /tmp/testhealth && devbox services down >/dev/null 2>&1 || : ) rm -r /tmp/testhealthfimkdir /tmp/testhealthcd /tmp/testhealthcat > devbox.json <<'EOF2'{ "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/main/.schema/devbox.schema.json", "packages": [ "mariadb@latest", "apache@latest", "nginx@latest", "redis@latest", "valkey@latest" ], "env": {  "HTTPD_PORT": "11101", "NGINX_WEB_PORT": "11102", "VALKEY_PORT": "11103" }, "shell": { "init_hook": [ "echo 'Welcome to devbox!' > /dev/null" ], "scripts": { "test": [ "echo \"Error: no test specified\" && exit 1" ] } }}EOF2devbox services ls # create devbox.d/* dirsecho "port = $(( 10000 + RANDOM % 50000))" >> devbox.d/mariadb/my.cnfcat > my_database_using_app <<'EOF2'#!/bin/bash# Connect to MariaDBD via unix socket as root.sudo mariadb --show-warnings -u root --socket "$MYSQL_UNIX_PORT" -e "select 1;"EOF2chmod +x ./my_database_using_appcat > process-compose.yml <<'EOF2'version: "0.5"processes: mariadb_tester: depends_on: mariadb: condition: process_healthy command: ./my_database_using_app apache_tester: depends_on: apache: condition: process_healthy command: curl http://localhost:11101 nginx_tester: depends_on: nginx: condition: process_healthy command: curl http://localhost:11102 valkey_tester: depends_on: valkey: condition: process_healthy command: valkey-cli -p $VALKEY_PORT pingEOF2which devboxdevbox services upEOF# Put our compiled version of devbox ahead of others in PATH
PATH=/tmp/devbox-2915/dist:$PATH bash /tmp/testhealth.sh

The *_tester dependent services now work, coming up (after a delay) as Completed::

jturner@jturner-desktop:/tmp/testhealth$ devbox services ls
Services running in process-compose:
PID NAME NAMESPACE STATUS AGE HEALTH RESTARTS EXIT CODE
1982981 mariadb_logs default Running 5s - 0 0
1982980 redis default Running 5s Ready 0 0
1982983 apache default Running 5s Ready 0 0
1982984 apache-access default Running 5s - 0 0
1983151 mariadb_tester default Completed 0s - 0 0
1983126 apache_tester default Completed 0s - 0 0
1983127 valkey_tester default Completed 0s - 0 0
1982982 nginx default Running 5s Ready 0 0
1982978 nginx-error default Running 5s - 0 0
1982974 nginx-access default Running 5s - 0 0
1982977 valkey default Running 5s Ready 0 0
1982976 apache-error default Running 5s - 0 0
1983125 nginx_tester default Completed 0s - 0 0
1982973 mariadb default Running 5s Ready 0 0
devbox_dependent_services.webm

Community Contribution License

All community contributions in this pull request are licensed to the project
maintainers under the terms of the
Apache 2 License.

By creating this pull request, I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 License as stated in
the
Community Contribution License.

…pendencies (jetify-com#2915)
Adds readiness_probe to mariadb, mysql, redis, valkey (using native CLI
ping commands), and apache, nginx (using http_get probes). PostgreSQL
already had one (pg_isready).
This enables consumers to use `condition: process_healthy` in their
depends_on configuration, ensuring downstream services do not start
until their dependencies are actually accepting connections.
Fixesjetify-com#2915
@jefft
jefftforce-pushed the jefft/plugin_readiness_probes-fix-2915 branch from 33593c1 to 5e4c2dbCompareJuly 16, 2026 06:43
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@jefft