Sign inSign up

martinh80/webhooks

By martinh80

•Updated 6 months ago

Send GET requests to send an e-mail.

Image
Monitoring & observability
0

10K+

martinh80/webhooks repository overview

⁠What does this container image do?

It provides an HTTP endpoint that can be used to send e-mails.

⁠Why did you create this image?

At home I have InfluxDB running that is populated with data by scheduled scripts. When a script fails, or when the source of the script is unavailable, no data will be stored in InfluxDB. InfluxDB provides a deadman switch type of alert, which means that it can notify if no new data is ingested. It supports Slack, PagerDuty and Webhooks. I use the webhook method, having it request this endpoint and notify me by email on any alert.

Several other similar services are available online, e.g. Zapier or If-this-then-that, but these are commercial offerings with a (limited) free plan. I prefer to run my own solution on-premise.

⁠What does this container image contain?

It is based on Alpine linux, a very lightweight base image. On top of that Apache2/PHP is installed and the webhooks.php script is served. It also adds mailx as a mail client and msmtp⁠ as a simple SMTP client. This allows PHP to send e-mail. It exposes port 80 to receive the requests.

⁠How do I use it?

The image needs the following files, just make sure to bind-mount them when you run the image

  • /etc/msmtprc, the configuration file for the smtp client, which will forward mail to an upstream smtp server
  • /etc/aliases, the configuration file that tells the system what e-mail address to use for the local root user

⁠Example /etc/msmtprc

The msmtp project has proper documentation. This is the configuration I use with my gmail account.

# Set default values
defaults
auth    on
tls     on
tls_trust_file  /etc/ssl/certs/ca-certificates.crt
syslog  on

# Gmail
account gmail
host    smtp.gmail.com
port    587
from    [email protected]
user    [email protected]
password mypassword

# Set a default account
account default : gmail
aliases /etc/aliases

Note: you should never use your real password here. Make sure you have 2FA enabled in your gmail account, and create an appkey at https://myaccount.google.com/apppasswords⁠

⁠Example /etc/aliases

⁠Security warning

Do NEVER expose this service to the Internet directly. If you do, you are allowing everybody to send e-mails on your behalf. The connection to the URL is unencrypted and the contents of the message are in the URL, which means that other can sniff this information without you noticing.

⁠Source code

This image is build from this public Github repo⁠.

Tag summary

Content type

Image

Digest

sha256:375e1fb92…

Size

17.1 MB

Last updated

6 months ago

docker pull martinh80/webhooks