Skip to content

(feature): docker health checks - #12124

Draft
getpwnam wants to merge 5 commits into
inventree:masterfrom
getpwnam:feature/docker-health-checks
Draft

(feature): docker health checks#12124
getpwnam wants to merge 5 commits into
inventree:masterfrom
getpwnam:feature/docker-health-checks

Conversation

@getpwnam

@getpwnam getpwnam commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Add health checks for each container in docker-compose.yml and updated dependencies to require healthy state in each case.

Container Health Check Condition Dependency
inventree-db pg_isready succeeds None
inventree-cache redis-cli ping succeeds None
inventree-server GET to /api/system/health/ returns HTTP 200 inventree-db and inventree-cache must be healthy
inventree-worker is_worker_running() returns True inventree-server must be healthy
inventree-proxy GET to /api/system/health/ with Host: ${INVENTREE_SITE_URL} returns HTTP 200 inventree-server and inventree-worker must be healthy

Tested on my v1.3.3 instance for around 10 days with no problems to report.

Would appreciate some extra testing/validation from a Docker expert.

Refs: #12122
Refs: #12123

@netlify

netlify Bot commented Jun 8, 2026

Copy link
Copy Markdown

Deploy Preview for inventree-web-pui-preview ready!

Name Link
🔨 Latest commit 5aa2f42
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6a4ce5434233ed0008f82481
😎 Deploy Preview https://deploy-preview-12124--inventree-web-pui-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 91 (🔴 down 2 from production)
Accessibility: 82 (no change from production)
Best Practices: 92 (🔴 down 8 from production)
SEO: 78 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@getpwnam getpwnam changed the title Feature/docker health checks (feature): docker health checks Jun 8, 2026
healthcheck:
test:
[
'CMD-SHELL',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should expose an invoke command to determine the health of the background worker process - which could encapsulate the code her potentially

@SchrodingersGat
SchrodingersGat requested a review from matmair June 9, 2026 11:34
@SchrodingersGat SchrodingersGat added docker Docker / docker-compose setup Relates to the InvenTree setup / installation process labels Jun 9, 2026
@SchrodingersGat

Copy link
Copy Markdown
Member

@getpwnam thanks for submitting this, overall it looks pretty reasonable. What are your thoughts about exposing an internal function (e.g. invoke task) for background worker health check? This makes it a bit more general purpose I think.

Also, do you have any tracing or metrics over the 10 day period you have been running this? In particular what load does a 20s interval impose on the setup?

@SchrodingersGat SchrodingersGat added the enhancement This is an suggested enhancement or new feature label Jun 9, 2026
@SchrodingersGat

Copy link
Copy Markdown
Member

Requested Improvements

  • Update the docker documentation to include information about the health checks
  • Add entry to CHANGELOG.md

@SchrodingersGat

Copy link
Copy Markdown
Member

Refer to this PR - #12193 - for a much more efficient health check for the worker task

@SchrodingersGat

Copy link
Copy Markdown
Member

You can now update this to use the following commands:

  • invoke server-health
  • invoke worker-health

Which should be much simpler

@getpwnam

Copy link
Copy Markdown
Contributor Author

Thank you for these @SchrodingersGat - I'll get those running on my instance for a while and PR.

@SchrodingersGat SchrodingersGat added this to the 1.5.0 milestone Jun 24, 2026
@SchrodingersGat

Copy link
Copy Markdown
Member

@getpwnam great, LMK how you go

@br413

br413 commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Hi @getpwnam @SchrodingersGat — I had opened #12419 for #12123 but closed it in favor of this PR.

To help finish the remaining review items here, I have opened a docs/CHANGELOG follow-up:

#12420 — Document Docker Compose container health checks

Changes:

  • docs/docs/start/docker_install.md — new Container Health Checks section (service table, docker compose ps, manual invoke server-health / invoke worker-health)
  • CHANGELOG.md — Unreleased entry referencing this PR

Happy to adjust wording, fold these commits into your branch, or update the docs once the final invoke-based health check commands land here.

@SchrodingersGat

Copy link
Copy Markdown
Member

@getpwnam will you have any time to look into the requested changes?

@SchrodingersGat

Copy link
Copy Markdown
Member

@getpwnam please fix conflicts and use updated commands

@br413

br413 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Hi @getpwnam @SchrodingersGat — following the review feedback to switch to invoke server-health / invoke worker-health, I pushed an updated branch you can cherry-pick or merge:

br413/InvenTree help/12124-healthchecks

Changes vs this PR:

  • inventree-server healthcheck: invoke server-health --address "http://localhost:${INVENTREE_WEB_PORT:-8000}"
  • inventree-worker healthcheck: invoke worker-health (replaces inline Django startup check)
  • Keeps your db/redis/caddy healthchecks and depends_on: condition: service_healthy wiring

Docs/CHANGELOG follow-up is still in #12420 (approved by @SchrodingersGat) — happy to fold that in once this lands, or adjust the docs branch to match whatever you merge here.

@getpwnam — if you'd like, I can open a PR against your feature/docker-health-checks branch instead. Just say the word.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Docker / docker-compose enhancement This is an suggested enhancement or new feature setup Relates to the InvenTree setup / installation process

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants