A collection of servers and services that work together to send Cal Poly students living on campus alerts when laundry machines become available on campus.
Unfortunately, Cal Poly recently launched a mobile application that provides machine info, and the website from which I formerly scraped data has been taken down. Unfortunately, this means that the laundry data server is broken. Fortunately, writing a new web scraper would fix the entire project, which is up next on the todo list for this project.
docker compose up
should make you right as rain to run everything except for
the discord bot. To run the discord bot, make a .env file in discord_bot/
containing a discord bot token, defined in .env as DISCORD_TOKEN.
- laundry_server is a connexion flask app using openapi specification. This server fetches data from the washalert website and uses regex to scrape the machine data from the webpage. This server runs in a docker container.
- prometheus_exporters is a prometheus exporter written in Python. It calls the laundry_server for data. This script runs in a docker container.
- watcher and notifier are Python scripts that take data from the prometheus exporter and update the Redis database. When machines are detected to be available, the watcher (this script watches the machine states) sends an alert to the Redis database. The notifier then checks to see which users, if any, have subscribed to this event, and then sends an alert to a fulfillment queue.
- discord_bot is a discord bot written using discord.py. This bot listens to user commands, does basic word processing, and then adds a subscription to the Redis database. It also dequeues notifications from the discord_alerts queue in Redis and sends the notifications to their target recipients.