-
Notifications
You must be signed in to change notification settings - Fork 885
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: nils måsén <[email protected]> Co-authored-by: MihailITPlace <[email protected]> Co-authored-by: Sebastiaan Tammer <[email protected]>
- Loading branch information
1 parent
35490c8
commit d7d5b25
Showing
23 changed files
with
812 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
version: '3.7' | ||
|
||
services: | ||
watchtower: | ||
container_name: watchtower | ||
build: | ||
context: ./ | ||
dockerfile: dockerfiles/Dockerfile.dev-self-contained | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock:ro | ||
ports: | ||
- 8080:8080 | ||
command: --interval 10 --http-api-metrics --http-api-token demotoken --debug prometheus grafana parent child | ||
prometheus: | ||
container_name: prometheus | ||
image: prom/prometheus | ||
volumes: | ||
- ./prometheus/:/etc/prometheus/ | ||
- prometheus:/prometheus/ | ||
ports: | ||
- 9090:9090 | ||
grafana: | ||
container_name: grafana | ||
image: grafana/grafana | ||
ports: | ||
- 3000:3000 | ||
environment: | ||
GF_INSTALL_PLUGINS: grafana-clock-panel,grafana-simple-json-datasource | ||
volumes: | ||
- grafana:/var/lib/grafana | ||
- ./grafana:/etc/grafana/provisioning | ||
parent: | ||
image: nginx | ||
container_name: parent | ||
child: | ||
image: nginx:alpine | ||
labels: | ||
com.centurylinklabs.watchtower.depends-on: parent | ||
container_name: child | ||
|
||
volumes: | ||
prometheus: {} | ||
grafana: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,7 +164,7 @@ Environment Variable: WATCHTOWER_LABEL_ENABLE | |
## Without updating containers | ||
Will only monitor for new images, send notifications and invoke the [pre-check/post-check hooks](https://containrrr.dev/watchtower/lifecycle-hooks/), but will **not** update the containers. | ||
|
||
> ### ⚠️ Please note | ||
> **⚠️ Please note** | ||
> | ||
> Due to Docker API limitations the latest image will still be pulled from the registry. | ||
|
@@ -238,9 +238,7 @@ Sets an authentication token to HTTP API requests. | |
Environment Variable: WATCHTOWER_HTTP_API_TOKEN | ||
Type: String | ||
Default: - | ||
``` | ||
|
||
## Filter by scope | ||
```## Filter by scope | ||
Update containers that have a `com.centurylinklabs.watchtower.scope` label set with the same value as the given argument. This enables [running multiple instances](https://containrrr.github.io/watchtower/running-multiple-instances). | ||
``` | ||
|
@@ -250,6 +248,16 @@ Environment Variable: WATCHTOWER_SCOPE | |
Default: - | ||
``` | ||
## HTTP API Metrics | ||
Enables a metrics endpoint, exposing prometheus metrics via HTTP. See [Metrics](metrics.md) for details. | ||
``` | ||
Argument: --http-api-metrics | ||
Environment Variable: WATCHTOWER_HTTP_API_METRICS | ||
Type: Boolean | ||
Default: false | ||
``` | ||
## Scheduling | ||
[Cron expression](https://pkg.go.dev/github.com/robfig/[email protected]?tab=doc#hdr-CRON_Expression_Format) in 6 fields (rather than the traditional 5) which defines when and how often to check for new images. Either `--interval` or the schedule expression | ||
can be defined, but not both. An example: `--schedule "0 0 4 * * *"` | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
> **⚠️ Experimental feature** | ||
> | ||
> This feature was added in v1.0.4 and is still considered experimental. | ||
> If you notice any strange behavior, please raise a ticket in the repository issues. | ||
Metrics can be used to track how Watchtower behaves over time. | ||
|
||
To use this feature, you have to set an [API token](arguments.md#http-api-token) and [enable the metrics API](arguments.md#http-api-metrics), | ||
as well as creating a port mapping for your container for port `8080`. | ||
|
||
## Available Metrics | ||
|
||
| Name | Type | Description | | ||
| ------------------------------- | ------- | --------------------------------------------------------------------------- | | ||
| `watchtower_containers_scanned` | Gauge | Number of containers scanned for changes by watchtower during the last scan | | ||
| `watchtower_containers_updated` | Gauge | Number of containers updated by watchtower during the last scan | | ||
| `watchtower_containers_failed` | Gauge | Number of containers where update failed during the last scan | | ||
| `watchtower_scans_total` | Counter | Number of scans since the watchtower started | | ||
| `watchtower_scans_skipped` | Counter | Number of skipped scans since watchtower started | | ||
|
||
## Demo | ||
|
||
The repository contains a demo with prometheus and grafana, available through `docker-compose.yml`. This demo | ||
is preconfigured with a dashboard, which will look something like this: | ||
|
||
![grafana metrics](assets/grafana-dashboard.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
# Notifications | ||
|
||
Watchtower can send notifications when containers are updated. Notifications are sent via hooks in the logging system, [logrus](http://github.com/sirupsen/logrus). | ||
|
@@ -12,14 +11,14 @@ The types of notifications to send are set by passing a comma-separated list of | |
|
||
> There is currently a [bug](https://github.com/spf13/viper/issues/380) in Viper, which prevents comma-separated slices to be used when using the environment variable. A workaround is available where we instead put quotes around the environment variable value and replace the commas with spaces, as `WATCHTOWER_NOTIFICATIONS="slack msteams"` | ||
> If you're a `docker-compose` user, make sure to specify environment variables' values in your `.yml` file without double quotes (`"`). | ||
> If you're a `docker-compose` user, make sure to specify environment variables' values in your `.yml` file without double quotes (`"`). | ||
> | ||
> This prevents unexpected errors when watchtower starts. | ||
## Settings | ||
|
||
- `--notifications-level` (env. `WATCHTOWER_NOTIFICATIONS_LEVEL`): Controls the log level which is used for the notifications. If omitted, the default log level is `info`. Possible values are: `panic`, `fatal`, `error`, `warn`, `info`, `debug` or `trace`. | ||
- Watchtower will post a notification every time it is started. This behavior [can be changed](https://containrrr.github.io/watchtower/arguments/#without_sending_a_startup_message) with an argument. | ||
- Watchtower will post a notification every time it is started. This behavior [can be changed](https://containrrr.github.io/watchtower/arguments/#without_sending_a_startup_message) with an argument. | ||
|
||
## Available services | ||
|
||
|
@@ -47,7 +46,7 @@ docker run -d \ | |
-e [email protected] \ | ||
-e [email protected] \ | ||
-e WATCHTOWER_NOTIFICATION_EMAIL_SERVER=smtp.gmail.com \ | ||
-e WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PORT=587 \ | ||
-e WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PORT=587 \ | ||
-e [email protected] \ | ||
-e WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD=app_password \ | ||
-e WATCHTOWER_NOTIFICATION_EMAIL_DELAY=2 \ | ||
|
@@ -56,19 +55,19 @@ docker run -d \ | |
|
||
The previous example assumes, that you already have an SMTP server up and running you can connect to. If you don't or you want to bring up watchtower with your own simple SMTP relay the following `docker-compose.yml` might be a good start for you. | ||
|
||
The following example assumes, that your domain is called `your-domain.com` and that you are going to use a certificate valid for `smtp.your-domain.com`. This hostname has to be used as `WATCHTOWER_NOTIFICATION_EMAIL_SERVER` otherwise the TLS connection is going to fail with `Failed to send notification email` or `connect: connection refused`. We also have to add a network for this setup in order to add an alias to it. If you also want to enable DKIM or other features on the SMTP server, you will find more information at [freinet/postfix-relay](https://hub.docker.com/r/freinet/postfix-relay). | ||
The following example assumes, that your domain is called `your-domain.com` and that you are going to use a certificate valid for `smtp.your-domain.com`. This hostname has to be used as `WATCHTOWER_NOTIFICATION_EMAIL_SERVER` otherwise the TLS connection is going to fail with `Failed to send notification email` or `connect: connection refused`. We also have to add a network for this setup in order to add an alias to it. If you also want to enable DKIM or other features on the SMTP server, you will find more information at [freinet/postfix-relay](https://hub.docker.com/r/freinet/postfix-relay). | ||
|
||
Example including an SMTP relay: | ||
|
||
```yaml | ||
--- | ||
version: "3.8" | ||
version: '3.8' | ||
services: | ||
watchtower: | ||
image: containrrr/watchtower:latest | ||
container_name: watchtower | ||
environment: | ||
WATCHTOWER_MONITOR_ONLY: "true" | ||
WATCHTOWER_MONITOR_ONLY: 'true' | ||
WATCHTOWER_NOTIFICATIONS: email | ||
WATCHTOWER_NOTIFICATION_EMAIL_FROM: [email protected] | ||
WATCHTOWER_NOTIFICATION_EMAIL_TO: [email protected] | ||
|
@@ -90,9 +89,9 @@ services: | |
- 25 | ||
environment: | ||
MAILNAME: somename.your-domain.com | ||
TLS_KEY: "/etc/ssl/domains/your-domain.com/your-domain.com.key" | ||
TLS_CRT: "/etc/ssl/domains/your-domain.com/your-domain.com.crt" | ||
TLS_CA: "/etc/ssl/domains/your-domain.com/intermediate.crt" | ||
TLS_KEY: '/etc/ssl/domains/your-domain.com/your-domain.com.key' | ||
TLS_CRT: '/etc/ssl/domains/your-domain.com/your-domain.com.crt' | ||
TLS_CA: '/etc/ssl/domains/your-domain.com/intermediate.crt' | ||
volumes: | ||
- /etc/ssl/domains/your-domain.com/:/etc/ssl/domains/your-domain.com/:ro | ||
networks: | ||
|
@@ -172,7 +171,7 @@ docker run -d \ | |
|
||
`-e WATCHTOWER_NOTIFICATION_GOTIFY_TOKEN` or `--notification-gotify-token` can also reference a file, in which case the contents of the file are used. | ||
|
||
If you want to disable TLS verification for the Gotify instance, you can use either `-e WATCHTOWER_NOTIFICATION_GOTIFY_TLS_SKIP_VERIFY=true` or `--notification-gotify-tls-skip-verify`. | ||
If you want to disable TLS verification for the Gotify instance, you can use either `-e WATCHTOWER_NOTIFICATION_GOTIFY_TLS_SKIP_VERIFY=true` or `--notification-gotify-tls-skip-verify`. | ||
|
||
### [containrrr/shoutrrr](https://github.com/containrrr/shoutrrr) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.