From a187ec64e1175f8a95856bce86d297a9a65ecf2c Mon Sep 17 00:00:00 2001 From: Philipp Grathwohl Date: Wed, 16 Feb 2022 14:20:26 +0000 Subject: [PATCH] Add default configuration for development environment --- .devcontainer/Dockerfile | 10 +- .devcontainer/cbpi-dev-config/actor.json | 3 + .../cbpi-dev-config/chromium.desktop | 6 + .devcontainer/cbpi-dev-config/config.json | 335 ++++++++++++++++++ .devcontainer/cbpi-dev-config/config.yaml | 20 ++ .../cbpi-dev-config/craftbeerpi.service | 9 + .../dashboard/cbpi_dashboard_1.json | 3 + .../widgets/_widgets_are_placed_here | 0 .../cbpi-dev-config/fermenter_data.json | 3 + .devcontainer/cbpi-dev-config/kettle.json | 3 + .devcontainer/cbpi-dev-config/sensor.json | 3 + .devcontainer/cbpi-dev-config/step_data.json | 6 + .../upload/_uploads_are_placed_here | 0 .devcontainer/createMqttUser.sh | 5 + .devcontainer/devcontainer.json | 7 +- .devcontainer/mosquitto/config/mosquitto.conf | 10 + .../mosquitto/config/mosquitto.passwd | 2 + .../mqtt-explorer/config/settings.json | 31 ++ 18 files changed, 452 insertions(+), 4 deletions(-) create mode 100644 .devcontainer/cbpi-dev-config/actor.json create mode 100644 .devcontainer/cbpi-dev-config/chromium.desktop create mode 100644 .devcontainer/cbpi-dev-config/config.json create mode 100644 .devcontainer/cbpi-dev-config/config.yaml create mode 100644 .devcontainer/cbpi-dev-config/craftbeerpi.service create mode 100644 .devcontainer/cbpi-dev-config/dashboard/cbpi_dashboard_1.json create mode 100644 .devcontainer/cbpi-dev-config/dashboard/widgets/_widgets_are_placed_here create mode 100644 .devcontainer/cbpi-dev-config/fermenter_data.json create mode 100644 .devcontainer/cbpi-dev-config/kettle.json create mode 100644 .devcontainer/cbpi-dev-config/sensor.json create mode 100644 .devcontainer/cbpi-dev-config/step_data.json create mode 100644 .devcontainer/cbpi-dev-config/upload/_uploads_are_placed_here create mode 100644 .devcontainer/createMqttUser.sh create mode 100644 .devcontainer/mosquitto/config/mosquitto.conf create mode 100644 .devcontainer/mosquitto/config/mosquitto.passwd create mode 100644 .devcontainer/mqtt-explorer/config/settings.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index d1b5c0b..732ba18 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,6 +1,12 @@ -ARG VARIANT=3-bullseye -FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} +FROM mcr.microsoft.com/vscode/devcontainers/python:3.9-bullseye +RUN apt-get update \ + && apt-get upgrade -y +RUN apt-get install --no-install-recommends -y \ + libatlas-base-dev \ + libffi-dev \ + python3-pip \ + && rm -rf /var/lib/apt/lists/* RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel # Install craftbeerpi requirements for better caching diff --git a/.devcontainer/cbpi-dev-config/actor.json b/.devcontainer/cbpi-dev-config/actor.json new file mode 100644 index 0000000..ce96464 --- /dev/null +++ b/.devcontainer/cbpi-dev-config/actor.json @@ -0,0 +1,3 @@ +{ + "data": [] +} \ No newline at end of file diff --git a/.devcontainer/cbpi-dev-config/chromium.desktop b/.devcontainer/cbpi-dev-config/chromium.desktop new file mode 100644 index 0000000..a112515 --- /dev/null +++ b/.devcontainer/cbpi-dev-config/chromium.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Type=Application +Name=Chromium +Comment=Chromium Webbrowser +NoDisplay=false +Exec=chromium-browser --noerrordialogs --disable-session-crashed-bubble --disable-infobars --force-device-scale-factor=1.00 --start-fullscreen "http://localhost:8000" diff --git a/.devcontainer/cbpi-dev-config/config.json b/.devcontainer/cbpi-dev-config/config.json new file mode 100644 index 0000000..f6899f3 --- /dev/null +++ b/.devcontainer/cbpi-dev-config/config.json @@ -0,0 +1,335 @@ +{ + "AUTHOR": { + "description": "Author", + "name": "AUTHOR", + "options": null, + "type": "string", + "value": "John Doe" + }, + "AddMashInStep": { + "description": "Add MashIn Step automatically if not defined in recipe", + "name": "AddMashInStep", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "select", + "value": "Yes" + }, + "AutoMode": { + "description": "Use AutoMode in steps", + "name": "AutoMode", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "select", + "value": "Yes" + }, + "BREWERY_NAME": { + "description": "Brewery Name", + "name": "BREWERY_NAME", + "options": null, + "type": "string", + "value": "CraftBeerPi Brewery" + }, + "BoilKettle": { + "description": "Define Kettle that is used for Boil, Whirlpool and Cooldown. If not selected, MASH_TUN will be used", + "name": "BoilKettle", + "options": null, + "type": "kettle", + "value": "" + }, + "CBPI_TEST_3": { + "description": "test", + "name": "CBPI_TEST_3", + "options": null, + "type": "string", + "value": "1" + }, + "CSVLOGFILES": { + "description": "Write sensor data to csv logfiles", + "name": "CSVLOGFILES", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "select", + "value": "Yes" + }, + "INFLUXDB": { + "description": "Write sensor data to influxdb", + "name": "INFLUXDB", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "select", + "value": "No" + }, + "INFLUXDBADDR": { + "description": "IP Address of your influxdb server (If INFLUXDBCLOUD set to Yes use URL Address of your influxdb cloud server)", + "name": "INFLUXDBADDR", + "options": null, + "type": "string", + "value": "localhost" + }, + "INFLUXDBCLOUD": { + "description": "Write sensor data to influxdb cloud (INFLUXDB must set to Yes)", + "name": "INFLUXDBCLOUD", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "select", + "value": "No" + }, + "INFLUXDBNAME": { + "description": "Name of your influxdb database name (If INFLUXDBCLOUD set to Yes use bucket of your influxdb cloud database)", + "name": "INFLUXDBNAME", + "options": null, + "type": "string", + "value": "cbpi4" + }, + "INFLUXDBPORT": { + "description": "Port of your influxdb server", + "name": "INFLUXDBPORT", + "options": null, + "type": "string", + "value": "8086" + }, + "INFLUXDBPWD": { + "description": "Password for your influxdb database (only if required)(If INFLUXDBCLOUD set to Yes use token of your influxdb cloud database)", + "name": "INFLUXDBPWD", + "options": null, + "type": "string", + "value": " " + }, + "INFLUXDBUSER": { + "description": "User name for your influxdb database (only if required)(If INFLUXDBCLOUD set to Yes use organisation of your influxdb cloud database)", + "name": "INFLUXDBUSER", + "options": null, + "type": "string", + "value": " " + }, + "MASH_TUN": { + "description": "Default Mash Tun", + "name": "MASH_TUN", + "options": null, + "type": "kettle", + "value": "" + }, + "MQTTUpdate": { + "description": "Forced MQTT Update frequency in s for Kettle and Fermenter (no changes in payload required). Restart required after change", + "name": "MQTTUpdate", + "options": [ + { + "label": "30", + "value": 30 + }, + { + "label": "60", + "value": 60 + }, + { + "label": "120", + "value": 120 + }, + { + "label": "300", + "value": 300 + }, + { + "label": "Never", + "value": 0 + } + ], + "type": "select", + "value": 0 + }, + "RECIPE_CREATION_PATH": { + "description": "API path to creation plugin. Default: upload . CHANGE ONLY IF USING A RECIPE CREATION PLUGIN", + "name": "RECIPE_CREATION_PATH", + "options": null, + "type": "string", + "value": "upload" + }, + "TEMP_UNIT": { + "description": "Temperature Unit", + "name": "TEMP_UNIT", + "options": [ + { + "label": "C", + "value": "C" + }, + { + "label": "F", + "value": "F" + } + ], + "type": "select", + "value": "C" + }, + "brewfather_api_key": { + "description": "Brewfather API Key", + "name": "brewfather_api_key", + "options": null, + "type": "string", + "value": "" + }, + "brewfather_user_id": { + "description": "Brewfather User ID", + "name": "brewfather_user_id", + "options": null, + "type": "string", + "value": "" + }, + "current_dashboard_number": { + "description": "Number of current Dashboard", + "name": "current_dashboard_number", + "options": null, + "type": "number", + "value": 1 + }, + "max_dashboard_number": { + "description": "Max Number of Dashboards", + "name": "max_dashboard_number", + "options": [ + { + "label": "1", + "value": 1 + }, + { + "label": "2", + "value": 2 + }, + { + "label": "3", + "value": 3 + }, + { + "label": "4", + "value": 4 + }, + { + "label": "5", + "value": 5 + }, + { + "label": "6", + "value": 6 + }, + { + "label": "7", + "value": 7 + }, + { + "label": "8", + "value": 8 + }, + { + "label": "9", + "value": 9 + }, + { + "label": "10", + "value": 10 + } + ], + "type": "select", + "value": 4 + }, + "steps_boil": { + "description": "Boil step type", + "name": "steps_boil", + "options": null, + "type": "step", + "value": "BoilStep" + }, + "steps_boil_temp": { + "description": "Default Boil Temperature for Recipe Creation", + "name": "steps_boil_temp", + "options": null, + "type": "number", + "value": "99" + }, + "steps_cooldown": { + "description": "Cooldown step type", + "name": "steps_cooldown", + "options": null, + "type": "step", + "value": "CooldownStep" + }, + "steps_cooldown_actor": { + "description": "Actor to trigger cooldown water on and off (default: None)", + "name": "steps_cooldown_actor", + "options": null, + "type": "actor", + "value": "" + }, + "steps_cooldown_sensor": { + "description": "Alternative Sensor to monitor temperature durring cooldown (if not selected, Kettle Sensor will be used)", + "name": "steps_cooldown_sensor", + "options": null, + "type": "sensor", + "value": "" + }, + "steps_cooldown_temp": { + "description": "Cooldown temp will send notification when this temeprature is reached", + "name": "steps_cooldown_temp", + "options": null, + "type": "number", + "value": "20" + }, + "steps_mash": { + "description": "Mash step type", + "name": "steps_mash", + "options": null, + "type": "step", + "value": "MashStep" + }, + "steps_mashin": { + "description": "MashIn step type", + "name": "steps_mashin", + "options": null, + "type": "step", + "value": "MashInStep" + }, + "steps_mashout": { + "description": "MashOut step type", + "name": "steps_mashout", + "options": null, + "type": "step", + "value": "NotificationStep" + } +} \ No newline at end of file diff --git a/.devcontainer/cbpi-dev-config/config.yaml b/.devcontainer/cbpi-dev-config/config.yaml new file mode 100644 index 0000000..da4fa18 --- /dev/null +++ b/.devcontainer/cbpi-dev-config/config.yaml @@ -0,0 +1,20 @@ + +name: CraftBeerPi +version: 4.0.8 + +index_url: /cbpi_ui/static/index.html + +port: 8000 + +mqtt: true +mqtt_host: mqtt +mqtt_port: 1883 +mqtt_username: craftbeerpi +mqtt_password: cbpiSuperSecMq77! + +username: cbpi +password: 123 + +plugins: +- cbpi4ui + diff --git a/.devcontainer/cbpi-dev-config/craftbeerpi.service b/.devcontainer/cbpi-dev-config/craftbeerpi.service new file mode 100644 index 0000000..cd02dce --- /dev/null +++ b/.devcontainer/cbpi-dev-config/craftbeerpi.service @@ -0,0 +1,9 @@ +[Unit] +Description=Craftbeer Pi + +[Service] +WorkingDirectory=/home/pi +ExecStart=/usr/local/bin/cbpi start + +[Install] +WantedBy=multi-user.target diff --git a/.devcontainer/cbpi-dev-config/dashboard/cbpi_dashboard_1.json b/.devcontainer/cbpi-dev-config/dashboard/cbpi_dashboard_1.json new file mode 100644 index 0000000..92079a0 --- /dev/null +++ b/.devcontainer/cbpi-dev-config/dashboard/cbpi_dashboard_1.json @@ -0,0 +1,3 @@ +{ + "elements": [] +} \ No newline at end of file diff --git a/.devcontainer/cbpi-dev-config/dashboard/widgets/_widgets_are_placed_here b/.devcontainer/cbpi-dev-config/dashboard/widgets/_widgets_are_placed_here new file mode 100644 index 0000000..e69de29 diff --git a/.devcontainer/cbpi-dev-config/fermenter_data.json b/.devcontainer/cbpi-dev-config/fermenter_data.json new file mode 100644 index 0000000..ce96464 --- /dev/null +++ b/.devcontainer/cbpi-dev-config/fermenter_data.json @@ -0,0 +1,3 @@ +{ + "data": [] +} \ No newline at end of file diff --git a/.devcontainer/cbpi-dev-config/kettle.json b/.devcontainer/cbpi-dev-config/kettle.json new file mode 100644 index 0000000..ce96464 --- /dev/null +++ b/.devcontainer/cbpi-dev-config/kettle.json @@ -0,0 +1,3 @@ +{ + "data": [] +} \ No newline at end of file diff --git a/.devcontainer/cbpi-dev-config/sensor.json b/.devcontainer/cbpi-dev-config/sensor.json new file mode 100644 index 0000000..ce96464 --- /dev/null +++ b/.devcontainer/cbpi-dev-config/sensor.json @@ -0,0 +1,3 @@ +{ + "data": [] +} \ No newline at end of file diff --git a/.devcontainer/cbpi-dev-config/step_data.json b/.devcontainer/cbpi-dev-config/step_data.json new file mode 100644 index 0000000..fa93cc6 --- /dev/null +++ b/.devcontainer/cbpi-dev-config/step_data.json @@ -0,0 +1,6 @@ +{ + "basic": { + "name": "" + }, + "steps": [] +} \ No newline at end of file diff --git a/.devcontainer/cbpi-dev-config/upload/_uploads_are_placed_here b/.devcontainer/cbpi-dev-config/upload/_uploads_are_placed_here new file mode 100644 index 0000000..e69de29 diff --git a/.devcontainer/createMqttUser.sh b/.devcontainer/createMqttUser.sh new file mode 100644 index 0000000..0498e8d --- /dev/null +++ b/.devcontainer/createMqttUser.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +USER=craftbeerpi +PASSWORD=craftbeerpi +docker run -it --rm -v "$(pwd)/mosquitto/config/mosquitto.passwd:/opt/passwdfile" eclipse-mosquitto:2 mosquitto_passwd -b /opt/passwdfile $USER $PASSWORD \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9490202..08f216c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,7 +2,7 @@ // https://github.com/microsoft/vscode-dev-containers/tree/v0.177.0/containers/docker-existing-docker-compose // If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. { - "name": "CraftBeerPi4 Development Container", + "name": "CraftBeerPi4", // Update the 'dockerComposeFile' list if you have more compose files or use different names. // The .devcontainer/docker-compose.yml file contains any overrides you need/want to make. @@ -32,7 +32,10 @@ ], // Use 'forwardPorts' to make a list of ports inside the container available locally. - "forwardPorts": [80], + "forwardPorts": [ + "craftbeerpi4-development:8000", + "mqtt-explorer:4000" + ], // Uncomment the next line if you want start specific services in your Docker Compose config. // "runServices": [], diff --git a/.devcontainer/mosquitto/config/mosquitto.conf b/.devcontainer/mosquitto/config/mosquitto.conf new file mode 100644 index 0000000..ea00761 --- /dev/null +++ b/.devcontainer/mosquitto/config/mosquitto.conf @@ -0,0 +1,10 @@ +persistence true +persistence_location /mosquitto/data + +log_dest file /mosquitto/log/mosquitto.log +log_dest stdout + +password_file /mosquitto/config/mosquitto.passwd +allow_anonymous false + +port 1883 diff --git a/.devcontainer/mosquitto/config/mosquitto.passwd b/.devcontainer/mosquitto/config/mosquitto.passwd new file mode 100644 index 0000000..3799476 --- /dev/null +++ b/.devcontainer/mosquitto/config/mosquitto.passwd @@ -0,0 +1,2 @@ +craftbeerpi:$7$101$cRIEIwJ9L/+TAFF1$lxT+v9SisokWaRBgB/Scut7DaotH4RMgzHttYHhwuy6m5yatSoac7bwrkztoQ7raNehBhKt/A4VVejnzozdxXA== +mqtt-explorer:$7$101$SFFKvbIBVXFFAIBp$Pgue6DaAfcuhegjEqtTjf+WWgNZ8geiv1/3fXqmJ0APmd0L80wNTSrEhnFdJmHvi0/vW6V9bVKPJfVRDIjPxCw== diff --git a/.devcontainer/mqtt-explorer/config/settings.json b/.devcontainer/mqtt-explorer/config/settings.json new file mode 100644 index 0000000..826101c --- /dev/null +++ b/.devcontainer/mqtt-explorer/config/settings.json @@ -0,0 +1,31 @@ +{ + "ConnectionManager_connections": { + "mqtt.eclipse.org": { + "configVersion": 1, + "certValidation": true, + "clientId": "mqtt-explorer-8eb042b9", + "id": "mqtt.eclipse.org", + "name": "CraftBeerPi MQTT Explorer", + "encryption": false, + "subscriptions": [ + { + "topic": "#", + "qos": 0 + }, + { + "topic": "$SYS/#", + "qos": 0 + } + ], + "type": "mqtt", + "host": "mqtt", + "port": 1883, + "protocol": "mqtt", + "changeSet": { + "password": "mqtt-explorer" + }, + "username": "mqtt-explorer", + "password": "mqtt-explorer" + } + } +} \ No newline at end of file