fmartinou / whats-up-docker

What's up Docker ( aka WUD ) gets you notified when a new version of your Docker Container is available.
https://fmartinou.github.io/whats-up-docker
MIT License
1.02k stars 33 forks source link

Can't use Docker Secrets for trigger ENV var #209

Open jpbaril opened 1 year ago

jpbaril commented 1 year ago

Based on documentation and issue https://github.com/fmartinou/whats-up-docker/issues/162 it should work.

Here is my docker-compose.yml file:

version: '3'

services:
  whatsupdocker:
    image: fmartinou/whats-up-docker
    container_name: wud
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - 3001:3000
    environment:
      - WUD_TRIGGER_APPRISE_BASE_MODE=batch
      - WUD_TRIGGER_APPRISE_BASE_ONCE=false
      - WUD_TRIGGER_APPRISE_BASE_URL__FILE=/run/secrets/apprise_url
      - WUD_TRIGGER_APPRISE_BASE_URLS__FILE=/run/secrets/apprise_urls 
    secrets:
      - apprise_url
      - apprise_urls

secrets:
  apprise_url:
    file: ./secrets/apprise_url.txt
  apprise_urls:
    file: ./secrets/apprise_urls.txt

And here are the content of 'secrets/apprise_url.txt':
https://user:password@apprise.domain.com and 'secrets/apprise_urls.txt': mailtos://user:password@gmail.com

Without using secrets and so using:

     environment:
      ...
      - WUD_TRIGGER_APPRISE_BASE_URL=https://user:password@apprise.domain.com
      - WUD_TRIGGER_APPRISE_BASE_URLS=mailtos://user:password@gmail.com 

it worked.

So what's wrong with Docker secrets ?

fmartinou commented 1 year ago

Hi,

I've never tried with docker secrets but only with regular files 🤔 .

Do you have any errors in the log ? Something indicating that the files cannot be loaded?

Maybe a permission issue?

Would the example below work?

version: '3'

services:
  whatsupdocker:
    image: fmartinou/whats-up-docker
    container_name: wud
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - 3001:3000
    environment:
      - WUD_TRIGGER_APPRISE_BASE_MODE=batch
      - WUD_TRIGGER_APPRISE_BASE_ONCE=false
      - WUD_TRIGGER_APPRISE_BASE_URL__FILE=/wud/apprise_url.txt
      - WUD_TRIGGER_APPRISE_BASE_URLS__FILE=/wud/apprise_urls.txt
    volumes:
      - ./secrets/apprise_url.txt:/wud/apprise_url.txt:ro
      - ./secrets/apprise_urls.txt:/wud/apprise_urls.txt:ro
jpbaril commented 1 year ago

Nevermind, it works. The problem was that in one of the files there was an additional empty line below the first one.

BTW, I just learned about Docker secrets recently. I really don't know what is the advantage compared to using volumes.