I have it as a hardware solution, it’s not software based.
in swarm I use traefik
Hello masters,
I am new in HA but very interested in all these home automation stuffs.
In short - I managed to run the HA and MQTT in a normal docker containers but I would prefer to use a docker swarm for easier maintaining of the future containers that I plan to deploy. The problem is that the stack is being deployed on the first sight but even that I see that container is not running. When I do “docker service logs xxx” I get nothing and there is no way how to debug it. Another thing that I tried is to mount the log file in the container with a file on the host, thinking that would help me to debug, but for some reason this also didn’t work. My setup is Raspberry pi 3 b+ and this is my very very simple compose.yaml file. Can anyone give me a hint guys, really appreaciate,
P.S. in “configuration.yaml” I have enabled logging with:
logger:
default: debug
docker-compose.yaml
version: '3.7'
configs:
config_ha:
file: ./homeassistant/configuration.yaml
services:
homeassistant:
image: homeassistant/raspberrypi3-homeassistant:stable
configs:
- source: config_ha
target: /config
volumes:
- /docker/homeassistant:/config
ports:
- "8123:8123"
networks:
hassnet:
deploy:
mode: global
placement:
constraints: [node.labels.all == true]
networks:
hassnet:
driver: overlay
I don’t see anything immediately wrong with your setup.
To see what’s wrong with your stack, you can use
docker service ps --no-trunk stackname
Thanks a lot for your reply @Edzilla. I tried this but nothing - the command returns just an empty row. Anyway, I decided to continue running my HA in a plain docker without swarm or docker compose. Thanks again.
@Edzilla, thanks for posting this as Swarm is on my to-do list, your post will surely come in handy. But I’d like to understand a little more on your original statement that Homeassistant needs to be in host networking mode. I’m currently running mine in a container but I’m using the bridge mode without problems. What components or features don’t work in bridged mode?
Like others THANKS. I’ve been playing with docker for a couple of weeks. Implemented a swarm that does not work well as far as communication. I’ll be giving the macvlan a try this evening. Also going to work with GlusterFS for persistent data accross all nodes. Fingers crossed as it’s all been a learning experience.
You can use bluetooth (at least BLE) in Swarm. I am just starting with HA setup, so I don’t have first hand experience with HA+Bluetooth+Swarm, but I am running a container which is using bluetooth radio from two raspberrypi SBCs in my swarm cluster.
version: "3.8"
services:
atc_reader:
image: adystech/mi_atc_reader:latest
deploy:
replicas: 2
placement:
max_replicas_per_node: 1
constraints:
- node.labels.platform == raspberrypi
- node.labels.bluetooth_cap == true
logging:
driver: "json-file"
options:
max-file: "3" # number of files or file count
max-size: "5m" # file size
environment:
- ATC_MQTT__client_id="atc_{{.Node.Hostname}}"
configs:
- source: atc_config.yml
target: /custom.yml
cap_add:
- NET_ADMIN
networks:
- host_net
networks:
shared_overlay: # For inter stack communication. created outside.
driver: overlay
external: true
host_net:
external: true
name: host
The additional NET_ADMIN
cap and indirect reference to host
network does the trick.