From f7607c898e10885dd5c4cc19eb1c4a5b644102bd Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Sun, 6 Sep 2020 20:42:59 +0200 Subject: [PATCH] Add "Too many requests to registry" section in FAQ (#168) --- .res/examples/docker/docker-compose.yml | 37 ----------- .res/examples/k8s/diun.yml | 81 ------------------------- .res/examples/k8s/nginx.yml | 23 ------- .res/examples/swarm/diun.yml | 24 -------- .res/examples/swarm/nginx.yml | 15 ----- .res/examples/systemd/diun.service | 17 ------ docs/faq.md | 30 ++++++++- docs/install/docker.md | 6 +- docs/providers/docker.md | 6 +- docs/providers/kubernetes.md | 2 +- docs/providers/swarm.md | 2 +- docs/usage/basic-example.md | 4 +- 12 files changed, 37 insertions(+), 210 deletions(-) delete mode 100644 .res/examples/docker/docker-compose.yml delete mode 100644 .res/examples/k8s/diun.yml delete mode 100644 .res/examples/k8s/nginx.yml delete mode 100644 .res/examples/swarm/diun.yml delete mode 100644 .res/examples/swarm/nginx.yml delete mode 100644 .res/examples/systemd/diun.service diff --git a/.res/examples/docker/docker-compose.yml b/.res/examples/docker/docker-compose.yml deleted file mode 100644 index b7981427..00000000 --- a/.res/examples/docker/docker-compose.yml +++ /dev/null @@ -1,37 +0,0 @@ -version: "3.2" - -services: - diun: - image: crazymax/diun:latest - container_name: diun - 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" - labels: - - "diun.enable=true" - - "diun.watch_repo=true" - restart: always - - cloudflared: - image: crazymax/cloudflared:latest - ports: - - target: 5053 - published: 5053 - protocol: udp - - target: 49312 - published: 49312 - protocol: tcp - environment: - - "TZ=Europe/Paris" - - "TUNNEL_DNS_UPSTREAM=https://1.1.1.1/dns-query,https://1.0.0.1/dns-query" - labels: - - "diun.enable=true" - - "diun.watch_repo=true" - restart: always diff --git a/.res/examples/k8s/diun.yml b/.res/examples/k8s/diun.yml deleted file mode 100644 index a0e5f3e2..00000000 --- a/.res/examples/k8s/diun.yml +++ /dev/null @@ -1,81 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - namespace: default - name: diun ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: diun -rules: - - apiGroups: - - "" - resources: - - pods - verbs: - - get - - watch - - list ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: diun -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: diun -subjects: - - kind: ServiceAccount - name: diun - namespace: default ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - namespace: default - name: diun -spec: - replicas: 1 - selector: - matchLabels: - app: diun - template: - metadata: - labels: - app: diun - annotations: - diun.enable: "true" - diun.watch_repo: "true" - spec: - serviceAccountName: diun - containers: - - name: diun - image: crazymax/diun:latest - imagePullPolicy: Always - env: - - name: TZ - value: "Europe/Paris" - - name: LOG_LEVEL - value: "info" - - name: LOG_JSON - value: "false" - - name: DIUN_WATCH_WORKERS - value: "20" - - name: DIUN_WATCH_SCHEDULE - value: "*/30 * * * *" - - name: DIUN_PROVIDERS_KUBERNETES - value: "true" - volumeMounts: - - mountPath: "/data" - name: "data" - restartPolicy: Always - volumes: - # Set up a data directory for diun - # For production usage, you should consider using PV/PVC instead(or simply using storage like NAS) - # For more details, please see https://kubernetes.io/docs/concepts/storage/volumes/ - - name: "data" - hostPath: - path: "/data" - type: Directory diff --git a/.res/examples/k8s/nginx.yml b/.res/examples/k8s/nginx.yml deleted file mode 100644 index 9fc6ad5c..00000000 --- a/.res/examples/k8s/nginx.yml +++ /dev/null @@ -1,23 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - namespace: default - name: nginx -spec: - selector: - matchLabels: - run: nginx - replicas: 2 - template: - metadata: - labels: - run: nginx - annotations: - diun.enable: "true" - diun.watch_repo: "true" - spec: - containers: - - name: nginx - image: nginx - ports: - - containerPort: 80 diff --git a/.res/examples/swarm/diun.yml b/.res/examples/swarm/diun.yml deleted file mode 100644 index 7258bf9f..00000000 --- a/.res/examples/swarm/diun.yml +++ /dev/null @@ -1,24 +0,0 @@ -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_SWARM=true" - deploy: - mode: replicated - replicas: 1 - labels: - - "diun.enable=true" - - "diun.watch_repo=true" - placement: - constraints: - - node.role == manager diff --git a/.res/examples/swarm/nginx.yml b/.res/examples/swarm/nginx.yml deleted file mode 100644 index 0634cf3a..00000000 --- a/.res/examples/swarm/nginx.yml +++ /dev/null @@ -1,15 +0,0 @@ -version: "3.5" - -services: - nginx: - image: nginx - ports: - - target: 80 - published: 80 - protocol: udp - deploy: - mode: replicated - replicas: 2 - labels: - - "diun.enable=true" - - "diun.watch_repo=true" diff --git a/.res/examples/systemd/diun.service b/.res/examples/systemd/diun.service deleted file mode 100644 index f2b3a877..00000000 --- a/.res/examples/systemd/diun.service +++ /dev/null @@ -1,17 +0,0 @@ -[Unit] -Description=Diun -Documentation=https://github.com/crazy-max/diun -After=syslog.target -After=network.target - -[Service] -RestartSec=2s -Type=simple -User=diun -Group=diun -ExecStart=/usr/local/bin/diun --config /etc/diun/diun.yml --log-level info -Restart=always -Environment=DIUN_DB_PATH=/var/lib/diun/diun.db - -[Install] -WantedBy=multi-user.target diff --git a/docs/faq.md b/docs/faq.md index e00f96af..2a8d1e4c 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -16,7 +16,8 @@ $ docker-compose exec diun diun --test-notif ## field docker|swarm uses unsupported type: invalid -If you have the error `failed to decode configuration from file: field docker uses unsupported type: invalid` that's because your `docker`, `swarm` or `kubernetes` provider is not initialized in your configuration: +If you have the error `failed to decode configuration from file: field docker uses unsupported type: invalid` that's +because your `docker`, `swarm` or `kubernetes` provider is not initialized in your configuration: !!! failure ```yaml @@ -34,9 +35,12 @@ should be: ## No image found in manifest list for architecture, variant, OS -If you encounter this kind of warning, you are probably using the [file provider](providers/file.md) containing an image with an erroneous or empty platform. If the platform is not filled in, it will be deduced automatically from the information of your operating system on which Diun is running. +If you encounter this kind of warning, you are probably using the [file provider](providers/file.md) containing an +image with an erroneous or empty platform. If the platform is not filled in, it will be deduced automatically from the +information of your operating system on which Diun is running. -In the example below, Diun is running (`diun_x.x.x_windows_i386.zip`) on Windows 10 and tries to analyze the `crazymax/cloudflared` image with the detected platform (`windows/386)`: +In the example below, Diun is running (`diun_x.x.x_windows_i386.zip`) on Windows 10 and tries to analyze the +`crazymax/cloudflared` image with the detected platform (`windows/386)`: ```yaml - name: crazymax/cloudflared:2020.2.1 @@ -60,3 +64,23 @@ You have to force the platform for this image if you are not on a supported plat !!! success `Fri, 27 Mar 2020 01:24:33 UTC INF New image found image=docker.io/crazymax/cloudflared:2020.2.1 provider=file` + +## Too many requests to registry + +The error `Cannot create image closer: too many requests to registry` is returned when the HTTP status code returned +by the registry is 429. + +This can happen on the DockerHub registry because of the [rate-limited anonymous pulls](https://docs.docker.com/docker-hub/download-rate-limit/). + +To solve this you must first be authenticated against the registry through the [`regopts` settings](config/regopts.md): + +```yaml +regopts: + - name: "docker.io" + selector: image + username: foo + password: bar +``` + +If this is not enough, tweak the [`schedule` setting](config/watch.md#schedule) with something +like `0 */6 * * *` (every 6 hours). diff --git a/docs/install/docker.md b/docs/install/docker.md index 105c9385..d96a5f75 100644 --- a/docs/install/docker.md +++ b/docs/install/docker.md @@ -46,7 +46,7 @@ services: - "LOG_LEVEL=info" - "LOG_JSON=false" - "DIUN_WATCH_WORKERS=20" - - "DIUN_WATCH_SCHEDULE=*/30 * * * *" + - "DIUN_WATCH_SCHEDULE=0 */6 * * *" - "DIUN_PROVIDERS_DOCKER=true" - "DIUN_PROVIDERS_DOCKER_WATCHSTOPPED=true" labels: @@ -70,7 +70,7 @@ $ docker run -d --name diun \ -e "LOG_LEVEL=info" \ -e "LOG_JSON=false" \ -e "DIUN_WATCH_WORKERS=20" \ - -e "DIUN_WATCH_SCHEDULE=*/30 * * * *" \ + -e "DIUN_WATCH_SCHEDULE=0 */6 * * *" \ -e "DIUN_PROVIDERS_DOCKER=true" \ -e "DIUN_PROVIDERS_DOCKER_WATCHSTOPPED=true" \ -v "$(pwd)/data:/data" \ @@ -111,7 +111,7 @@ services: watch: workers: 20 - schedule: "*/30 * * * *" + schedule: "0 */6 * * *" providers: docker: diff --git a/docs/providers/docker.md b/docs/providers/docker.md index b480fc35..acbaa550 100644 --- a/docs/providers/docker.md +++ b/docs/providers/docker.md @@ -26,7 +26,7 @@ services: - "LOG_LEVEL=info" - "LOG_JSON=false" - "DIUN_WATCH_WORKERS=20" - - "DIUN_WATCH_SCHEDULE=*/30 * * * *" + - "DIUN_WATCH_SCHEDULE=0 */6 * * *" - "DIUN_PROVIDERS_DOCKER=true" - "DIUN_PROVIDERS_DOCKER_WATCHSTOPPED=true" restart: always @@ -70,8 +70,8 @@ diun_1 | Sat, 14 Dec 2019 15:30:12 CET INF New image found id=mydocker i diun_1 | Sat, 14 Dec 2019 15:30:12 CET INF New image found id=mydocker image=docker.io/crazymax/cloudflared:2019.11.0 provider=docker diun_1 | Sat, 14 Dec 2019 15:30:12 CET INF New image found id=mydocker image=docker.io/crazymax/cloudflared:2019.11.3 provider=docker diun_1 | Sat, 14 Dec 2019 15:30:13 CET INF New image found id=mydocker image=docker.io/crazymax/cloudflared:2019.11.2 provider=docker -diun_1 | Sat, 14 Dec 2019 15:30:13 CET INF Cron initialized with schedule */30 * * * * -diun_1 | Sat, 14 Dec 2019 15:30:13 CET INF Next run in 29 minutes (2019-12-14 16:00:00 +0100 CET) +diun_1 | Sat, 14 Dec 2019 15:30:13 CET INF Cron initialized with schedule 0 */6 * * * +diun_1 | Sat, 14 Dec 2019 15:30:13 CET INF Next run in 2 hours 29 minutes (2019-12-14 16:00:00 +0100 CET) ``` ## Configuration diff --git a/docs/providers/kubernetes.md b/docs/providers/kubernetes.md index 865e52f9..941d5041 100644 --- a/docs/providers/kubernetes.md +++ b/docs/providers/kubernetes.md @@ -79,7 +79,7 @@ spec: - name: DIUN_WATCH_WORKERS value: "20" - name: DIUN_WATCH_SCHEDULE - value: "*/30 * * * *" + value: "0 */6 * * *" - name: DIUN_PROVIDERS_KUBERNETES value: "true" volumeMounts: diff --git a/docs/providers/swarm.md b/docs/providers/swarm.md index ff8b8ade..76ba497b 100644 --- a/docs/providers/swarm.md +++ b/docs/providers/swarm.md @@ -26,7 +26,7 @@ services: - "LOG_LEVEL=info" - "LOG_JSON=false" - "DIUN_WATCH_WORKERS=20" - - "DIUN_WATCH_SCHEDULE=*/30 * * * *" + - "DIUN_WATCH_SCHEDULE=0 */6 * * *" - "DIUN_PROVIDERS_SWARM=true" deploy: mode: replicated diff --git a/docs/usage/basic-example.md b/docs/usage/basic-example.md index 69ec8ec0..ac3bfd05 100644 --- a/docs/usage/basic-example.md +++ b/docs/usage/basic-example.md @@ -20,7 +20,7 @@ services: - "LOG_LEVEL=info" - "LOG_JSON=false" - "DIUN_WATCH_WORKERS=20" - - "DIUN_WATCH_SCHEDULE=*/30 * * * *" + - "DIUN_WATCH_SCHEDULE=0 */6 * * *" - "DIUN_PROVIDERS_DOCKER=true" - "DIUN_PROVIDERS_DOCKER_WATCHBYDEFAULT=true" restart: always @@ -58,7 +58,7 @@ services: watch: workers: 20 - schedule: "*/30 * * * *" + schedule: "0 */6 * * *" firstCheckNotif: false providers: