Setup: Make Docker Compose, Scheduler, and Simclient fully operational

This commit is contained in:
2025-07-14 18:41:28 +00:00
parent 7c1f546af9
commit 2fa84c1e2b
7 changed files with 99 additions and 3 deletions

6
scheduler/Dockerfile Normal file
View File

@@ -0,0 +1,6 @@
FROM python:3.13-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "scheduler.py"]

View File

@@ -0,0 +1,4 @@
paho-mqtt
sqlalchemy
pymysql
python-dotenv

20
scheduler/scheduler.py Normal file
View File

@@ -0,0 +1,20 @@
# scheduler/scheduler.py
import time
import paho.mqtt.client as mqtt
def main():
# Fix für die veraltete API - explizit callback_api_version setzen
client = mqtt.Client(callback_api_version=mqtt.CallbackAPIVersion.VERSION2)
# Im Docker-Netzwerk: Hostname des MQTT-Brokers ist "mqtt", nicht "localhost"
client.connect("mqtt", 1883)
while True:
# Hier später: Events aus DB lesen und MQTT-Nachricht senden
print("Scheduler läuft...")
time.sleep(10)
if __name__ == "__main__":
main()