Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/#64 introduce docker compose for bco dist #143

Draft
wants to merge 7 commits into
base: dev
Choose a base branch
from
5 changes: 5 additions & 0 deletions docker/deploy_demo.sh
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions docker/deploy_homecube.sh
Original file line number Diff line number Diff line change
@@ -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
44 changes: 44 additions & 0 deletions docker/docker-compose-demo.yaml
Original file line number Diff line number Diff line change
@@ -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
139 changes: 139 additions & 0 deletions docker/docker-compose-homecube.yaml
Original file line number Diff line number Diff line change
@@ -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:
29 changes: 0 additions & 29 deletions docker/docker-compose-homecube.yml

This file was deleted.