mirror of
https://github.com/containrrr/watchtower.git
synced 2026-01-31 12:55:17 +01:00
Merge branch 'containrrr:main' into add-log-file-support
This commit is contained in:
commit
9c8dfec947
22 changed files with 251 additions and 543 deletions
|
|
@ -58,6 +58,7 @@ If instead you want to [only include containers with the enable label](https://c
|
|||
If you wish to create a monitoring scope, you will need to [run multiple instances and set a scope for each of them](https://containrrr.github.io/watchtower/running-multiple-instances).
|
||||
|
||||
Watchtower filters running containers by testing them against each configured criteria. A container is monitored if all criteria are met. For example:
|
||||
|
||||
- If a container's name is on the monitoring name list (not empty `--name` argument) but it is not enabled (_centurylinklabs.watchtower.enable=false_), it won't be monitored;
|
||||
- If a container's name is not on the monitoring name list (not empty `--name` argument), even if it is enabled (_centurylinklabs.watchtower.enable=true_ and `--label-enable` flag is set), it won't be monitored;
|
||||
|
||||
|
|
|
|||
|
|
@ -35,3 +35,11 @@ Notice that there is an environment variable named WATCHTOWER_HTTP_API_TOKEN. To
|
|||
```bash
|
||||
curl -H "Authorization: Bearer mytoken" localhost:8080/v1/update
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
In order to update only certain images, the image names can be provided as URL query parameters. The following `curl` command would trigger an update for the images `foo/bar` and `foo/baz`:
|
||||
|
||||
```bash
|
||||
curl -H "Authorization: Bearer mytoken" localhost:8080/v1/update?image=foo/bar,foo/baz
|
||||
```
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ system, [logrus](http://github.com/sirupsen/logrus).
|
|||
- `--notification-skip-title` (env. `WATCHTOWER_NOTIFICATION_SKIP_TITLE`): Do not pass the title param to notifications. This will not pass a dynamic title override to notification services. If no title is configured for the service, it will remove the title all together.
|
||||
- `--notification-log-stdout` (env. `WATCHTOWER_NOTIFICATION_LOG_STDOUT`): Enable output from `logger://` shoutrrr service to stdout.
|
||||
|
||||
## [shoutrrr](https://github.com/containrrr/shoutrrr) notifications
|
||||
## [Shoutrrr](https://github.com/containrrr/shoutrrr) notifications
|
||||
|
||||
To send notifications via shoutrrr, the following command-line options, or their corresponding environment variables, can be set:
|
||||
|
||||
|
|
@ -57,6 +57,10 @@ outputs timestamp and log level.
|
|||
custom format.
|
||||
i.e., The day of the year has to be 1, the month has to be 2 (february), the hour 3 (or 15 for 24h time) etc.
|
||||
|
||||
!!! note "Skipping notifications"
|
||||
To skip sending notifications that do not contain any information, you can wrap your template with `{{if .}}` and `{{end}}`.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ in a volume that may be mounted onto your watchtower container.
|
|||
|
||||
1. Create the Dockerfile (contents below):
|
||||
```Dockerfile
|
||||
FROM golang:1.17
|
||||
FROM golang:1.20
|
||||
|
||||
ENV GO111MODULE off
|
||||
ENV CGO_ENABLED 0
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
}
|
||||
#tplprev button {
|
||||
border-radius: 0.1rem;
|
||||
color: var(--md-typeset-color);
|
||||
color: var(--md-primary-bg-color);
|
||||
background-color: var(--md-primary-fg-color);
|
||||
flex:1;
|
||||
min-width: 12ch;
|
||||
|
|
@ -78,6 +78,8 @@
|
|||
flex:1;
|
||||
width:100%
|
||||
}
|
||||
#result b {color: var(--md-code-hl-special-color)}
|
||||
#result i {color: var(--md-code-hl-keyword-color)}
|
||||
#tplprev .loading {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
|
|
@ -90,12 +92,14 @@
|
|||
</style>
|
||||
<script src="../assets/wasm_exec.js"></script>
|
||||
<script>
|
||||
let wasmLoaded = false;
|
||||
const updatePreview = () => {
|
||||
if (!wasmLoaded) return;
|
||||
const form = document.querySelector('#tplprev');
|
||||
const input = form.template.value;
|
||||
console.log('Input: %o', input);
|
||||
const arrFromCount = (key) => Array.from(Array(form[key]?.valueAsNumber ?? 0), () => key);
|
||||
const states = form.enablereport.checked ? [
|
||||
const states = form.report.value === "yes" ? [
|
||||
...arrFromCount("skipped"),
|
||||
...arrFromCount("scanned"),
|
||||
...arrFromCount("updated"),
|
||||
|
|
@ -104,7 +108,7 @@
|
|||
...arrFromCount("stale" ),
|
||||
] : [];
|
||||
console.log("States: %o", states);
|
||||
const levels = form.enablelog.checked ? [
|
||||
const levels = form.log.value === "yes" ? [
|
||||
...arrFromCount("error"),
|
||||
...arrFromCount("warning"),
|
||||
...arrFromCount("info"),
|
||||
|
|
@ -113,15 +117,17 @@
|
|||
console.log("Levels: %o", levels);
|
||||
const output = WATCHTOWER.tplprev(input, states, levels);
|
||||
console.log('Output: \n%o', output);
|
||||
if (output.length) {
|
||||
if (output.startsWith('Error: ')) {
|
||||
document.querySelector('#result').innerHTML = `<b>Error</b>: ${output.substring(7)}`;
|
||||
} else if (output.length) {
|
||||
document.querySelector('#result').innerText = output;
|
||||
} else {
|
||||
document.querySelector('#result').innerHTML = '<i>empty (would not be sent as a notification)</i>';
|
||||
}
|
||||
}
|
||||
const formSubmitted = (e) => {
|
||||
e.preventDefault();
|
||||
updatePreview();
|
||||
//e.preventDefault();
|
||||
//updatePreview();
|
||||
}
|
||||
let debounce;
|
||||
const inputUpdated = () => {
|
||||
|
|
@ -130,18 +136,24 @@
|
|||
}
|
||||
const formChanged = (e) => {
|
||||
console.log('form changed: %o', e);
|
||||
const targetToggle = e.target.dataset['toggle'];
|
||||
if (targetToggle) {
|
||||
e.target.form[targetToggle].value = e.target.checked ? "yes" : "no";
|
||||
}
|
||||
updatePreview()
|
||||
}
|
||||
const go = new Go();
|
||||
WebAssembly.instantiateStreaming(fetch("../assets/tplprev.wasm"), go.importObject).then((result) => {
|
||||
document.querySelector('#tplprev .loading').style.display = "none";
|
||||
go.run(result.instance);
|
||||
document.querySelector('#tplprev .loading').style.display = "none";
|
||||
wasmLoaded = true;
|
||||
updatePreview();
|
||||
});
|
||||
</script>
|
||||
<form id="tplprev" onchange="updatePreview()" onsubmit="formSubmitted(event)">
|
||||
<form id="tplprev" onchange="formChanged(event)" onsubmit="formSubmitted(event)">
|
||||
<pre class="loading">loading wasm...</pre>
|
||||
<div class="template-wrapper">
|
||||
<textarea name="template" type="text" style="flex: 1" onkeyup="inputUpdated()">{{- with .Report -}}
|
||||
<textarea name="template" type="text" onkeyup="inputUpdated()">{{- with .Report -}}
|
||||
{{- if ( or .Updated .Failed ) -}}
|
||||
{{len .Scanned}} Scanned, {{len .Updated}} Updated, {{len .Failed}} Failed
|
||||
{{- range .Updated}}
|
||||
|
|
@ -166,7 +178,8 @@ Logs:
|
|||
</div>
|
||||
<div class="controls">
|
||||
<fieldset>
|
||||
<legend><label><input type="checkbox" name="enablereport" checked /> Container report</label></legend>
|
||||
<input type="hidden" name="report" value="yes" />
|
||||
<legend><label><input type="checkbox" data-toggle="report" checked /> Container report</label></legend>
|
||||
<label class="numfield">
|
||||
Skipped:
|
||||
<input type="number" name="skipped" value="3" />
|
||||
|
|
@ -193,7 +206,8 @@ Logs:
|
|||
</label>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><label><input type="checkbox" name="enablelog" checked /> Log entries</label></legend>
|
||||
<input type="hidden" name="log" value="yes" />
|
||||
<legend><label><input type="checkbox" data-toggle="log" checked /> Log entries</label></legend>
|
||||
<label class="numfield">
|
||||
Error:
|
||||
<input type="number" name="error" value="1" />
|
||||
|
|
@ -216,4 +230,22 @@ Logs:
|
|||
<div style="result-wrapper">
|
||||
<pre id="result"></pre>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
<script>
|
||||
const loadQueryVals = () => {
|
||||
const form = document.querySelector('#tplprev');
|
||||
const params = new URLSearchParams(location.search);
|
||||
for(const [key, value] of params){
|
||||
form[key].value = value;
|
||||
const toggleInput = form.querySelector(`[data-toggle="${key}"]`);
|
||||
if (toggleInput) {
|
||||
toggleInput.checked = value === "yes";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", loadQueryVals());
|
||||
} else {
|
||||
loadQueryVals();
|
||||
}
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue