Docker healthchecks #171

Closed
opened 2025-11-20 09:36:01 -06:00 by jellgrum · 3 comments
jellgrum commented 2025-11-20 09:36:01 -06:00 (Migrated from github.com)

Describe your idea for an enhancement:

It would be great if there was a way to use healthcheck in Docker compose for both the service itself and the database (for Postgres DB). And then update the documentation with this setting.

Describe alternatives you've considered:

No alternatives.

Additional context:

I'm checking the status of containers in Beszel. I tried adding this code for VoidAuth, but the status is displayed as "Unhealthy":

healthcheck:
  test: [
    "CMD",
    "node -e 'fetch(process.env.APP_URL).then(res => process.exit(res.status === 200 ? 0 : 1)).catch(err => process.exit(1))'"
  ]
  start_period: 5s
  interval: 10s
  timeout: 10s
  retries: 2

I also noticed that if connect to the container via shell (sh), can ping the service. Although this didn't work either.

### Describe your idea for an enhancement: It would be great if there was a way to use healthcheck in Docker compose for both the service itself and the database (for Postgres DB). And then update the documentation with this setting. ### Describe alternatives you've considered: No alternatives. ### Additional context: I'm checking the status of containers in [Beszel](https://github.com/henrygd/beszel). I tried adding this code for VoidAuth, but the status is displayed as "Unhealthy": ```yaml healthcheck: test: [ "CMD", "node -e 'fetch(process.env.APP_URL).then(res => process.exit(res.status === 200 ? 0 : 1)).catch(err => process.exit(1))'" ] start_period: 5s interval: 10s timeout: 10s retries: 2 ``` I also noticed that if connect to the container via shell (sh), can ping the service. Although this didn't work either.
jellgrum commented 2025-11-20 09:51:47 -06:00 (Migrated from github.com)

Oops, it turns out I messed up the command call for the test. That's how it worked:

healthcheck:
  test: "node -e 'fetch(process.env.APP_URL).then(res => process.exit(res.status === 200 ? 0 : 1)).catch(err => process.exit(1))'"
  start_period: 5s
  interval: 10s
  timeout: 10s
  retries: 2

However, perhaps you can come up with a more concise solution? And for the database too.

Oops, it turns out I messed up the command call for the test. That's how it worked: ```yaml healthcheck: test: "node -e 'fetch(process.env.APP_URL).then(res => process.exit(res.status === 200 ? 0 : 1)).catch(err => process.exit(1))'" start_period: 5s interval: 10s timeout: 10s retries: 2 ``` However, perhaps you can come up with a more concise solution? And for the database too.
notquitenothing commented 2025-11-20 20:08:46 -06:00 (Migrated from github.com)

This is a great idea! I will add a modified version of this to the Docker image file so it will be automatic 😊

This is a great idea! I will add a modified version of this to the Docker image file so it will be automatic 😊
notquitenothing commented 2025-11-30 14:30:12 -06:00 (Migrated from github.com)

This has been implemented in the latest release v1.5.0. Please let me know if you run into any issues with the implementation

This has been implemented in the latest release [v1.5.0](https://github.com/voidauth/voidauth/releases/tag/v1.5.0). Please let me know if you run into any issues with the implementation
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
adam/gate#171
No description provided.