From 3740da12b203f394997870428c70899629e8fb73 Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Sun, 27 Oct 2019 13:44:08 +0200 Subject: [PATCH] Added homeautomation docker stuff Signed-off-by: Marko Korhonen --- home-automation/.gitignore | 1 + home-automation/docker-compose.yml | 59 ++++++++++++++++++++++++++++++ home-automation/init.sh | 12 ++++++ 3 files changed, 72 insertions(+) create mode 100644 home-automation/.gitignore create mode 100644 home-automation/docker-compose.yml create mode 100755 home-automation/init.sh diff --git a/home-automation/.gitignore b/home-automation/.gitignore new file mode 100644 index 0000000..4c49bd7 --- /dev/null +++ b/home-automation/.gitignore @@ -0,0 +1 @@ +.env diff --git a/home-automation/docker-compose.yml b/home-automation/docker-compose.yml new file mode 100644 index 0000000..fd11c77 --- /dev/null +++ b/home-automation/docker-compose.yml @@ -0,0 +1,59 @@ +version: '3' +services: + home-assistant: + container_name: home-assistant + image: homeassistant/home-assistant + volumes: + - /homeautomation-config/home-assistant:/config + - /etc/localtime:/etc/localtime:ro + restart: unless-stopped + network_mode: host + depends_on: + - mariadb + - deconz + + mariadb: + image: mariadb/server:10.3 + container_name: mariadb + restart: unless-stopped + environment: + MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD}" + MYSQL_DATABASE: ha_db + MYSQL_PASSWORD: "${HA_MYSQL_PASSWORD}" + volumes: + - /homeautomation-config/mariadb:/var/lib/mysql + ports: + - "3306:3306" + + deconz: + container_name: deconz + image: marthoc/deconz + restart: always + network_mode: host + environment: + DECONZ_VNC_MODE: 1 + DECONZ_VNC_PORT: 5950 + DECONZ_VNC_PASSWORD: "${DECONZ_VNC_PASSWORD}" + ports: + - "8083:80" + - "8084:443" + - "5900:5950" + volumes: + - /etc/localtime:/etc/localtime:ro + - /homeautomation-config/deconz:/root/.local/share/dresden-elektronik/deCONZ + devices: + - "/dev/ttyACM0" + + nodered: + container_name: nodered + image: nodered/node-red + ports: + - "1880:1880" + volumes: + # Local path where all Node-RED config will be stored. + - /homeautomation-config/node-red:/data + depends_on: + - home-assistant + environment: + TZ: "Europe/Helsinki" + restart: unless-stopped diff --git a/home-automation/init.sh b/home-automation/init.sh new file mode 100755 index 0000000..53ca63b --- /dev/null +++ b/home-automation/init.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +sudo mkdir -p /homeautomation-config/node-red +sudo chmod -R a+rw /homeautomation-config/node-red + +cat < .env +MYSQL_ROOT_PASSWORD="$(pass reekynet/docker-home-automation | rg 'MYSQL_ROOT_PASSWORD' | cut -d' ' -f2-)" +HA_MYSQL_PASSWORD="$(pass reekynet/docker-home-automation | rg 'HA_MYSQL_PASSWORD' | cut -d' ' -f2-)" +DECONZ_VNC_PASSWORD="$(pass reekynet/docker-home-automation | rg 'DECONZ_VNC_PASSWORD' | cut -d' ' -f2-)" +ENV + +docker-compose up