First off, I really enjoy duplicati. It’s a great project that has already spared me a lot of time building my own custom backup solution (for backing up to Google Drive).
I was wondering if anyone has managed to get posting messages to Slack working. I’d like to report to Slack if a backup was run (the backup name) and the outcome (succes/fail). I think I have to use the global options ‘send-http-url’ and ‘send-http-any-operation’, but have not really found how to add useful parameters to the message.
So, before re-inventing the wheel, has anyone else done this (or something alike) and/or can point me to some examples and/or can point me to some documentation?
I’ll give the run-script-after feature a try, using curl under the hoods (Slack has a very decent HTTP API).
Knowing the environment variables pattern helps me.
This is the script’ content that worked for me:
(don’t forget to make the file executable, if on mac or linux)
#!/bin/bash
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/OBFUSCATED
SLACK_CHANNEL="#backups"
SLACK_MSG="Backup performed for ${DUPLICATI__backup_name}"
curl -s -X POST --data-urlencode "payload={\"channel\": \"${SLACK_CHANNEL}\", \"username\": \"duplicati\", \"text\": \"${SLACK_MSG}\", \"icon_emoji\": \":information_source:\"}" "${SLACK_WEBHOOK_URL}"
The only wish that I have left right now is to be able to detect whether a backup failed, so I can change how I post the message to slack (with a big exclamation if it failed). I couldn’t find an appropriate DUPLICATI__xxx environment variable for that, not from the environment variables printed, neither from source
I’m using the linuxserver.io docker container and found out that updating to latest Canary from the Duplicati web interface was easiest. Not a good solution because a re-deploy of the container means I’ll have to do it again, but good enough for now.
I’m still new to Docker so maybe there’s a taboo against this but couldn’t a “Duplicati Canary” container be created & maintained with the latest Canary versions?
It would be a fairly simple change, mostly deciding which parameters to expose (channel name, token, avatar, etc). A good “getting started” project for contributing to Duplicati.
Sorry didn’t want to be rude
But I am using the docker image for quite some time already, with automatic updates using watchtower and all I can say - rock solid
I did not read it as being rude. I thought you were requesting status on the Docker builds, but since you are already using them, did you ask for something else?