odoo / docker

Other
931 stars 1.51k forks source link

[IMP] Odoo 15.0-17.0: Add support for docker healthcheck. #425

Open amh-mw opened 1 year ago

amh-mw commented 1 year ago

Fixes #115. Utilizes the endpoints added in https://github.com/odoo/odoo/pull/56522.

amh-mw commented 1 year ago

Per the Dockerfile reference ^1,

--interval=DURATION (default: 30s)
--timeout=DURATION (default: 30s)
--start-period=DURATION (default: 0s)
--retries=N (default: 3)

On my local container, Odoo stands up in about eight seconds. This includes some reasonable number of modules already installed, but without --init or --upgrade. The defaults seem fine to me.

oskardotglobal commented 1 year ago

This will fail if either the longpolling port or the longpolling port is changed. Also, longpolling is disabled by default so nothing will listen on 8072 and the healthcheck will fail

amh-mw commented 7 months ago

This will fail if either the longpolling port or the longpolling port is changed.

If the user is savvy enough to change the ports, they can also change the health check.

Also, longpolling is disabled by default so nothing will listen on 8072 and the healthcheck will fail

This is a fair point. I've removed the longpolling/websocket health check.

lathama commented 3 months ago

@amh-mw an idea to maybe get this added would be to add it commented-out so that people can uncomment and build with healthchecks.

I use this pattern for example which allows me to copy and paste among various HTTP based services. Feel free to borrow the idea to remove the piped exit

HEALTHCHECK CMD ["curl", "-sIf", "-o", "/dev/null", "http://localhost:8069/web/static/img/favicon.ico"]
amh-mw commented 3 months ago

@amh-mw an idea to maybe get this added would be to add it commented-out so that people can uncomment and build with healthchecks.

The HEALTHCHECK currently hits the peer-reviewed /web/health endpoint... not really sure what could be better than that.