Skip to main content

Watchtower smart home integration, free and open source

Watchtower integration for Gladys Assistant

Follow Watchtower container updates and start them from Gladys.

Follow the container updates made by Watchtower and start them from Gladys: how many containers were checked, updated or failed at the last scan, scenes when a scan ends or when Watchtower goes offline, and an "Update now" button on the dashboard.

The integration talks to Watchtower over your local network only, through its HTTP API. Nothing goes through the Internet.

Prepare Watchtower​

Watchtower must expose its HTTP API. Add these variables to the Watchtower container and publish its port 8080:

VariableValueWhy
WATCHTOWER_HTTP_API_METRICStruethe figures read by Gladys (/v1/metrics)
WATCHTOWER_HTTP_API_UPDATEtruethe updates started from Gladys (/v1/update)
WATCHTOWER_HTTP_API_TOKENa long random tokenprotects the API: Gladys sends it with every request
WATCHTOWER_HTTP_API_PERIODIC_POLLStruekeeps the scheduled checks: without it, the update API disables them

For example, the Watchtower that updates Gladys itself becomes:

docker run -d \
--name watchtower \
--restart=always \
-p 8080:8080 \
-e WATCHTOWER_HTTP_API_METRICS=true \
-e WATCHTOWER_HTTP_API_UPDATE=true \
-e WATCHTOWER_HTTP_API_PERIODIC_POLLS=true \
-e WATCHTOWER_HTTP_API_TOKEN=replace-with-a-long-random-token \
-v /var/run/docker.sock:/var/run/docker.sock \
containrrr/watchtower --cleanup --include-restarting

Generate the token with openssl rand -hex 32, for instance. Keep port 8080 on your local network: anyone holding the token can start updates.

Installation​

  1. In Gladys, open Integrations, then the external integrations store.
  2. Search for Watchtower and click Install.
  3. Wait for the container to start: the integration shows up in the list.

Configuration​

Open the Configuration tab of the integration:

  • Watchtower address: the address of the machine running Watchtower, with the port, e.g. http://192.168.1.10:8080. Use the network address of the machine, not localhost: the integration runs in its own container.
  • API token: the value of WATCHTOWER_HTTP_API_TOKEN.
  • Refresh interval: how often the figures are read, in seconds (5 minutes by default, 1 minute minimum).

Save, then click Test the connection: the message shows the containers checked at the last scan, or what is wrong (address, token, API disabled). The Update containers now button starts an update right away, for every container or only the images you list (nginx, redis). It waits up to 100 seconds for Watchtower; a longer update goes on in the background.

Device​

In Discover, add the Watchtower device. Its features follow the figures of Watchtower, with history:

  • containers checked, updated and failed at the last scan;
  • scans since Watchtower started, and scans skipped (a scan was still running).

Scenes and dashboards​

Scene triggers

  • Watchtower scan completed: Watchtower finished checking the containers. Filter on the result (nothing to update, containers updated, some updates failed). Variables: result, containers checked, updated and failed. Example: send a message when an update failed.
  • Watchtower online / offline: Watchtower stopped answering, or answers again. Filter on the status. Variables: status and, when offline, the reason (unreachable, unauthorized, timeout...).

Scene actions

  • Update containers: asks Watchtower to update now, every container or the listed images. Outputs: update finished (yes/no: no when Watchtower is still busy after 100 seconds), containers checked, updated and failed. The scan started by a scene does not fire the "scan completed" trigger, so a scene cannot loop.
  • Read the Watchtower status: reads the figures now for the next actions of the scene. Outputs: Watchtower online, containers checked, updated and failed at the last scan, scans since start.

Dashboard widget

The Watchtower widget shows the figures of the last scan, the connection, the result of the last scan, the scan counters, and an Update now button (with a confirmation).

Good to know​

  • Watchtower only gives the figures of its last scan, not the names of the containers. When several scans happen between two readings, Gladys sees the last one.
  • When Watchtower restarts, its counters start again from zero: no event is fired for that.
  • Watchtower runs one update at a time: an update of every container asked while another one is running is skipped by Watchtower.

Help​

A question or a problem? Ask on the Gladys community forum or open an issue on the GitHub repository.

Configuration settings​

These are the settings Watchtower asks for in its configuration screen in Gladys.

SettingTypeRequiredDescription
Enable the Watchtower HTTP APIsectionNoStart Watchtower with WATCHTOWER_HTTP_API_METRICS=true, WATCHTOWER_HTTP_API_UPDATE=true, WATCHTOWER_HTTP_API_TOKEN=<a long random token> and WATCHTOWER_HTTP_API_PERIODIC_POLLS=true (keeps its scheduled checks), and publish its port 8080. Then enter its address and token below.
Watchtower addressstringYesAddress of the Watchtower HTTP API on your network, port included.
API tokensecretYesThe value of WATCHTOWER_HTTP_API_TOKEN.
Refresh interval (s)numberNoHow often the Watchtower figures are read, in seconds (one minute minimum).

How to install Watchtower in Gladys​

  1. In Gladys, open Integrations: Watchtower appears in the catalog, next to the native integrations, with a community badge.
  2. Click Install. Gladys pulls the Docker image (ghcr.io/prohand/gladys-watchtower:1.1.0), starts it in a sandbox isolated from the core, and generates the integration's interface (devices, discovery and configuration).
  3. Open the Configuration screen of the integration, fill in the settings, and save.
  4. You can also install it directly from its repository URL: https://github.com/prohand/gladys-watchtower.

Watchtower requires Gladys >=5.1.0. The catalog inside Gladys refreshes every hour, so a new version becomes available at most one hour after its release.

Not running Gladys yet? It is free and open source: follow the installation guide to get started.

About external integrations​

Watchtower is an external integration: a community integration packaged as a Docker container and published on GitHub, that Gladys installs in one click and runs in a sandbox isolated from its core. It is published and maintained by prohand, not by the Gladys core team.

Subscribe to the Gladys Assistant newsletter

A few emails per month about new releases and project news. Sent by Pierre-Gilles Leymarie, founder of the project. Unsubscribe anytime 🙂