From f3626a6ac541738d58e311da9d76bf4235565d06 Mon Sep 17 00:00:00 2001 From: Blaise Thompson Date: Thu, 3 Dec 2020 11:02:35 -0600 Subject: fix up website --- README.md | 14 ++++++++++---- docker-compose.yml | 4 ++++ web/index.html | 49 ++++++++++++++++++++++++++++++++++--------------- 3 files changed, 48 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 7efd50d..9226cf4 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,25 @@ # mqtt -Documentation and source code for departmental mqtt server hosted at https://mosquitto.chem.wisc.edu. +Documentation and source code for the departmental mqtt server hosted at https://mqtt.chem.wisc.edu. To prepare (starting with Ubuntu 20.04) ``` $ apt install docker.io -$ apt install docker compose +$ apt install docker-compose ``` This machine needs the following ports to be open to the campus network: -- 80 (http) +- 80 (http) (used via reverse proxy) - 1883 (mqtt) - 8086 (influxdb) To run: ``` $ docker-compose up -d --build -``` \ No newline at end of file +``` + +Volumes: + +This compose file will create a docker volume `mqtt_influxdb`. +This volume contains the influx database itself and should be backed up. +On the host machine it appears at `/var/lib/docker/volumes/mqtt_influxdb/`. \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 8a7a5e2..ad5fcc4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,8 @@ services: broker: build: ./mosquitto restart: unless-stopped + ports: + - 1883:1883 db: build: ./influxdb restart: unless-stopped @@ -19,6 +21,8 @@ services: - db env_file: - ./influxdb.env + ports: + - 8086:8086 web: build: ./web restart: unless-stopped diff --git a/web/index.html b/web/index.html index 59e3aeb..da135fc 100644 --- a/web/index.html +++ b/web/index.html @@ -9,7 +9,7 @@ -

mosquitto.chem.wisc.edu

+

mqtt.chem.wisc.edu


@@ -24,12 +24,7 @@ In particular, this server hosts:

-This server is purposefully isolated to the campus network.
-If you are reading this, congrats---you're on the network. -

- -

-This server is maintained by Blaise Thompson and Alan Silver.
+This server is maintained by Blaise Thompson and Chemistry Comphelp.
Please contact them with any questions or concerns.

@@ -56,9 +51,18 @@ We recommend:
  • paho (many languages)
  • +

    +To see all topic updates on your command line: +

    + +
    
    +mosquitto_sub -h mqtt.chem.wisc.edu -t "#" --verbose
    +
    +
    +

    You'll need a password to publish to this broker. -Talk to Blaise Thompson or Alan Silver if you want to start publishing. +Talk to Blaise Thompson or Chemistry Comphelp if you want to start publishing.

    influxdb

    @@ -70,7 +74,6 @@ This structure introduces a "device" topology.

    This server stores all homie device history to an influx time-series database. -Anyone on the campus network can query this database. Importantly, only homie-convention compliant MQTT topics are stored---other published topics are not recorded in any permanent way.

    @@ -85,12 +88,25 @@ Homie data is written to the database with each node corresponding to one field. All of the additional information that is represented within the homie hierarchy is stored as tags.

    +

    +Anyone on the campus network can query this database using the following read-only account: +

    + +
    
    +username: user
    +password: xtssxgxy
    +
    +
    +

    The following example will return all of the recorded "temperature" measurements within the last one day using curl.

    
    -curl -G 'mosquitto.chem.wisc.edu:8086/query?pretty=true' --data-urlencode "db=homie" --data-urlencode "q=SELECT \"value\" FROM \"temperature\" WHERE time > now() - 1d"
    +curl -u user:xtssxgxy \
    +-G "mqtt.chem.wisc.edu:8086/query?pretty=true" \
    +--data-urlencode "db=homie" \
    +--data-urlencode "q=SELECT value FROM temperature WHERE time > now()-1d"
     
     
    @@ -101,22 +117,25 @@ The following example will return all of the recorded "temperature" measurements
    
     import influxdb
     
    -client = influxdb.InfluxDBClient(host="mosquitto.chem.wisc.edu",
    -                                 database="homie")
    +client = influxdb.InfluxDBClient(host="mqtt.chem.wisc.edu",
    +                                 database="homie",
    +                                 username="user",
    +                                 password="xtssxgxy")
     
    -result = c.query("SELECT value FROM temperature WHERE time > now() - 1d")
    +result = client.query("SELECT value FROM temperature WHERE time > now()-1d")
     
     

    We have also set-up a grafana appliance with this database as a source. -Check it out at grafana.chem.wisc.edu. +You will need Chemistry Department LDAP credentials to log in. +Check it out at grafana.chem.wisc.edu.


    -source +source                                                         CC0: no copyright

    -- cgit v1.2.3