Blue/green deployment of deconz

Hi all,

I would like to deploy the whole stack on two matching raspberries (including two conbee dongles connected to each) and switch between each other upon every new release of $my_app that uses the deCONZ REST API.

I see the following interesting problems with this:

  1. State syncing

With the phoscon web app, it is possible to get a backup of the then-current settings, which results in a tar.gz with $the_important_files.

  • is it possible to get these files programmatically?
  • if not is it safe to fetch these files manually from .local/share/dresden-elektronik/deCONZ and rsync it over the other RPI? Of course, it would be preferred to do this without downtime.
  1. Stopping coordinator

Will the stop of the deCONZ binary result in the ZigBee coordinator go offline? Is there anything else to sync after deCONZ has been stopped? Anything that would need to be fetched from the dongle and uploaded to the other one somehow?

  1. Starting coordinator

Will there be any clashes network-wise if the new instance of deCONZ starts up while the old coordination is still connected? Do I have to withdraw power from the old one?

And there can be many more issues :slight_smile:

The rsync approach sound reasonable, basically all the backup does is to pack the data in these files together (and most important is only the zll.db file).

One thing to keep in mind when you have two cloned ConBee/RaspBee (same MAC address and network settings) you need to also leave the network on the one not in use, this can be done via REST-API e.g.:

PUT /api/<apikey>/config

{ "rfconnected": false}

Otherwise the two will run in parallel and fight over the devices. Another approach is to unplug or power-off the other ConBee/RaspBee.

Ah, this is that little important insider info that I came here for :partying_face: Thanks manup.

So the proper shutdown and sync steps would be to:

  • issue REST-API command for the controller dongle to go offline
  • stop (and disable) the deCONZ daemon
  • optionally shut down the USB port, just to be sure :slight_smile:
  • rsync the DB/config files over

I also heard that there is information about the topology and/or the devices themselves in the dongle itself. Is there anything to be done with that information?

Yes that’s pretty much the sequence I’d try.

The topology is build fresh at runtime inside the firmware after each power-up, so nothing needs to be done extra here. Only the network parameters need to match exactly, which can initially done by appling the backup to the other ConBee.