[Feature request] Local notification option
I am looking for a way to help my workflow in updating docker containers (previous workflow was not to update ever, unless something broke). I came across diun and it seems great. However, I am old and don't use discord or telegram. I want something like the Ubuntu MOTD that tells you if you have updates when you ssh into a server. Is there a way to just have the update information in a single text file that another script (MOTD script) could parse? Has anyone done something like this before, seems a bit daunting to start from scratch.
@blotsome you may want to look at https://crazymax.dev/diun/notif/script/ to generate the first file. Never used this it but according to documentation you should get all the information you need in environment variables specified at the top of that page.
I'm starting with the basics and added this to my diun.yml file:
notif: script: cmd: "echo $DIUN_ENTRY_IMAGE >> diun_notfiy.txt"
But the docker images I set up in my VM have not updated yet, so I have been unable to test this. Is there a particular docker image that gets updated daily that I could use to test? And then, what directory would the notify.txt file be written? Somewhere in the docker container filesystem? Maybe I need to specify /data so it goes to the data directory? I'll try that. Also, when I change a config in the diun.yml file, I've been sending docker-compose down, followed by up -d, is that the best way to update the configs?
ERR Script notification failed error=": fork/exec echo $DIUN_ENTRY_IMAGE >> /data/diun_notfiy.txt: no such file or directory"
cmd must be a command or script to execute.
This should work:
notif:
script:
cmd: "/bin/sh"
args:
- "echo $DIUN_ENTRY_IMAGE >> /data/diun_notfiy.txt"
Or just create a shell script and mount it to the container:
#!/usr/bin/env sh
# ./myscript.sh
echo $DIUN_ENTRY_IMAGE >> /data/diun_notfiy.txt
# ./diun.yml
watch:
workers: 20
schedule: "0 */6 * * *"
firstCheckNotif: false
providers:
docker:
watchByDefault: true
notif:
script:
cmd: "/myscript.sh"
# ./docker-compose.yml
services:
diun:
image: crazymax/diun:latest
container_name: diun
command: serve
volumes:
- "./data:/data"
- "./diun.yml:/diun.yml:ro"
- "./myscript.sh:/myscript.sh:ro"
- "/var/run/docker.sock:/var/run/docker.sock"
restart: always