СТОЛЬКО МУЧЕНИЙ РАДИ ОДНОЙ СТРОЧКИ

This commit is contained in:
the 2024-11-13 00:30:33 +04:00
parent 57e05aba90
commit ffef39d409
2 changed files with 29 additions and 21 deletions

View File

@ -56,6 +56,7 @@ class Manager:
print(message)
self.dataPublisher.send('data', message)
self.dataPublisher.flush()
def toggle_device(self, device, request_id, greenhouse_id):
@ -119,6 +120,8 @@ def webhook():
for key, value in body.items():
setattr(manager, key, value)
manager.sendData()
return f"Webhook received for manager {manager._id}"
return "Webhook ignored"

View File

@ -1,7 +1,7 @@
services:
zookeeper:
networks:
- vpn
# networks:
# - vpn
image: confluentinc/cp-zookeeper:7.4.0
environment:
ZOOKEEPER_CLIENT_PORT: 2181
@ -10,18 +10,23 @@ services:
- 2181:2181
kafka:
networks:
- vpn
# networks:
# - vpn
image: confluentinc/cp-kafka:7.4.0
ports:
- 29092:29092
- 9092:9092
- 9997:9997
expose:
- 29092:29092
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_LISTENERS: EXTERNAL_SAME_HOST://:29092,EXTERNAL_DIFFERENT_HOST://:29093,INTERNAL://:9092
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:9092,EXTERNAL_SAME_HOST://localhost:29092,EXTERNAL_DIFFERENT_HOST://157.245.80.232:29093
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL_SAME_HOST:PLAINTEXT,EXTERNAL_DIFFERENT_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
KAFKA_LISTENERS: HOST://0.0.0.0:9092,DOCKER://0.0.0.0:29092
KAFKA_ADVERTISED_LISTENERS: HOST://localhost:9092,DOCKER://kafka:29092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: DOCKER:PLAINTEXT,HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: DOCKER
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_LOG_FLUSH_INTERVAL_MESSAGES: 10000
@ -30,8 +35,8 @@ services:
- zookeeper
init-kafka:
networks:
- vpn
# networks:
# - vpn
image: confluentinc/cp-kafka:7.4.0
depends_on:
- kafka
@ -39,20 +44,20 @@ services:
command: |
"
# blocks until kafka is reachable
kafka-topics --bootstrap-server kafka:9092 --list
kafka-topics --bootstrap-server kafka:29092 --list
echo -e 'Creating kafka topics'
kafka-topics --bootstrap-server kafka:9092 --create --if-not-exists --topic commands --replication-factor 1 --partitions 1
kafka-topics --bootstrap-server kafka:9092 --create --if-not-exists --topic data --replication-factor 1 --partitions 1
kafka-topics --bootstrap-server kafka:9092 --create --if-not-exists --topic response --replication-factor 1 --partitions 1
kafka-topics --bootstrap-server kafka:29092 --create --if-not-exists --topic commands --replication-factor 1 --partitions 1
kafka-topics --bootstrap-server kafka:29092 --create --if-not-exists --topic data --replication-factor 1 --partitions 1
kafka-topics --bootstrap-server kafka:29092 --create --if-not-exists --topic response --replication-factor 1 --partitions 1
echo -e 'Successfully created the following topics:'
kafka-topics --bootstrap-server kafka:9092 --list
kafka-topics --bootstrap-server kafka:29092 --list
"
kafka-ui:
networks:
- vpn
# networks:
# - vpn
container_name: kafka-ui
image: provectuslabs/kafka-ui:latest
ports:
@ -64,6 +69,6 @@ services:
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka:29092
KAFKA_CLUSTERS_0_METRICS_PORT: 9997
networks:
vpn:
name: kafkaVPN
#networks:
# vpn:
# name: kafkaVPN