diff --git a/docker-compose.yml b/docker-compose.yml index f7257d4..c9cde15 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,10 +30,33 @@ - "${OPENHAB_OSGI_BIND:-127.0.0.1}:${OPENHAB_OSGI_PORT:-5555}:5555" networks: openhab-network: - ipv4_address: 172.55.55.100 + ipv4_address: ${IPV4_NETWORK:-172.55.55}.100 aliases: - openhab-main + db-openhab: + image: mariadb:10.3 + restart: always + command: mysqld --skip-name-resolve --skip-host-cache --log-warnings=0 + healthcheck: + test: ["CMD", "mysqladmin", "-u$OPENHAB_DATABASE_USER", "-p$OPENHAB_DATABASE_PASSWORD", "ping", "-h", "localhost"] + interval: 30s + timeout: 30s + retries: 10 + environment: + - MYSQL_ROOT_PASSWORD=${OPENHAB_DATABASE_ROOT} + - MYSQL_DATABASE=${OPENHAB_DATABASE_NAME} + - MYSQL_USER=${OPENHAB_DATABASE_USER} + - MYSQL_PASSWORD=${OPENHAB_DATABASE_PASSWORD} + volumes: + - ./data/db/:/var/lib/mysql/ + - ./data/conf/mysql:/etc/mysql/conf.d/:ro + networks: + openhab-network: + ipv4_address: ${IPV4_NETWORK:-172.55.55}.101 + aliases: + - openhab-db + networks: openhab-network: @@ -42,5 +65,5 @@ ipam: driver: default config: - - subnet: 172.55.55.0/24 + - subnet: ${IPV4_NETWORK:-172.55.55}.0/24 diff --git a/install.sh b/install.sh index 92e2000..5286055 100755 --- a/install.sh +++ b/install.sh @@ -17,6 +17,14 @@ # replace uid and gid in config file sed -i "/^OPENHAB_USER/c\\\OPENHAB_USER_ID=${uid}" openhab.conf + # db passwords + pw1=$(