From 4110b9fc87e3250cffe3efc57c905fc13275d082 Mon Sep 17 00:00:00 2001 From: kev Date: Wed, 7 Apr 2021 12:27:14 +0800 Subject: [PATCH] add slacker --- README.md | 1 + slacker/Dockerfile | 15 ++++++++++++++ slacker/README.md | 7 +++++++ slacker/data/config.yml | 42 ++++++++++++++++++++++++++++++++++++++ slacker/docker-compose.yml | 11 ++++++++++ 5 files changed, 76 insertions(+) create mode 100644 slacker/Dockerfile create mode 100644 slacker/README.md create mode 100644 slacker/data/config.yml create mode 100644 slacker/docker-compose.yml diff --git a/README.md b/README.md index e824b2e..5f3a95a 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,7 @@ A collection of delicious docker recipes. - [x] samba :+1: - [x] samba-arm :+1: - [x] scrapyd :+1: +- [x] slacker - [x] swarm-arm - [x] taskd - [x] tftpd diff --git a/slacker/Dockerfile b/slacker/Dockerfile new file mode 100644 index 0000000..5a67c50 --- /dev/null +++ b/slacker/Dockerfile @@ -0,0 +1,15 @@ +# +# Dockerfile for slacker +# + +FROM python:3.9-alpine +MAINTAINER EasyPi Software Foundation + +RUN set -xe \ + && apk add --no-cache curl \ + && pip install aiosmtpd atpublic pyslack pyyaml requests \ + && cd /usr/local/lib/python3.9/site-packages/ \ + && wget https://github.com/ont/slacker/raw/master/handler.py + +EXPOSE 8025 +CMD ["aiosmtpd", "-n", "-l", "0.0.0.0:8025", "-c", "handler.MessageHandler"] diff --git a/slacker/README.md b/slacker/README.md new file mode 100644 index 0000000..57d05b4 --- /dev/null +++ b/slacker/README.md @@ -0,0 +1,7 @@ +slacker +======= + +[Slacker][1] is simple email-to-slack gateway. It support basic rules for routing +messages to different slack channels from different bots. + +[1]: https://github.com/ont/slacker diff --git a/slacker/data/config.yml b/slacker/data/config.yml new file mode 100644 index 0000000..59d78bc --- /dev/null +++ b/slacker/data/config.yml @@ -0,0 +1,42 @@ +###### +# This is example of config file for slacker. +# There are two sections: +# * default: this is default options for sending message to slack. +# * rules: list of rules for matching email message. Currently 'from', +# 'to' and 'subject' fields are supported. Their values can be +# regexp to match corresponding email field. +# +# Each rule in list tested in order. First matched rule is used to update +# values from 'default' section with its 'options' subsection. +###### + +default: + channel: '#general' + username: slacker + icon_url: '' + slack_token: xoxb-00000000000-aaaaaaaaaaaaaaaaaaaaaaaa + debug: false + format: "subject: %(subject)s; body: %(body)s" ## default slack message format + + +rules: + - name: Monit rule + from: monit@.* + + options: + username: monit + channel: '#monit' + icon_url: 'https://bitbucket.org/tildeslash/monit/avatar/128' + debug: false + + + - name: Cron rule + from: root@localhost + subject: Cron.* + + options: + username: cron + channel: '#cron' + icon_url: '' + debug: true ## will output full email with all headers + format: "email body is: %(body)s" ## custom message format diff --git a/slacker/docker-compose.yml b/slacker/docker-compose.yml new file mode 100644 index 0000000..091eeb1 --- /dev/null +++ b/slacker/docker-compose.yml @@ -0,0 +1,11 @@ +version: "3.8" +services: + slacker: + image: vimagick/slacker + ports: + - "8025:8025" + volumes: + - ./data:/etc/slacker + environment: + - CONFIG=/etc/slacker/config.yml + restart: unless-stopped