gavinying / modpoll

A New Command-line Tool for Modbus and MQTT
https://gavinying.github.io/modpoll
MIT License
84 stars 17 forks source link

docker compose file example is missing #18

Closed martin8310 closed 8 months ago

martin8310 commented 1 year ago

Hello,

Could you add a Docker compose file in your description?

which I would find good in the compose file:

Thank you in advance.

regards Martin

gavinying commented 1 year ago

Here is an example of modpoll usage in actual project, just for your reference.

version: '2'

volumes:
  mosquitto-data:

services:
  modpoll:
    image: helloysd/modpoll
    container_name: modpoll
    restart: unless-stopped
    depends_on:
      - mosquitto
    volumes:
      - ./modpoll/config/:/app/config/
    command: modpoll --tcp 192.168.133.85 --mqtt-host mosquitto --mqtt-topic-prefix project/9739518/sensor_data/ --mqtt-qos 1 --rate 30 --timeout 5 --interval 1 --timestamp --config config/modpoll_config_v4.csv

  mosquitto:
    image: helloysd/mosquitto
    container_name: mosquitto
    restart: unless-stopped
    volumes:
      - ./mosquitto/config:/mosquitto/config
      - mosquitto-data:/mosquitto/data
    ports:
      - 1883:1883

For the network, you can use either bridge or host, depends on your project needs. The above example uses the default bridge. Hope it helps.

Shaodong