diff --git a/edge/.gitignore b/edge/.gitignore new file mode 100644 index 0000000..44d0711 --- /dev/null +++ b/edge/.gitignore @@ -0,0 +1,2 @@ +venv +app.log \ No newline at end of file diff --git a/edge/docker/docker-compose.yaml b/edge/docker/docker-compose.yaml new file mode 100644 index 0000000..09f707a --- /dev/null +++ b/edge/docker/docker-compose.yaml @@ -0,0 +1,48 @@ +version: "3.9" +# name: "road_vision" +services: + mqtt: + image: eclipse-mosquitto + container_name: mqtt + volumes: + - ./mosquitto:/mosquitto + - ./mosquitto/data:/mosquitto/data + - ./mosquitto/log:/mosquitto/log + ports: + - 1883:1883 + - 19001:9001 + networks: + mqtt_network: + + + edge: + container_name: edge + build: ../ + depends_on: + - mqtt + environment: + MQTT_BROKER_HOST: "mqtt" + MQTT_BROKER_PORT: 1883 + MQTT_TOPIC: " " + HUB_HOST: "store" + HUB_PORT: 8000 + HUB_MQTT_BROKER_HOST: "mqtt" + HUB_MQTT_BROKER_PORT: 1883 + HUB_MQTT_TOPIC: "processed_data_topic" + networks: + mqtt_network: + edge_hub: + + +networks: + mqtt_network: + db_network: + edge_hub: + hub: + hub_store: + hub_redis: + + +volumes: + postgres_data: + pgadmin-data: diff --git a/edge/docker/mosquitto/config/mosquitto.conf b/edge/docker/mosquitto/config/mosquitto.conf new file mode 100644 index 0000000..0394e8c --- /dev/null +++ b/edge/docker/mosquitto/config/mosquitto.conf @@ -0,0 +1,11 @@ +persistence true +persistence_location /mosquitto/data/ +listener 1883 +## Authentication ## +allow_anonymous true +# allow_anonymous false +# password_file /mosquitto/config/password.txt +## Log ## +log_dest file /mosquitto/log/mosquitto.log +log_dest stdout +# listener 1883 \ No newline at end of file diff --git a/edge/main.py b/edge/main.py index 55a933a..b2166a2 100644 --- a/edge/main.py +++ b/edge/main.py @@ -23,14 +23,14 @@ if __name__ == "__main__": ], ) # Create an instance of the StoreApiAdapter using the configuration - hub_adapter = HubHttpAdapter( - api_base_url=HUB_URL, - ) - # hub_adapter = HubMqttAdapter( - # broker=HUB_MQTT_BROKER_HOST, - # port=HUB_MQTT_BROKER_PORT, - # topic=HUB_MQTT_TOPIC, + # hub_adapter = HubHttpAdapter( + # api_base_url=HUB_URL, # ) + hub_adapter = HubMqttAdapter( + broker=HUB_MQTT_BROKER_HOST, + port=HUB_MQTT_BROKER_PORT, + topic=HUB_MQTT_TOPIC, + ) # Create an instance of the AgentMQTTAdapter using the configuration agent_adapter = AgentMQTTAdapter( broker_host=MQTT_BROKER_HOST, diff --git a/edge/requirements.txt b/edge/requirements.txt index eac1d86..fb27efa 100644 --- a/edge/requirements.txt +++ b/edge/requirements.txt @@ -1,43 +1,10 @@ -absl-py==2.0.0 -annotated-types==0.5.0 -astunparse==1.6.3 -cachetools==5.3.2 -certifi==2023.7.22 -charset-normalizer==3.2.0 -flatbuffers==23.5.26 -gast==0.5.4 -google-auth==2.25.2 -google-auth-oauthlib==1.2.0 -google-pasta==0.2.0 -grpcio==1.60.0 -h5py==3.10.0 -idna==3.4 -keras==2.15.0 -libclang==16.0.6 -Markdown==3.5.1 -MarkupSafe==2.1.3 -ml-dtypes==0.2.0 -numpy==1.26.2 -oauthlib==3.2.2 -opt-einsum==3.3.0 -packaging==23.2 +annotated-types==0.6.0 +certifi==2024.2.2 +charset-normalizer==3.3.2 +idna==3.6 paho-mqtt==1.6.1 -protobuf==4.23.4 -pyasn1==0.5.1 -pyasn1-modules==0.3.0 -pydantic==2.3.0 -pydantic_core==2.6.3 +pydantic==2.6.1 +pydantic_core==2.16.2 requests==2.31.0 -requests-oauthlib==1.3.1 -rsa==4.9 -six==1.16.0 -tensorboard==2.15.1 -tensorboard-data-server==0.7.2 -tensorflow==2.15.0.post1 -tensorflow-estimator==2.15.0 -tensorflow-io-gcs-filesystem==0.34.0 -termcolor==2.4.0 -typing_extensions==4.7.1 -urllib3==2.0.4 -Werkzeug==3.0.1 -wrapt==1.14.1 +typing_extensions==4.9.0 +urllib3==2.2.0