diff --git a/docker/deploy_demo.sh b/docker/deploy_demo.sh new file mode 100755 index 000000000..f925e59cf --- /dev/null +++ b/docker/deploy_demo.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +echo -e "allow_anonymous true\nlistener 1883" > $HOME/.mosquitto.conf + +docker compose -f docker-compose-demo.yaml up -d --force-recreate \ No newline at end of file diff --git a/docker/deploy_homecube.sh b/docker/deploy_homecube.sh new file mode 100755 index 000000000..a9457045a --- /dev/null +++ b/docker/deploy_homecube.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +export DEFAULT_USER=$(whoami) +sudo usermod -aG docker ${DEFAULT_USER} + +echo -e "allow_anonymous true\nlistener 1883" > $HOME/.mosquitto.conf + +# Create users and groups +sudo adduser --system --shell /usr/sbin/nologin openhab +sudo addgroup --system openhab +sudo usermod -a -G openhab openhab +sudo usermod -a -G dialout openhab +sudo usermod -a -G tty openhab +sudo usermod -a -G openhab ${DEFAULT_USER} + +sudo adduser --system --shell /usr/sbin/nologin bco +sudo addgroup --system bco +sudo usermod -a -G bco bco +sudo usermod -a -G bco ${DEFAULT_USER} + +# Set environment variables +export USER_ID=$(id -u openhab) +export GROUP_ID=$(getent group openhab | cut -d: -f3) +export BCO_USER_ID=$(id -u bco) +export BCO_GROUP_ID=$(getent group bco | cut -d: -f3) + +sudo chmod -R g+rwX /var/lib/docker/volumes/openhab_conf/_data/sitemaps +sudo chgrp bco /var/lib/docker/volumes/openhab_conf/_data/sitemaps + +# Run docker-compose +docker compose -f docker-compose-homecube.yaml up --detach --force-recreate \ No newline at end of file diff --git a/docker/docker-compose-demo.yaml b/docker/docker-compose-demo.yaml new file mode 100644 index 000000000..27f7dfc57 --- /dev/null +++ b/docker/docker-compose-demo.yaml @@ -0,0 +1,44 @@ +networks: + bco-net: + name: bco-net + +services: + mosquitto: + image: eclipse-mosquitto + networks: + - bco-net + ports: + - "1883:1883" + volumes: + - $HOME/.mosquitto.conf:/mosquitto/config/mosquitto.conf + restart: always + logging: + driver: local + + bco-demo: + image: openbaseorg/bco-demo:stable + networks: + - bco-net + ports: + - "13781:13781" + volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro + environment: + BCO_OPTIONS: '--db /tmp/bco/db --simulate' + logging: + driver: local + tty: true + + bco-webapp: + image: opaal/bco-ui-albiorix:latest + networks: + - bco-net + ports: + - 80:80 + volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro + restart: always + logging: + driver: local \ No newline at end of file diff --git a/docker/docker-compose-homecube.yaml b/docker/docker-compose-homecube.yaml new file mode 100644 index 000000000..aeda9ff5a --- /dev/null +++ b/docker/docker-compose-homecube.yaml @@ -0,0 +1,139 @@ +services: + mqtt-broker: + image: eclipse-mosquitto + networks: + - bco-net + volumes: + - $HOME/.mosquitto.conf:/mosquitto/config/mosquitto.conf + ports: + - 1883:1883 + restart: always + logging: + driver: local + + openhab: + image: openhab/openhab:4.0.4 + networks: + - bco-net + volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro + - openhab_conf:/openhab/conf + - openhab_userdata:/openhab/userdata + - openhab_addons:/openhab/addons + ports: + - 8080:8080 + - 8443:8443 + environment: + - USER_ID=${USER_ID} + - GROUP_ID=${GROUP_ID} + - CRYPTO_POLICY=unlimited + restart: always + logging: + driver: local + + bco: + image: openbaseorg/bco:stable + networks: + - bco-net + volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro + - bco_data:/home/bco/data + ports: + - 13781:13781 + environment: + - USER_ID=${BCO_USER_ID} + - GROUP_ID=${BCO_GROUP_ID} + - BCO_OPTIONS='--host mqtt-broker' + restart: always + logging: + driver: local + tty: true + + bco-device-manager-openhab: + image: openbaseorg/bco-device-manager-openhab:stable + networks: + - bco-net + volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro + - bco_data:/home/bco/data + - openhab_conf:/etc/openhab2 + environment: + - USER_ID=${BCO_USER_ID} + - GROUP_ID=${BCO_GROUP_ID} + - OPENHAB_GROUP_ID=${OPENHAB_GROUP_ID} + - BCO_OPTIONS='--host mqtt-broker --openhab-url http://openhab:8080' + restart: always + logging: + driver: local + tty: true + + bco-webapp: + image: opaal/bco-ui-albiorix:latest + networks: + - bco-net + ports: + - 80:80 + volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro + restart: always + logging: + driver: local + + portainer: + image: portainer/portainer-ce + networks: + - bco-net + ports: + - 8000:8000 + - 9000:9000 + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - portainer_data:/data + restart: always + logging: + driver: local + + watchtower: + image: containrrr/watchtower:latest + networks: + - bco-net + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - /etc/timezone:/etc/timezone:ro + environment: + - WATCHTOWER_CLEANUP=true + - WATCHTOWER_INCLUDE_STOPPED=true + - WATCHTOWER_TIMEOUT=60 + restart: always + logging: + driver: local + + influxdb: + image: influxdb:latest + networks: + - bco-net + ports: + - 8086:8086 + volumes: + - influx_data:/var/lib/influxdb2 + - influx_config:/etc/influxdb2 + restart: always + logging: + driver: local + +networks: + bco-net: + name: bco-net + +volumes: + openhab_conf: + openhab_userdata: + openhab_addons: + bco_data: + influx_data: + influx_config: + portainer_data: \ No newline at end of file