Hi all,
I have searched everywhere to find a working setup for Home Assistant in docker swarm. I have tried to combine everything I found into a (somewhat) working setup. I have three nodes to create a high available cluster. HA is connected to a MariaDB and I manage the entire setup with Portainer. The hardest part was the network setup. This worked for me:
- create a
macvlan_local
on every node, with a subnet that is part of the rest of my network ( I have split my subnet into two parts:
a) ip range .0 - .200 managed by DHCP and
b) ip range .224/27 managed by docker macvlan - create a
macvlan_swarm
, based on the local macvlan (--config-from macvlan_local
)
docker network ls | grep macvlan
NETWORK ID NAME DRIVER SCOPE
xxxxxxx macvlan_local null local
xxxxxxx macvlan_swarm macvlan swarm
For the rest;
- 3 nodes (LibreElec on WETEK hub, Ubuntu 20.04.1 LTS (64bit) on RPi3b and same on a RPi4)
- Synology NAS with NFS share with docker config
- docker version 20.10.2
- deployed/created everything from Portainer
docker-compose
version: '3.7'
services:
homeassistant:
restart: always
image: homeassistant/home-assistant
volumes:
- <path to homeassistant config>:/config
- /etc/localtime:/etc/localtime:ro
ports:
- 8123:8123
depends_on:
- mariadb_swarm_mariadb
deploy:
replicas: 1
networks:
- macvlan_swarm
networks:
macvlan_swarm:
external: true
Things todo are; my Tesla account gets lost sometimes after a failover or node reboot. Same for Nabu Casa. I think both have to do with token created on the 1st ip address and after failover/reboot HA runs at a different ip address/node.
Still; I am happy with the way it works right now. If you are interested in the detailed setup, let me know. If you have any ideas for improving; do let me know as well…
Screenshot from cluster visualizer in Portainer: