Setup: Make Docker Compose, Scheduler, and Simclient fully operational
This commit is contained in:
6
scheduler/Dockerfile
Normal file
6
scheduler/Dockerfile
Normal 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"]
|
||||
4
scheduler/requirements.txt
Normal file
4
scheduler/requirements.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
paho-mqtt
|
||||
sqlalchemy
|
||||
pymysql
|
||||
python-dotenv
|
||||
20
scheduler/scheduler.py
Normal file
20
scheduler/scheduler.py
Normal 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()
|
||||
Reference in New Issue
Block a user