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

Add persistent configuration support for Apprise trigger #245

Closed igrybkov closed 1 year ago

igrybkov commented 1 year ago

Hello,

Apprise supports persistent configuration, but WUD does not allow that.

Sample docker-compose.yml for Apprise:

version: '3.4'
services:
  apprise:
    image: caronc/apprise:v0.9.0
    container_name: apprise
    ports:
      - 8000:8000
    user: "www-data:www-data"
    environment:
      - APPRISE_STATEFUL_MODE=simple # allow unencrypted configs
    volumes:
      # if uncommenting the below, you will need to type the following
      # otherwise the django instance won't have permissions to write
      # to the directory correctly:
      #   $> chown -R 33:33 ./config
      #   $> chmod -R 775 ./config
      - ./config:/config:rw

Sample config ./config/apprise.yml:

urls:
  - tgram://{bot_token}/{chat_id}:
    - tag: devops

Example of a request using persistent config:

curl 'http://localhost:8000/notify/apprise' -X 'POST' -d 'body=hello!&tag=devops'

The same request using JSON:

curl -X POST -d '{"tag":"devops", "body":"hello!"}' \
    -H "Content-Type: application/json" \
    http://localhost:8000/notify/apprise

So this change requires customizing part of the URL that goes after /notify (it's basically file name of the persisted config) and allowing adding tags to the request as well since that's how complex configurations are managed.

igrybkov commented 1 year ago

In case someone needs the same thing, here's a workaround:

WUD_TRIGGER_APPRISE_LOCAL_URL: https://apprise.url
WUD_TRIGGER_APPRISE_LOCAL_URLS: "apprise://localhost:8080/devops"

Basically, it's possible to make Apprise to call Apprise API and that's exactly what we do here. I wasn't able to make it work with tags though (probably a bug), so still would be nice to have native support here.

Documentation

fmartinou commented 1 year ago

Released as 6.1.0