Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/naorlivne/alert_on_rain_tomorrow
send a telegram and mail alert on rain tommrrow
https://github.com/naorlivne/alert_on_rain_tomorrow
Last synced: 17 days ago
JSON representation
send a telegram and mail alert on rain tommrrow
- Host: GitHub
- URL: https://github.com/naorlivne/alert_on_rain_tomorrow
- Owner: naorlivne
- License: lgpl-3.0
- Created: 2020-12-04T20:12:38.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-09-26T10:27:01.000Z (about 2 months ago)
- Last Synced: 2024-10-07T02:02:16.021Z (about 1 month ago)
- Language: Python
- Size: 433 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# alert_on_rain_tomorrow
A simple job designed to run inside a cron wrapper of some sort (pick your poison as each orchestrator/cloud provider has its own way of doing scheduled jobs nowadays) that will alert via telegram & email when it looks like it will rain tomorrow then exit (it's not long-running as again it's designed to run inside a cron scheduler of some kind).
Github actions CI unit tests & auto dockerhub push status: [![CI/CD](https://github.com/naorlivne/alert_on_rain_tomorrow/actions/workflows/full_ci_cd_workflow.yml/badge.svg)](https://github.com/naorlivne/alert_on_rain_tomorrow/actions/workflows/full_ci_cd_workflow.yml)
Code coverage: [![codecov](https://codecov.io/gh/naorlivne/alert_on_rain_tomorrow/branch/master/graph/badge.svg)](https://codecov.io/gh/naorlivne/alert_on_rain_tomorrow)
# Running
The container will run with the following command, check for rain tomorrow and alert if it looks like a rainy day then exit, It's designed to run under some cron scheduler (k8s, metronome/mesos or linux OS cron), below is the example command needed to run the container one off
```shell
docker run -e OWM_API_KEY="my_owm_token" -e CITY="Tel Aviv" -e COUNTRY_CODE="IL" -e SMTP_SERVER="smtp.gmail.com" -e SENDER_EMAIL="[email protected]" -e RECEIVER_EMAIL="[email protected]" -e EMAIL_PASSWORD="pass" -e EMAIL_PORT="465" -e TELEGRAM_TOKEN="my_token" -e CHAT_ID="123" naorlivne/alert_on_rain_tomorrow
```# Configuration options
alert_on_rain_tomorrow uses sane defaults, but they can all be easily changed:
| value | envvar | default value | notes |
|------------------------|------------------------|------------------------|--------------------------------------------------------------------------------------------------------|
| owm_api_key | OWM_API_KEY | | You can get a free one at https://openweathermap.org/ |
| city | CITY | | The city you want to be alerted should it rain tomorrow |
| country_code | COUNTRY_CODE | | The 2 capital letters country code where the city is located at |
| smtp_server | SMTP_SERVER | | SMTP server address which mail is sent through (SSL/TLS enabled) |
| sender_email | SENDER_EMAIL | | Email address to send the alert out of |
| receiver_email | RECEIVER_EMAIL | | Email address to send the alert to |
| email_password | EMAIL_PASSWORD | | `sender_email` account password |
| email_port | EMAIL_PORT | | SMTP server port |
| telegram_token | TELEGRAM_TOKEN | | Telegram API token |
| chat_id | CHAT_ID | | Telegram `chat_id` with the bot which you'll be alerted through |The easiest way to change a default value is to pass the envvar key\value to the docker container with the `-e` cli arg but if you want you can also create a configuration file with the settings you wish (in whatever of the standard format you desire) & place it in the /www/config folder inside the container.
Most providers also allow setting their configuration access_keys\etc via envvars use `-e` cli args to configure them is ideal as well but should you wish to configure a file you can also easily mount\copy it into the container as well.