Reddit Bot for sending CoronaVirus News by Email.
This is self-hosting application. Please be aware of security implications when you host any application for yourself or for others.
I found reddit coronavirus community covering news well. I used ifttt to keep track of top news everyday. However, ifttt was not customizable. I ended up writing this program.
I also packaged it to run it as docker container, and on a kubernetes cluster, even on a raspberry-pi based kubernetes cluster.
Do want this news to be delivered to your Inbox? Fill out this form, and your email will be included in hosted version.
- Fill the form: https://forms.gle/YkEAtb1sCKvZqwe77
- You can un-subscribe anytime.
- Your email id will not be shared with anyone and will not be used for any other purpose.
This is a simple open source application. You can customize it and run it yourself. The simplest way to run it is using the docker container.
docker run --env REDDIT_USERNAME=MY-VALUE \
--env REDDIT_PASSWORD=MY-VALUE \
--env REDDIT_API_CLIENT_SECRET=MY-VALUE \
--env REDDIT_API_CLIENT_ID=MY-VALUE \
--env SENDER_EMAIL=MY-VALUE \
--env SENDER_EMAIL_PASSWORD=MY-VALUE \
--env SENDER_NAME=MY-VALUE \
--env RECEIVER_EMAIL=MY-VALUE \
skumaran/redditbot:v0.1
We will use Gmail as SMTP Service. You will have to (turn-on using less-secure apps)[https://hotter.io/docs/email-accounts/secure-app-gmail/] in the GMAIL authentication and you could use your username and password for SMTP now.
Docker Image for x86
docker pull skumaran/redditbot:v0.1
Docker Image for Arm
docker pull skumaran/redditbot:arm-v0.1
You could run this application in your Kubernetes Cluster, even on Raspberry Pi cluster, using the configuration files cronjob.yaml. Make sure you add the secrets to your cluster as given in the example redditbot-secrets .yaml.
The docker image requires the following environment variables.
export REDDIT_USERNAME=
export REDDIT_PASSWORD=
export REDDIT_API_CLIENT_SECRET=
export REDDIT_API_CLIENT_ID=
export SENDER_EMAIL=
export SENDER_NAME=
export SENDER_EMAIL_PASSWORD=
export RECEIVER_EMAIL=
To get the REDDIT_API_CLIENT_SECRET
and REDDIT_API_CLIENT_ID
,
please register an app with reddit: https://www.reddit.com/prefs/apps/
Rest are your email and account information.
This is a reference information for quick building and deploying.
Building the image.
docker build -t skumaran/redditbot:v0.1 .
Pushing the image.
docker push skumaran/redditbot:v0.1
0 7 * * * /usr/bin/docker run --env REDDIT_USERNAME=MY-VALUE \
--env REDDIT_PASSWORD=MY-VALUE \
--env REDDIT_API_CLIENT_SECRET=MY-VALUE \
--env REDDIT_API_CLIENT_ID=MY-VALUE \
--env SENDER_EMAIL=MY-VALUE \
--env SENDER_EMAIL_PASSWORD=MY-VALUE \
--env SENDER_NAME=MY-VALUE \
--env RECEIVER_EMAIL=MY-VALUE \
skumaran/redditbot:v0.1
$ docker login -u username
$ kubectl create secret generic skumaran-docker-login --from-file=.dockerconfigjson=/home/senthil/.docker/config.json --type=kubernetes.io/dockerconfigjson
secret/skumaran-docker-login created
Creating Secrets yaml
apiVersion: v1
kind: Secret
metadata:
name: redditbot-secrets
type: Opaque
data:
REDDIT_PASSWORD:
REDDIT_API_CLIENT_SECRET:
REDDIT_API_CLIENT_ID:
SENDER_EMAIL_PASSWORD:
Create each of the secrets in the base64 encoded format.
echo -n aerobic-tram-repulse-ate | base64
I am running it on my 4-node kubernetes cluster.
The master is this.