New install advices: multiple LxC or single with multiple docker containers for mqtt-zigbee2mqtt-HA?

mascal-labo

New Member
Jan 7, 2025
18
0
1
Hello all,

I am a newbie in the Proxmox world or with VMs generally (and Linux generally), and would like to know if there are some advices to follow now before setting all in a wrong way.
Here is my project with an old laptop as server (8 GB RAM, dual core):
  1. MQTT, Zigbee2MQTT and HA, controlling a mix of ~50 zigbee/wifi devices, with remote access to HA
  2. if possible, a NextCloud instance for local use only
  3. some lightweight web apps, local use too

For now, I started setting an LxC with portainer to get Mosquitto/MQTT explorer running. This works fine.
But I am wondering:
- Should I add Zigbee2MQTT + HA in the same LxC, or
- Create a second/third LxC for Zigbee2MQTT + HA?

As I lack experience with all of this, my main question is about best option for maintenance of all + handling of bugs /crashes in the daily life...

Thanks in advance for your feedback/webpages to read about it,
 
I run all of the above in the HA OS running in a VM and just install the add-ons inside HA, which creates its own docker for those add-ons. I used to have them all running in their seperate dockers, but just found it so much easier to let HA OS handle that. So I have Mosquito + Z2M + HA in the same VM
Thanks, I thought about this too, but read that there might be better stability if in different containers (not sure if it was docker or lxc containers though).
I was also thinking about testing other environments than HA, and then get some independence for mqtt/zigbee...
But maybe it's easy to re-create an MQTT device list in a different environment? (I don't know yet how this works in HA add-ons but I have seen how to get add-ons)
 
Last edited:
Gotcha. Yeah, if you're not set on HA and will be trying different stuff, makes sense to isolate the mqtt stuff. I prefer docker for that since it was super easy to just run a compose command and call it a day, as opposed to setting up an lxc. LXC works fine, but a bit more work to setup I found. Docker containers I found easy to update as well.

As far as the device list, as soon as you create the MQTT integration in HA it will pickup on all the mqtt devices and vacuum that up and create respective devices/entities in HA, if you have discovery topic enabled in Z2M (that should be in the Z2M settings -> Home Assistant integration). The devices are tied to the integration, so if you remove/disable MQTT in HA those devices disappear again.
 
Last edited:
  • Like
Reactions: mascal-labo
Thanks, my wonder is really on the longer term about stability and maintenance.
For instance, to isolate more what is expected to be less stable, so that it's easier to restart/maintain.
Maybe my wonders are wrong :)

And I would fully understand that when I decide on precise tools, I can also get to a different setup that is less flexible but more robust...
 
Update after so many trials/tutorials:

1. Having a separate LxC for Zigbee2MQTT led to no recognition of the zigbee dongle. Whatever I tried for USB passthrough (/etc/pve/lxc/<lxc-id>.conf, set a permanent reference for the dongle in /etc/udev/rules.d/...), nothing worked.
If I need to try this again, I'll open a thread with details

2. Then tried to create a VM in Proxmox, installed docker/portainer, created a stack to launch two containers as a test (mqtt + z2m).
Now bumping into accesses issues. Z2M doesn't read my config file. I tried several variations of volume mounting, such as default in /var/lib/docker/volumes, or pointing to the root folder. Probably I miss something, but following the tutorials precisely doesn't help.
Will create a thread for that too.

Still, it would be great if anyone who started from scratch could share his experience with what was the best to get to some functional point, again, from having separate LxC or docker containers in the same VM?

Thanks in advance!
 
Hi,
I do not know if it is still relevant. I just had the following idea:
If you used the USB device also in one of the VM it will be not possible to enable the passthrough- to a LXC container. You have explicitly to stop the access to the USB device on any of the VMs.

Best
 
there are multiple post in this forum, that discourage the use of docker inside an LXC.

Personally, I run HA as Docker container (among others) in a VM, MQTT „native“ in an LXC and Zigbee2MQTT as a container on a Raspberry Pi, having the USB dongle attached.

Both, the HA VM and the MQTT LXC are subject to replication and high-availability, the RPI as well as the dongle remain a single point of failure.
 
  • Like
Reactions: UdoB