Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DIUN_PROVIDERS_DOCKER causing config issues - v4 #107

Closed
thespad opened this issue Jun 22, 2020 · 3 comments
Closed

DIUN_PROVIDERS_DOCKER causing config issues - v4 #107

thespad opened this issue Jun 22, 2020 · 3 comments

Comments

@thespad
Copy link

thespad commented Jun 22, 2020

Behaviour

Steps to reproduce this issue

  1. Pull diun 4.0
  2. Do not have DIUN_PROVIDERS_DOCKER=true set on Diun container
  3. docker-compose up -d
  4. Container fails to start correctly

Expected behaviour

Container should parse the config as valid.

Actual behaviour

Without DIUN_PROVIDERS_DOCKER=true container is unable to parse config and fails to start. With DIUN_PROVIDERS_DOCKER=true it overrides any provider settings in the diun.yml with the default values.

Configuration

  • Diun version : 4.0.0
  • Platform (windows/linux) : docker 19.03.11 on Raspbian
  • System info (type uname -a) : Linux pi1 4.19.118-v7+ #1311 SMP Mon Apr 27 14:21:24 BST 2020 armv7l GNU/Linux
db:
  path: diun.db

watch:
  workers: 10
  schedule: "0 * * * *"
  firstCheckNotif: false

notif:
  telegram:
    token: 123:4567890
    chatIDs:
      - 0987654321

providers:
  docker:
    watchStopped: true

Logs

Without DIUN_PROVIDERS_DOCKER=true

Mon, 22 Jun 2020 22:24:58 BST INF Starting Diun version=4.0.0
Mon, 22 Jun 2020 22:24:58 BST FTL Cannot load configuration error="Key: 'Config.Providers' Error:Field validation for 'Providers' failed on the 'required' tag",

With DIUN_PROVIDERS_DOCKER=true

Mon, 22 Jun 2020 22:35:03 BST INF Starting Diun version=4.0.0
Mon, 22 Jun 2020 22:35:03 BST DBG {
  "db": {
    "path": "/data/diun.db"
  },
  "watch": {
    "workers": 10,
    "schedule": "0 * * * *",
    "firstCheckNotif": false
  },
  "providers": {
    "docker": {
      "tlsVerify": true,
      "watchByDefault": false,
      "watchStopped": false
    }
  }
}

Compose

version: "3.2"

services:
  diun:
    image: crazymax/diun:latest
    container_name: diun
    volumes:
      - diun_data:/data
      - ./diun.yml:/diun.yml:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
    environment:
      - "TZ=Europe/London"
      - "LOG_LEVEL=debug"
      - "LOG_JSON=false"
    restart: unless-stopped
    labels:
     - diun.enable=true

volumes:
    diun_data:
        external: true
@crazy-max
Copy link
Owner

crazy-max commented Jun 22, 2020

@thespad,

Without DIUN_PROVIDERS_DOCKER=true container is unable to parse config and fails to start.

Yes that's because at least one provider is required.

In your case you want to only rely on configuration file so you have to defined it through CONFIG env var in your compose:

version: "3.2"

services:
  diun:
    image: crazymax/diun:latest
    container_name: diun
    volumes:
      - diun_data:/data
      - ./diun.yml:/diun.yml:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
    environment:
      - "CONFIG=/diun.yml"
      - "TZ=Europe/London"
      - "LOG_LEVEL=debug"
      - "LOG_JSON=false"
    restart: unless-stopped
    labels:
     - diun.enable=true

volumes:
    diun_data:
        external: true

@crazy-max
Copy link
Owner

@thespad I have updated the Migration notes about this. Thanks for your feedback.

@thespad
Copy link
Author

thespad commented Jun 23, 2020

Ah, that explains it. Didn't realise it wouldn't parse the config file automatically any more. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants