Multiple HA environments | test and production

My installation is getting a wider footprint with components being down due to upgrades having a bigger impact. While in general very stable it does happen that things break - not complaining about that btw; it’s open source and everybody does their best to provide a great experience which it is.

To strengthen my home automation environment I’m considering setting up a second instance. So I have a production and test environment.

Production runs on a KVM VM (Fedora server) so I simply spin up a second VM and then with updates coming take a copy of the current production (VM file), test the updates and if ok apply it at the production instance.

Given I have hardware components (e.g. serial connect to Elk-M1) I can’t run both KVM instances at the same time as these resources can’t be shared. This means production is down while I test which can be an issue.

Not sure whether there’s another option to do this more elegantly.

How do you guys deal with this - especially with bigger installations that control large parts of the home? Do you have a second instance? Are you simply pulling a full backup you can revert to if things break?

I do have 2 instances, one running the 2023.8 beta at the moment, but I don’t have anything serial connected, and Zigbee2MQTT runs on a different server.

Some questions, if I may?

  • Do you therefore have 3 servers: Z2M, production and test? …but Z2M could sit on your production server/instance?
  • Production and test both talk to Z2M without messing things up?
  • Does Mosquitto also sit on the same server as Z2M?

Z2M and Mosquitto are both Linux installs, not docker or add-ons, for performance reasons.

Indeed, so do Tasmota, OpenMQTTgateway, EspRfLink and other MQTT based devices.

1 Like

Thanks. What is the performance difference? …I take it you have a lot of traffic?

With about 700 MQTT entities, yes. Don’t know about the performance difference, but I guess running docker on an old Pi 2 with 512 Mb ram is not advisable, even if it does not use a sd card.

Interesting. I only have about ~450 MQTT entities and am running both Mosquitto and Z2M in docker on a Pi 4 (4GB) - everything feels ‘instant’ to me.

Pi 4 has a lot more ram, and a much faster processor :slight_smile:

I have a single instance and can restore from a backup that I know works.

I have a separate VM running the MQTT broker. My 10+ year old Dell OptiPlex has 20GB of RAM so I had the option of separating the MQTT broker (as well as running another VM for the LMS server (Daphile).

But the fact I have a serial adapter for Elk-M1 is an issue if I want to run both test and prod (VM won’t start if the device is mounted on another VM). However I just thought about something else. There’s a Linux component called ser2net which makes serial devices available on the network. Maybe I could run another VM dedicated to the serial device, run ser2net on it and then test and prod can utilise this device…

hmm … back to the drawing board or I simply apply @MaxK’s solution of backups

I use the ELK-M1XEP. That may be an option for you too.

Oh interesting. Didn’t know an Ethernet interface existed. Let me see how much this sells for in Australia

I use a spare computer I have around for my test instance. It isn’t perfect since there’s some hardware that only my prod instance has (Z-Wave dongle, etc.), but it works pretty well.

I actually have an Ansible playbook that does a full host OS and HAOS VM install.

It reboots the computer into a flash drive that does a (autoinstall) clean install of the host OS (Ubuntu) and then it downloads and spins up a VM image running HAOS. Afterwards I manually restore my most recent backup (always good to test your backups) and then maybe make a few tweaks such as disabling Nabu Casa cloud (otherwise it conflicts with prod).

I’ll eventually have it completely automated where the backups are restored automatically.

Let me know if you have a similar setup and if this is something you’d be interested in by thumbs-upping or commenting on this issue:

This is a personal setup right now, but I can break this off into something more generic fairly easily if there’s enough interest!

1 Like

Wow, thanks. Definitely something to consider but there’s clearly quite a bit of work to digest…