Skip to content

Commit

Permalink
Add a readiness_probe for postgresql (#2094)
Browse files Browse the repository at this point in the history
## Summary

This PR adds the following `readiness_probe` to the `postgresql` plugin:

```yaml
    readiness_probe:
      exec:
        command: "pg_isready"
```

With that change, Devbox users have the ability to create their own
processes that depend on a healthy postgresql service. For example, to
seed a database, one can add the following to a `process-compose.yml`:

```yaml
version: "0.5"
processes:
  seed_db:
    command: |
      npm run db:seed # for example
    depends_on:
      postgresql:
        condition: process_healthy
```

## How was it tested?

In a project with the above `process-compose.yml` file and the changes
in this PR applied to `.devbox/virtenv/postgresql/process-compose.yml`

Signed-off-by: @mootoday <154029656+mootoday@users.noreply.github.com>
  • Loading branch information
mootoday authored May 29, 2024
1 parent fac4117 commit ff6826d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plugins/postgresql/process-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ processes:
shutdown:
command: "pg_ctl stop -m fast"
availability:
restart: "always"
restart: "always"
readiness_probe:
exec:
command: "pg_isready"

0 comments on commit ff6826d

Please sign in to comment.