imagegenius / docker-esphome

Minimal ESPHome Alpine Docker Container
GNU General Public License v3.0
7 stars 1 forks source link

helathcheck #4

Closed tamimology closed 2 years ago

tamimology commented 2 years ago

just wondering if the container has a healthcheck or not and how to do that?

In my compose. I used

    healthcheck:
      test: curl -fSs http://127.0.0.1:6052 || exit 1
      start_period: 90s
      timeout: 10s
      interval: 5s
      retries: 3

and I go the following

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Dashboard - ESPHome</title> <link rel="shortcut icon" href="./static/images/favicon.ico?hash=2655a073" /> <link rel="stylesheet" href="./static/fonts/material-icons/material-icons.css?hash=ead4c276" /> <link rel="preload" href="./static/fonts/material-icons/MaterialIcons-Regular.woff2?hash=570eb838" as="font" crossorigin="anonymous" /> <link rel="stylesheet" href="./static/css/vendor/materialize/materialize.min.css?hash=ec1df3ba" /> <link rel="stylesheet" href="./static/css/esphome-2.css?hash=b79b4733" /> </head> <body> <main> <esphome-devices-list></esphome-devices-list> <esphome-fab></esphome-fab> </main> <div class="esphome-header"> <img src="https://esphome.io/_static/logo-text.svg" alt="ESPHome Logo" /> <div class="flex"></div> <esphome-header-menu logout-url="" ></esphome-header-menu> </div> <footer class="page-footer grey darken-4"> <div class="container"> <div class="left"> ESPHome by Nabu Casa | <a href="https://esphome.io/guides/supporters.html" target="_blank" >Fund development</a > | <a href="https://www.esphome.io/" target="_blank" rel="noreferrer" >v2022.8.3 Documentation</a > </div> </div> </footer> <script src="./static/js/vendor/jquery/jquery.min.js?hash=12108007"></script> <script src="./static/js/vendor/jquery-ui/jquery-ui.min.js?hash=cab3392d"></script> <script src="./static/js/vendor/jquery-validate/jquery.validate.min.js?hash=aad785d4"></script> <script src="./static/js/vendor/materialize/materialize.min.js?hash=4be20daf"></script> <script src="./static/js/vendor/ace/ace.js?hash=65322f49" type="text/javascript" charset="utf-8" ></script> <script src="./static/js/esphome/index-54a243cf.js" type="module" ></script> <div id="js-editor-modal" class="modal modal-fixed-footer no-autoinit"> <div class="modal-content"> <h4 id="js-node-filename"></h4> <div id="js-loading-indicator"> <div class="preloader-wrapper big active"> <div class="spinner-layer spinner-blue-only"> <div class="circle-clipper left"> <div class="circle"></div> </div> <div class="gap-patch"> <div class="circle"></div> </div> <div class="circle-clipper right"> <div class="circle"></div> </div> </div> </div> </div> <div id="js-editor-area" class="editor"></div> </div> <div class="modal-footer"> <mwc-button label="Save" data-action="save"></mwc-button> <mwc-button class="modal-close" label="Install" data-action="upload" ></mwc-button> <mwc-button class="modal-close" label="Close" data-action="close" ></mwc-button> </div> </div> </body> </html>

hydazz commented 2 years ago

Using a curl health check on the esphome dashboard is pointless, the dashboard is a separate component, the webui will always operate whether compiling works or not. what is your need for a healthcheck?

you could possible set a healthcheck to occasionally compile one of your devices.

create a new device in esphome. remove all the components to speed up compiling. copy the yaml:

esphome:
  name: healthcheck

esp8266:
  board: esp01_1m

then you can use esphome compile /config/healthcheck.yaml which will compile and spit out an exit code 0 or 1 for docker to say whether everything is good

hydazz commented 2 years ago

assuming you're all good on this