MQTT aggregator
|
|
||
|---|---|---|
| .github/workflows | ||
| deploy | ||
| src/aggregator | ||
| .gitignore | ||
| .pre-commit-config.yaml | ||
| .python-version | ||
| Aggregator Architecture.png | ||
| LICENSE | ||
| pyproject.toml | ||
| README.md | ||
| requirements.txt | ||
| run-tests.py | ||
| server-dev.py | ||
| server-prod.py | ||
MakerSpace Leiden Aggregator
Welcome to the MakerSpace Leiden Aggregator. This software aggregates and distributes real-time information about the makerspace.
Features
- Listens to MQTT messages
- Aggregates useful information (like who is at the space now, what machines are on, etc.)
- Publishes the information live via HTTP and WebSockets
System Design
Architecture
Architecture diagram also available at: https://balsamiq.cloud/s84bb/pl6cb2r
Quick Start Guide
System Requirements
- Python 3.7
- Python 3 venv
- Redis
- git
Installation
Standard Setup
- Clone the repository:
git clone https://github.com/MakerSpaceLeiden/aggregator.git - Set up virtual environment:
python3.7 -m venv venv . venv/bin/activate - Install Python dependencies:
pip install -r requirements.txt
Note for OSX 10.14 users: If you have a locked down ~/Library, use:
pip install --no-cache-dir -r requirements.txt
to avoid having to write in ~/Library/Caches/pip/wheel.
Running Locally
After installation, start the development server:
python server-dev.py
Testing
Run the test suite with:
python run-tests.py
Production Environment
The server runs in production using systemd.
Location: /usr/local/aggregator
Managing the Service:
- View environment:
sudo systemctl show-environment - Set environment variables:
sudo systemctl set-environment var=value - Restart service:
sudo systemctl restart msl_aggregator - View logs:
sudo journalctl _PID=<pid> sudo journalctl --since="10 minutes ago"
