Inhaltsverzeichnis

Docker: Homeassistant

Homeassistant is a powerful Homeautomation- Software you can get from here: https://www.home-assistant.io/

Docker

In your Docker- Compose Directory, create the folder homeassistant and a new file docker-compose.yml as always and add:

services:
  homeassistant:
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - homeassistant_config:/config
      - /run/dbus:/run/dbus:ro
    ports:
      - 8123:8123
    restart: unless-stopped
#    environment : {}
    networks:
      - default

volumes:
  homeassistant_config:

networks:
# Still needs to be defined while without it won't enable ipv6
  default:
    driver: bridge
    enable_ipv6: true

Thats all - you can start Homeassistant.

Caddy integration

After getting a subdomain for homeassistant, add to your Caddyfile:

# Homeassistant
https://homeassistant.domain.tld:443 {
        header Strict-Transport-Security max-age=31536000;
        reverse_proxy dockerstack-homeassistant-1:8123
}

And Restart your Caddy- Container.

If you get 400: Bad Request with your HA- Logs saying no proxy configured, got to the config-volume of ha and add to configuration.yaml the following lines:

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - XXX.XXX.XXX.XXX # Add the IP address of the proxy server

Where that adress really needs to be the IPv4 of the docker Container, not the external IP and also not its name in Docker.

Furtunatelly you can give the Network- Mask, so 172.19.0.0/16 will work too.