The openHAB 2.5.0 Update Process - My Experience

That’s great! Making me consider the docker!

Yours was slightly smoother than my apt update. Although some of the bindings I use have had changes seems like in every milestone. That was the root of my issue.

@BrutalBirdie hello here :wave:

Just getting started with Docker / Docker Compose, my Linux skills are not much better and I have a ‘few’ questions :grinning:

Setup:

Questions:

  • docker-compose.yml
    • the openHAB docker guide sets user & group ID for the openHAB container - why is that no necessary in your setup? It seems like you are setting UID & GID only for the grafana container?
      According to the guide the IDs should part of the container parameters to avoid file permission issues - wouldn’t that mean, that they should be included into the settings for every container (aka open hab, InfluxDB, etc.)?
    • you are explicitly pointing to the individual application env-files (for example env.influxdb) is nothing like that necessary for the .env file?
    • does the .env file contain the UID &GID for the user openhab or some other user?
  • env.influxdb
    • Is the user ‘openhab_ro’ an read-only account for grafana (as used in Toms InfluxDB & Grafana Guide? Where do you tell Grafana to use that account?
  • start.sh
    • What does ‘_DIR_="$(cd “$(dirname “${0}”)”; pwd)"’ do?? Something like getting the current path?
  • Getting started:
    • How do I get started? Do I just copy your scripts into an empty folder, generate the subfolders mentioned in docker-compose.yml, change the standard passwords in env.influxdb and execute start.sh?

Sorry for all these noob questions, tried to answer as much as possible on my own with google, openHAB guides & docker guides :sweat_smile:

1 Like

Hey there @fex

Docker Hub

Expand README

User and group identifiers

Group id will default to the same value as the user id. By default the openHAB user in the container is running with:

  • uid=9001(openhab) gid=9001(openhab) groups=9001(openhab)

Make sure that either

  • You create the same user with the same uid and gid on your Docker host system
groupadd -g 9001 openhab
useradd -u 9001 -g openhab -r -s /sbin/nologin openhab
usermod -a -G openhab myownuser
  • Or run the Docker container with your own user AND passing the userid to openHAB through env
docker run \
(...)
-e USER_ID=<myownuserid> \
-e GROUP_ID=<myowngroupid> \
(...)

You can obtain your user and group ID by executing the id --user and id --group commands.

I will check that since I had no permission issue so far, might be because my user is also called openhab :grin:
edit: Checked you are right! I updated my setup to include UID:GID for openHAB but forgot to push it, sorry for that. github commit


The .env will be loaded default by docker-compose nothing else needed.
I just wanted to split up the “config” env for the services.
See docker docs environment-variables


No the openhab_ro user is an influx user which only has readonly permissions.
Grafana needs to be setup up by hand.
I will also take a look at this again If I am 100% correct.


Yep, this just set’s a variable for the “root” of the script path.
In case I update the script to jump around in folders the __DIR__ will always be the root of this script path.


Okay, I should create a better README got it :smiley:
Get Started:

  • Clone
  • run ./start.sh

This will “deploy” a new openHAB instance with all mentioned services.


Cheers :beer:

1 Like

Thx for your detailed and fast reply :smiley:

One follow up question in regard to the composer file - any difference between the following two options (you use both)?:

  • openhab:
    • USER_ID: ${UID}
    • GROUP_ID: ${GID}
  • grafana:
    • user: “${UID}:${GID}”

I defined in the .env file the GID und UID as 1000 since this should be the default UID and GID for the first user on linux.
Note to me… this should be in the README…

Grafan would use by default the UID and GID 472 thus I told grafana to use the defined 1000 in the .env

I think I got the .env file and the values for UID and GID - and I would think that you are using the values from the .env file in both cases.

My question is about the syntax - does the one liner ‘user: “${UID}:${GID}”’ result in something differently than the two lines ‘USER_ID: ${UID}’ & ‘GROUP_ID: ${GID}’?
I just noticed that you are using one form (the two lines) in the openhab section and the other form in the grafana section and I’m asking if these get different result…
My understanding in both cases would be that you’re telling docker to generate a user with the stated UID & GID - or am I wrong?

Ahhhh I miss read / misunderstood your question.

Well… openHAB docs stated they use USER_ID and GROUP_ID and grafana stated user: will work so I went with that. :grin:

I think I tried user: ${UID}:${GID} for openHAB and it did not work. (I THINK, I will try it again) so I followed the README and it worked.

I will just assume now, no professional statement now.

openHAB Docker decided to use USER_ID as a variable and grafana took UID that’s why.
UNPROFESSIONAL STATEMENT - DID NOT RESEARCH - TAKE WITH A GRAIN OF SALT :salt:

1 Like

And the next question :grinning:: You put all subfolders (other than openhab_addons) into the gitignore file.
Is that just because you don’t want their content in your eze-openHAB-docker repo, are you actually not versioning their content or do you use separate repos for them (aka one repo for docker related stuff, one for openhab config, another one for what do I know…):thinking:?

Exactly. The eze-openHAB-docker git is meant to be a template.

All the sub-folders are private data and are not meant to be in this git repository.

I backup and version openhab_conf etc with a git submodule and via crontab rsync to my private cloud.

1 Like

And another question - not directly related to your setup :grimacing:: Is it possible to use the OpenHAB Log Viewer with a openHAB Docker installation? Or is that one only available via openHABian?
I mean the web log viewer on port 9001 .

I believe what you are locking for is frontail
And yes this also works in docker :wink:

https://hub.docker.com/r/mthenw/frontail/

Means I would have to set up an an additional container for frontail, it doesn’t come with the openhab container, right?

I will prepare an example with docker-compose.
Give me a sec.


Nah will add it to the eze-openHAB-docker setup :smiley:

1 Like

@BrutalBirdie found an example for an openHAB frontail compose file

To get the css & and the json file I followed this advice from @Dim:

In your docker compose folder:

mkdir frontail
wget "https://raw.githubusercontent.com/openhab/openhabian/master/includes/frontail-theme.css" -O ./frontail/openhab.css
wget "https://raw.githubusercontent.com/openhab/openhabian/master/includes/frontail-preset.json" -O ./frontail/preset.json

With that I got an working container with the following config:

  frontail:
    image: "mthenw/frontail:latest"
    container_name: "frontail"
    restart: always
    network_mode: host
    command: --disable-usage-stats --ui-highlight --ui-highlight-preset /frontail/preset/openhab.json -t openhab -n 200 /logs/openhab.log /logs/events.log
    depends_on:
      - openhab
    volumes: 
      - "${PWD}/frontail/preset.json:/frontail/preset/openhab.json:ro"
      - "${PWD}/frontail/openhab.css:/frontail/web/assets/styles/openhab.css:ro"
      - "${PWD}/openhab_userdata/logs:/logs:ro"
    ports:
      - "8001:9001"

EDIT: Added advice how to find the openhab frontail css & json files

1 Like

@BrutalBirdie what do you use your UP Squared for?

@dmikester1
Oh well :smiley: I only wrote that I use the Pi3 for Emoncms.
I use the up² for the docker setup :slight_smile:

Hi,
in my setup I use Ouroboros to check for new versions on docker hub and automatically “install” the new version. This works really great for all my containers (nextcloud, iobroker, …), however, when updating a major release for openHab and the version number changes (Environment variable is set in my container setup: OPENHAB_VERSION), which is checked in the entrypoint.sh file, the update fails.
I need to manually change the OPENHAB_VERSION environment variable to trigger the update, which is then successful.
If I completely remove the environment variable, the container does not start anymore.
Is there any chance to remove this dependency of the environment variable to be able to automatically update without any modifications?
Thanks a lot :slight_smile:

Could you please be a bit more precise?
I have no clue what environment variable you talking about…
Are you talking about my setup? Are you talking about your setup?
:frowning:
My setup has only .env file which have the UID and GID set

UID=1000
GID=1000

which get’s used by openHAB in docker-compose

      USER_ID: ${UID}
      GROUP_ID: ${GID}

Hi, sorry I thought my question would fit to this thread regarding the update process of openHAB using docker.
It is about my setup, using the image from docker hub with the pre-defined environment variables, where OPENHAB_VERSION creates problems when updating to a new release.

#3
How to ask a good question / Help Us Help You - Tutorials & Examples - openHAB Community

3 Likes