Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sorryusernameisalreadytaken/3200c356cddc708795b01793f93d39bd to your computer and use it in GitHub Desktop.
Save sorryusernameisalreadytaken/3200c356cddc708795b01793f93d39bd to your computer and use it in GitHub Desktop.
traefik docker-compose simple with homeassistant networkmode host
version: "3.5"
services:
traefik:
image: traefik:latest
container_name: traefik
command:
- --api.insecure=true
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --entrypoints.web.address=:80
- --entrypoints.web.http.redirections.entryPoint.to=websecure
- --entrypoints.web.http.redirections.entryPoint.scheme=https
- --entrypoints.web.http.redirections.entrypoint.permanent=true
- --entrypoints.websecure.address=:443
- --certificatesresolvers.myresolver.acme.tlschallenge=true
- --certificatesresolvers.myresolver.acme.email=anonymous@anon.com
- --certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json
ports:
- 80:80
- 443:443
- 8080:8080
extra_hosts:
- host.docker.internal:host-gateway
volumes:
- ./dockerconfigs/letsencrypt:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock:ro
restart: always
homeassistant:
image: ghcr.io/home-assistant/home-assistant:stable
container_name: homeassistant
network_mode: host
volumes:
- ./dockerconfigs/homeassistant/:/config
- /etc/localtime:/etc/localtime:ro
- /run/dbus:/run/dbus:ro
environment:
- TZ=Europe/Berlin
# ports:
# - 7001:7001
# FYI: changing my hass port in config from hass
labels:
- traefik.enable=true
- traefik.http.routers.hass.rule=Host(`ha.yourstring.duckdns.org`)
- traefik.http.routers.hass.entrypoints=websecure
- traefik.http.routers.hass.tls.certresolver=myresolver
# - traefik.http.middlewares.hass.basicauth.users=IS_STUPID_WITH_USING_HASS_IOS_OR_ANDROID_APP
# - traefik.http.routers.hass.middlewares=hass
- traefik.http.services.hass.loadbalancer.server.port=7001
restart: unless-stopped
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment