0
0
Fork 0
mirror of https://github.com/crazy-max/diun.git synced 2025-04-28 20:52:25 +00:00

Add Usage chapter, fix test notifications example ()

This commit is contained in:
CrazyMax 2020-06-30 19:34:02 +02:00
parent 3faa9218f4
commit 02b08098b7
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
8 changed files with 120 additions and 98 deletions

View file

@ -2,7 +2,7 @@
## Test notifications ## Test notifications
Through the [command line](get-started.md#diun-cli) with: Through the [command line](usage/cli.md) with:
```shell ```shell
$ diun --config ./diun.yml --test-notif $ diun --config ./diun.yml --test-notif
@ -11,7 +11,7 @@ $ diun --config ./diun.yml --test-notif
Or within a container: Or within a container:
```shell ```shell
$ docker-compose exec diun --test-notif $ docker run --rm -it -v "$(pwd)/diun.yml:/diun.yml" crazymax/diun:latest --config /diun.yml --test-notif
``` ```
## field docker|swarm uses unsupported type: invalid ## field docker|swarm uses unsupported type: invalid

View file

@ -21,96 +21,8 @@ and [File](providers/file.md) providers available
* Timezone can be changed * Timezone can be changed
* Official [Docker image available](install/docker.md) * Official [Docker image available](install/docker.md)
## Diun CLI ## Usage
``` * [Command line](usage/cli.md)
$ ./diun --help * [Basic example](usage/basic-example.md)
Usage: diun * [Configuration](config/index.md)
Docker image update notifier. More info: https://github.com/crazy-max/diun
Flags:
--help Show context-sensitive help.
--version
--config=STRING Diun configuration file ($CONFIG).
--timezone="UTC" Timezone assigned to Diun ($TZ).
--log-level="info" Set log level ($LOG_LEVEL).
--log-json Enable JSON logging output ($LOG_JSON).
--log-caller Add file:line of the caller to log output ($LOG_CALLER).
--test-notif Test notification settings.
```
Following environment variables can be used in place of flags:
| Name | Default | Description |
|--------------------|---------------|---------------|
| `CONFIG` | | Diun configuration file |
| `TZ` | `UTC` | Timezone assigned |
| `LOG_LEVEL` | `info` | Log level output |
| `LOG_JSON` | `false` | Enable JSON logging output |
| `LOG_CALLER` | `false` | Enable to add `file:line` of the caller |
## Quick start with the Docker provider
Create a `docker-compose.yml` file that uses the official Diun image:
```yaml
version: "3.5"
services:
diun:
image: crazymax/diun:latest
volumes:
- "./data:/data"
- "/var/run/docker.sock:/var/run/docker.sock"
environment:
- "TZ=Europe/Paris"
- "LOG_LEVEL=info"
- "LOG_JSON=false"
- "DIUN_WATCH_WORKERS=20"
- "DIUN_WATCH_SCHEDULE=*/30 * * * *"
- "DIUN_PROVIDERS_DOCKER=true"
- "DIUN_PROVIDERS_DOCKER_WATCHBYDEFAULT=true"
restart: always
```
Here we use a minimal configuration to analyze **all running containers** (watch by default enabled) of your **local Docker** instance **every 30 minutes**.
That's it. Now you can launch Diun with the following command:
```shell
$ docker-compose up -d
```
If you prefer to rely on the configuration file instead of environment variables:
```yaml
version: "3.5"
services:
diun:
image: crazymax/diun:latest
volumes:
- "./data:/data"
- "./diun.yml:/diun.yml:ro"
- "/var/run/docker.sock:/var/run/docker.sock"
environment:
- "CONFIG=/diun.yml"
- "TZ=Europe/Paris"
- "LOG_LEVEL=info"
- "LOG_JSON=false"
restart: always
```
```yaml
# ./diun.yml
watch:
workers: 20
schedule: "*/30 * * * *"
firstCheckNotif: false
providers:
docker:
watchByDefault: true
```

View file

@ -24,7 +24,7 @@ And extract diun:
$ wget -qO- {{ config.repo_url }}releases/download/v{{ git.tag | trim('v') }}/diun_{{ git.tag | trim('v') }}_linux_x86_64.tar.gz | tar -zxvf - diun $ wget -qO- {{ config.repo_url }}releases/download/v{{ git.tag | trim('v') }}/diun_{{ git.tag | trim('v') }}_linux_x86_64.tar.gz | tar -zxvf - diun
``` ```
After getting the binary, it can be tested with [`./diun --help`](../get-started.md#diun-cli) command and moved to a permanent location. After getting the binary, it can be tested with [`./diun --help`](../usage/cli.md) command and moved to a permanent location.
## Server configuration ## Server configuration

View file

@ -19,6 +19,10 @@ Image: crazymax/diun:latest
- linux/s390x - linux/s390x
``` ```
This reference setup guides users through the setup based on `docker-compose`, but the installation of `docker-compose`
is out of scope of this documentation. To install `docker-compose` itself, follow the official
[install instructions](https://docs.docker.com/compose/install/).
## Volumes ## Volumes
| Path | Description | | Path | Description |
@ -27,8 +31,6 @@ Image: crazymax/diun:latest
## Usage ## Usage
Docker compose is the recommended way to run this image. Copy the following `docker-compose.yml` in `/opt/diun/` on your host for example:
```yaml ```yaml
version: "3.5" version: "3.5"

View file

@ -233,7 +233,7 @@ Following the transposition of the configuration into environment variables, the
is no longer loaded by default in the official Docker image. is no longer loaded by default in the official Docker image.
If you want to load a configuration file through the Docker image you will have to declare the If you want to load a configuration file through the Docker image you will have to declare the
[`CONFIG` environment variable](../get-started.md#diun-cli) pointing to the assigned configuration file: [`CONFIG` environment variable](../usage/cli.md#environment-variables) pointing to the assigned configuration file:
```yaml ```yaml
version: "3.5" version: "3.5"

View file

@ -0,0 +1,68 @@
# Basic example
In this section we quickly go over a basic docker-compose file to run Diun using the docker provider.
## Setup
Create a `docker-compose.yml` file that uses the official Diun image:
```yaml
version: "3.5"
services:
diun:
image: crazymax/diun:latest
volumes:
- "./data:/data"
- "/var/run/docker.sock:/var/run/docker.sock"
environment:
- "TZ=Europe/Paris"
- "LOG_LEVEL=info"
- "LOG_JSON=false"
- "DIUN_WATCH_WORKERS=20"
- "DIUN_WATCH_SCHEDULE=*/30 * * * *"
- "DIUN_PROVIDERS_DOCKER=true"
- "DIUN_PROVIDERS_DOCKER_WATCHBYDEFAULT=true"
restart: always
```
Here we use a minimal configuration to analyze **all running containers** (watch by default enabled) of your **local Docker** instance **every 30 minutes**.
That's it. Now you can launch Diun with the following command:
```shell
$ docker-compose up -d
```
If you prefer to rely on the configuration file instead of environment variables:
```yaml
version: "3.5"
services:
diun:
image: crazymax/diun:latest
volumes:
- "./data:/data"
- "./diun.yml:/diun.yml:ro"
- "/var/run/docker.sock:/var/run/docker.sock"
environment:
- "CONFIG=/diun.yml"
- "TZ=Europe/Paris"
- "LOG_LEVEL=info"
- "LOG_JSON=false"
restart: always
```
```yaml
# ./diun.yml
watch:
workers: 20
schedule: "*/30 * * * *"
firstCheckNotif: false
providers:
docker:
watchByDefault: true
```

38
docs/usage/cli.md Normal file
View file

@ -0,0 +1,38 @@
# Command Line
## Usage
```shell
$ diun [options]
```
## Options
```
$ diun --help
Usage: diun
Docker image update notifier. More info: https://github.com/crazy-max/diun
Flags:
--help Show context-sensitive help.
--version
--config=STRING Diun configuration file ($CONFIG).
--timezone="UTC" Timezone assigned to Diun ($TZ).
--log-level="info" Set log level ($LOG_LEVEL).
--log-json Enable JSON logging output ($LOG_JSON).
--log-caller Add file:line of the caller to log output ($LOG_CALLER).
--test-notif Test notification settings.
```
## Environment variables
Following environment variables can be used in place:
| Name | Default | Description |
|--------------------|---------------|---------------|
| `CONFIG` | | Diun configuration file |
| `TZ` | `UTC` | Timezone assigned |
| `LOG_LEVEL` | `info` | Log level output |
| `LOG_JSON` | `false` | Enable JSON logging output |
| `LOG_CALLER` | `false` | Enable to add `file:line` of the caller |

View file

@ -57,6 +57,8 @@ nav:
- With Docker: install/docker.md - With Docker: install/docker.md
- From binary: install/binary.md - From binary: install/binary.md
- Linux service: install/linux-service.md - Linux service: install/linux-service.md
- Usage:
- Command line: usage/cli.md
- Configuration: - Configuration:
- Overview: config/index.md - Overview: config/index.md
- .db: config/db.md - .db: config/db.md