Docker + Rancher: Migrating from a RaspberryPi

I’m working through a migration from a Raspian service to a Rancher service. Much thanks to @wborn for the rancher image (wish I had found it before spending hours on a docker-compose file).

My setup is a RancherOS bare metal box, with Openhab image instlled using the rancher template (all defaults). The RancherOS also implements rancher-nfs which is connected to a Freenas file server on another box.

a) I’ve found that the only way to deal with permissions and ownership is to chown rancher:rancher (the default rancheros user) and chmod 777 for each of the three persistent directories. It works, but seems like the wrong way to implement (need the other user for some reason when trying to rw files from a third computer). I did see this post on using openhabian. Is this the best approach?

b) I can’t quite figure out the best way to migrate from the Raspian platform to the rancher platform. I’ve tried to basically implement the docker container upgrade discussed here, but there is an Image and userdata versions differ! Starting an upgrade. which doesn’t upgrade and causes the container to fail (I think).

On item b, i know if would be possible to simply setup the underlying userdata form the original image and then copy in the conf data - I’ve tested that in part and it works.

Current Migration Plan

  1. Install Openhab Docker/Rancher but (i) change the image to 2.5.0 (The current rancher template is for 2.3.0 - I found this to be important because my deployed version is 2.5.0 with upgrades) and (ii) set a parameter for restart: unless-stopped.
  2. After launch, navigate to port 8080 (or what ever you set it as) and pick the expert installation. Allow everything to setup.
  3. Setup the bindings in the PaperUI [see bullet point 8 for manual bindings] (I’m sure that there is a better way to do this).
  4. Stop the container.
  5. In the Freenas CLI (or SSH) change the ownership of the three newly formed volumes (chmod -R 777 xxx). Per above, not sure this is the best method, but it works.
  6. Migrate everything from the /conf directory into the new directory.
  7. Migrate everything from the '/var/lib/openhab2/jsondb/ directory (for me it was just the smarthome files) to the new /userdata/jsondb/ directory.
  8. Migrate everything from your manual addons into the new addons volume.
  9. Restart the container.

Everything (addons, bindings, things, items) worked without exception.

1 Like