diff --git a/.editorconfig b/.editorconfig index 32d69d6..c2cabf4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,3 @@ -# SPDX-License-Identifier: CC-BY-SA-4.0 - root = true [*] diff --git a/.envrc b/.envrc index 8c19926..14d7f00 100644 --- a/.envrc +++ b/.envrc @@ -1,5 +1,3 @@ -# SPDX-License-Identifier: GPL-3.0-or-later - # https://github.com/direnv/direnv/wiki use flake diff --git a/README.md b/README.md index e69de29..471ff97 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,7 @@ +# IoT Platform + +## Commands + +```sh +docker-compose --file software/container/docker-compose.yml up +``` diff --git a/mkdocs.yml b/mkdocs.yml index 4ea33e9..be84f37 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -78,4 +78,4 @@ extra_css: - stylesheets/extra.css copyright: > - Copyright © 2023 + Copyright © 2023 Curious Community Labs e. V. diff --git a/nix/shell.nix b/nix/shell.nix index e00557f..254a7af 100644 --- a/nix/shell.nix +++ b/nix/shell.nix @@ -6,13 +6,16 @@ with self.pkgs.${system}; [ # Development editorconfig-checker - pre-commit - python310Full - yaml-language-server + esptool + micropython nodePackages.node-red openscad - micropython - esptool + pre-commit + python310Full + python310Packages.mkdocs + python310Packages.mkdocs-material + python310Packages.mkdocs-material-extensions + yaml-language-server ] ++ lib.optionals (pkgs.hostPlatform.system == "x86_64-linux") [ vscodium-fhs diff --git a/software/container/.gitkeep b/software/container/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/software/container/docker-compose.yml b/software/container/docker-compose.yml new file mode 100644 index 0000000..4b360f4 --- /dev/null +++ b/software/container/docker-compose.yml @@ -0,0 +1,43 @@ +version: '3' +services: + mosquitto: + # https://hub.docker.com/_/eclipse-mosquitto + image: eclipse-mosquitto:2.0 + restart: always + ports: + - 1883:1883 + + influxdb: + # https://hub.docker.com/_/influxdb + image: influxdb:2.6 + restart: always + ports: + - 8086:8086 + + grafana: + # https://hub.docker.com/r/grafana/grafana + image: grafana/grafana:9.3.6 + depends_on: + - influxdb + restart: always + ports: + - 3000:3000 + volumes: + - ${DATA_DIR}/grafana:/var/lib/grafana + - ../dashboard/flows.json:/data/flows.json + + nodered: + # https://hub.docker.com/r/grafana/grafana + # https://nodered.org/docs/getting-started/docker + image: nodered/node-red:3.0.2 + depends_on: + - influxdb + restart: always + ports: + - 1880:1880 + environment: + - TZ=Europe/Berlin + - NODE_RED_ENABLE_PROJECTS=true + - FLOWS=flows.json + volumes: + - ../flow/flows.json:/data/flows.json diff --git a/software/flow/.gitkeep b/software/flow/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/software/flow/flows.json b/software/flow/flows.json new file mode 100644 index 0000000..b886ab7 --- /dev/null +++ b/software/flow/flows.json @@ -0,0 +1,27 @@ +[ + { + "id": "f6f2187d.f17ca8", + "type": "tab", + "label": "MQTT2Influxdb", + "disabled": false, + "info": "" + }, + { + "id": "ae14dbbaafe62be6", + "type": "tab", + "label": "CSV2Influxdb", + "disabled": false, + "info": "", + "env": [] + }, + { + "id": "3cc11d24.ff01a2", + "type": "comment", + "z": "f6f2187d.f17ca8", + "name": "WARNING: please check you have started this container with a volume that is mounted to /data\\n otherwise any flow changes are lost when you redeploy or upgrade the container\\n (e.g. upgrade to a more recent node-red docker image).\\n If you are using named volumes you can ignore this warning.\\n Double click or see info side panel to learn how to start Node-RED in Docker to save your work", + "info": "\nTo start docker with a bind mount volume (-v option), for example:\n\n```\ndocker run -it -p 1880:1880 -v /home/user/node_red_data:/data --name mynodered nodered/node-red\n```\n\nwhere `/home/user/node_red_data` is a directory on your host machine where you want to store your flows.\n\nIf you do not do this then you can experiment and redploy flows, but if you restart or upgrade the container the flows will be disconnected and lost. \n\nThey will still exist in a hidden data volume, which can be recovered using standard docker techniques, but that is much more complex than just starting with a named volume as described above.", + "x": 330, + "y": 100, + "wires": [] + } +]