diun icon indicating copy to clipboard operation
diun copied to clipboard

[Feature request] Local notification option

Open blotsome opened this issue 3 years ago • 3 comments

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 avatar Sep 09 '22 22:09 blotsome

@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.

eriol avatar Sep 14 '22 18:09 eriol

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?

blotsome avatar Sep 19 '22 14:09 blotsome

ERR Script notification failed error=": fork/exec echo $DIUN_ENTRY_IMAGE >> /data/diun_notfiy.txt: no such file or directory"

blotsome avatar Sep 20 '22 17:09 blotsome

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

crazy-max avatar Oct 09 '22 00:10 crazy-max