home.openhab: install and configure openhab
Some checks failed
kunsi/bundlewrap/pipeline/head There was a failure building this commit
Some checks failed
kunsi/bundlewrap/pipeline/head There was a failure building this commit
This commit is contained in:
parent
aa8f19d948
commit
f482874310
8 changed files with 213 additions and 3 deletions
62
bundles/openhab/files/openhab
Normal file
62
bundles/openhab/files/openhab
Normal file
|
@ -0,0 +1,62 @@
|
|||
# openHAB service options
|
||||
|
||||
#########################
|
||||
## PORTS
|
||||
## The ports openHAB will bind its HTTP/HTTPS web server to.
|
||||
|
||||
OPENHAB_HTTP_PORT=22090
|
||||
#OPENHAB_HTTPS_PORT=8443
|
||||
|
||||
#########################
|
||||
## HTTP(S) LISTEN ADDRESS
|
||||
## The listen address used by the HTTP(S) server.
|
||||
## 0.0.0.0 (default) allows a connection from any location
|
||||
## 127.0.0.1 only allows the local machine to connect
|
||||
|
||||
OPENHAB_HTTP_ADDRESS=127.0.0.1
|
||||
|
||||
#########################
|
||||
## BACKUP DIRECTORY
|
||||
## Set the following variable to specify the backup location.
|
||||
## runtime/bin/backup and runtime/bin/restore will use this path for the zip files.
|
||||
|
||||
#OPENHAB_BACKUPS=/var/lib/openhab/backups
|
||||
|
||||
#########################
|
||||
## JAVA OPTIONS
|
||||
## Additional options for the JAVA_OPTS environment variable.
|
||||
## These will be appended to the execution of the openHAB Java runtime in front of all other options.
|
||||
##
|
||||
## A couple of independent examples:
|
||||
## EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyZWAVE:/dev/ttyUSB0:/dev/ttyS0:/dev/ttyS2:/dev/ttyACM0:/dev/ttyAMA0"
|
||||
## EXTRA_JAVA_OPTS="-Djna.library.path=/lib/arm-linux-gnueabihf/ -Duser.timezone=Europe/Berlin -Dgnu.io.rxtx.SerialPorts=/dev/ttyZWave"
|
||||
|
||||
EXTRA_JAVA_OPTS="${extra_java_opts}"
|
||||
|
||||
#########################
|
||||
## OPENHAB DEFAULTS PATHS
|
||||
## The following settings override the default apt/rpm locations and should be used with caution.
|
||||
## openHAB will fail to update itself if you're using different paths.
|
||||
## Only set these if you are testing and are confident in debugging.
|
||||
|
||||
#OPENHAB_HOME=/usr/share/openhab
|
||||
#OPENHAB_CONF=/etc/openhab
|
||||
#OPENHAB_RUNTIME=/usr/share/openhab/runtime
|
||||
#OPENHAB_USERDATA=/var/lib/openhab
|
||||
#OPENHAB_LOGDIR=/var/log/openhab
|
||||
|
||||
#########################
|
||||
## OPENHAB USER AND GROUP
|
||||
## The user and group that takes ownership of openHAB. Only available for init.d systems.
|
||||
## To edit user and group for systemd, see the service file at /usr/lib/systemd/system/openhab.service.
|
||||
|
||||
#OPENHAB_USER=openhab
|
||||
#OPENHAB_GROUP=openhab
|
||||
|
||||
#########################
|
||||
## SYSTEMD START MODE
|
||||
## The Karaf startmode for the openHAB runtime. Only available for systemctl/systemd systems.
|
||||
## Defaults to daemon when unset here. Multiple options can be used without quotes.
|
||||
## debug increases log output. daemon launches the Karaf/openHAB processes.
|
||||
|
||||
#OPENHAB_STARTMODE=debug
|
28
bundles/openhab/items.py
Normal file
28
bundles/openhab/items.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
extra_java_opts = []
|
||||
|
||||
for opt, value in sorted(node.metadata.get('openhab/java_opts', {}).items()):
|
||||
if value is None:
|
||||
extra_java_opts.append(f'-D{opt}')
|
||||
else:
|
||||
extra_java_opts.append(f'-D{opt}={value}')
|
||||
|
||||
files = {
|
||||
'/etc/default/openhab': {
|
||||
'content_type': 'mako',
|
||||
'context': {
|
||||
'extra_java_opts': ' '.join(extra_java_opts),
|
||||
},
|
||||
'triggers': {
|
||||
'svc_systemd:openhab:restart',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
svc_systemd = {
|
||||
'openhab': {
|
||||
'needs': {
|
||||
'pkg_apt:openhab',
|
||||
'pkg_apt:openhab-addons',
|
||||
},
|
||||
},
|
||||
}
|
54
bundles/openhab/metadata.py
Normal file
54
bundles/openhab/metadata.py
Normal file
|
@ -0,0 +1,54 @@
|
|||
defaults = {
|
||||
'apt': {
|
||||
'packages': {
|
||||
'openjdk-11-jre': {},
|
||||
'openhab': {
|
||||
'needs': {
|
||||
'pkg_apt:openjdk-11-jre',
|
||||
},
|
||||
},
|
||||
'openhab-addons': {
|
||||
'needs': {
|
||||
'pkg_apt:openhab',
|
||||
},
|
||||
},
|
||||
},
|
||||
'repos': {
|
||||
'openhab': {
|
||||
'items': {
|
||||
'deb https://openhab.jfrog.io/artifactory/openhab-linuxpkg stable main',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
'backups': {
|
||||
'paths': {
|
||||
'/var/lib/openhab',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@metadata_reactor.provides(
|
||||
'nginx/vhosts/openhab',
|
||||
)
|
||||
def nginx(metadata):
|
||||
if not node.has_bundle('nginx'):
|
||||
raise DoNotRunAgain
|
||||
|
||||
return {
|
||||
'nginx': {
|
||||
'vhosts': {
|
||||
'openhab': {
|
||||
'domain': metadata.get('openhab/domain'),
|
||||
'locations': {
|
||||
'/': {
|
||||
'target': 'http://localhost:22090/',
|
||||
},
|
||||
},
|
||||
'website_check_path': '/',
|
||||
'website_check_string': 'opnHAB',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue