Robpol86 / makemkv

Automated headless DVD/Bluray backups with MakeMKV from Docker.
https://hub.docker.com/r/robpol86/makemkv/
MIT License
28 stars 5 forks source link

Email notifications using AWS SES #12

Closed TonyBrobston closed 6 years ago

TonyBrobston commented 6 years ago

Working on a solution that sends email notifications on success/failure. I will likely iterate a few times on this idea.

I haven't had a chance to test out my current changes with the actual hooks. I manually tested the email function.

In future iterations I would like to embed the send_email function somewhere in the rip script and not install the AWS CLI unless EMAIL, AWS_ACCESS_KEY_ID, and AWS_SECRET_ACCESS_KEY are all passed in as environment variables. Not sure if this will mean that I call sudo apt install -y awscli; (well, whichever variant for this flavor of linux; dnf?) to install... or possibly I could do docker-in-docker and find a docker image that has the AWS CLI installed and call into that.

Another goal is to put the logs in the email on failure. I know that outside the container I can run docker logs [cid] to get the logs, but I'm not sure what command to run inside the container to get the same output. Once I figure this out, getting the logs into the email on failure should be easy.

The biggest downside to adding this feature is setting up an AWS account. However, I personally want more experience with AWS, so it's a plus for me.

TonyBrobston commented 6 years ago

Looks like I can use tee and I will write the output of rip.sh to /var/log/makemkv.log. On error I can likely grab this file and dump it to an email (or possibly attach it as a document, might be nice to opening the file in a specific application on a smart phone..?)

TonyBrobston commented 6 years ago

Tested happy path. I received an email on a successful rip. I also tested the sad path for when low_space_term is invoked; I also received an email.

I'm not sure how to test on_err and catch_failed. I should have also tested the same docker container but without the three environment variables I added EMAIL, etc.

I'm going to continue to use the image I built locally. If you decide you want to collaborate on some changes, just lemme know.