How to restore an OpenHab backup to OpenHab in Docker & Kubernetes (minikube)?

Hello,

Currently I am very lost, I am using persistent volumes (for addons, conf and userdata), hpa, service and I make everything work. I would like to recover an old backup with all the configuration that I had in native OpenHab.
I am clear that there is a possibility that I have to copy things by hand, it is not a problem.
I am doing something wrong since I am not sure if the address where I should copy my files is:

/var/lib/docker/volumes/minikube/_data/local/containers-data/openhab/

or where should I do it … and if you also need to do more things apart from copying and reviewing permissions.

I think there is something that escapes me and I don’t know if it is the docker, in kubernetes, in minikube …

Thanks for any possible help.

Hi,

just copy your backup to the top level folder that act as volume for your container and extract the files:

mv /tmp/openhab-backup-22_01_12-14_55_49.zip /myvolumetoplevel/
cd  /myvolumetoplevel/
unzip openhab-backup-22_01_12-14_55_49.zip
# new files in:
addons
backup.properties
conf
userdata
# then start your container

BR

1 Like

I left this path long time ago, thanks anyway.

Just a memorandum:

docker-compose.yml

version: '2.2'

services:
  openhab:
    image: "openhab/openhab:3.3.0"
    restart: always
    network_mode: host
    devices:
      - "/dev/ttyUSB0:/dev/ttyUSB0:rwm"
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "/etc/timezone:/etc/timezone:ro"
      - "./openhab_addons:/openhab/addons"
      - "./openhab_conf:/openhab/conf"
      - "./openhab_userdata:/openhab/userdata"
    environment:
      CRYPTO_POLICY: "unlimited"
      EXTRA_JAVA_OPTS: "-Duser.timezone=Europe/Berlin"
      OPENHAB_HTTP_PORT: "8080"
      OPENHAB_HTTPS_PORT: "8443"
      # usb permission: cat /etc/group | grep dialout
      PUID: "1000"
      PGID: "1000"
      EXTRA_GID: "20"  # this is the ID of the group 'dialout'



    deploy:
            resources:
                limits:
                    memory: 512M
                reservations:
                    memory: 768M
docker cp openhab-backup-datetime.zip $(docker ps -q):/ # copy local backup to docker container
docker exec -it $(docker ps -q) bash  # get inside the container
unzip /openhab-backup-datetime.zip;exit # unzip and exit the container
docker compose down # restart container
docker compose up
1 Like