87 lines
3.0 KiB
YAML
87 lines
3.0 KiB
YAML
|
|
name: home-assistant
|
|
|
|
secrets:
|
|
home-assistant_postgresql_database:
|
|
file: ${SECRETSDIR}/home-assistant_postgresql_database
|
|
home-assistant_postgresql_password:
|
|
file: ${SECRETSDIR}/home-assistant_postgresql_password
|
|
home-assistant_postgresql_username:
|
|
file: ${SECRETSDIR}/home-assistant_postgresql_username
|
|
|
|
networks:
|
|
traefik-net:
|
|
external: true
|
|
postgres-net:
|
|
external: true
|
|
macvlan1:
|
|
external: true
|
|
|
|
services:
|
|
home-assistant:
|
|
image: "ghcr.io/home-assistant/home-assistant:stable"
|
|
hostname: home-assistant
|
|
privileged: true
|
|
volumes:
|
|
- /etc/localtime:/etc/localtime:ro
|
|
- "${DATADIR}/config:/config"
|
|
- /run/dbus:/run/dbus:ro
|
|
restart: unless-stopped
|
|
env_file: .home-assistant.env
|
|
networks:
|
|
traefik-net:
|
|
postgres-net:
|
|
macvlan1:
|
|
ipv4_address: ${HOME_ASSISTANT_LOCAL}
|
|
depends_on:
|
|
postgresql:
|
|
condition: service_healthy
|
|
labels:
|
|
- traefik.enable=true
|
|
- traefik.docker.network=traefik-net
|
|
- "traefik.http.services.${APPLICATION_NAME}-svc.loadbalancer.server.port=${WEBUI_PORT}"
|
|
- "traefik.http.routers.${APPLICATION_NAME}-rtr.entrypoints=web"
|
|
- "traefik.http.routers.${APPLICATION_NAME}-rtr.rule=Host(`${APPLICATION_NAME}.${DOMAINNAME}`)&& PathPrefix(`/`)"
|
|
- "traefik.http.routers.${APPLICATION_NAME}-rtr.middlewares=http-mw-secureHeaders-redirect@file"
|
|
- "traefik.http.routers.${APPLICATION_NAME}-rtr.service=${APPLICATION_NAME}-svc"
|
|
- "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.entrypoints=websecure"
|
|
- "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.rule=Host(`${APPLICATION_NAME}.${DOMAINNAME}`)&& PathPrefix(`/`)"
|
|
- "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.middlewares=http-mw-secureHeaders@file"
|
|
- "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.tls=true"
|
|
- "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.tls.options=tls-options@file"
|
|
- "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.tls.certresolver=solver-dns"
|
|
- "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.service=${APPLICATION_NAME}-svc"
|
|
|
|
# for mDNS
|
|
avahi-tools:
|
|
volumes:
|
|
- /run/dbus:/var/run/dbus
|
|
- /run/avahi-daemon:/var/run/avahi-daemon
|
|
image: ahasbini/avahi-tools:latest
|
|
command: avahi-publish -a home-assistant.local ${HOME_ASSISTANT_LOCAL}
|
|
|
|
postgresql:
|
|
image: postgres:16-alpine
|
|
hostname: "${APPLICATION_NAME}_postgresql"
|
|
shm_size: 128mb # https://hub.docker.com/_/postgres
|
|
restart: unless-stopped
|
|
env_file: .postgresql.env
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
|
|
start_period: 20s
|
|
interval: 30s
|
|
retries: 5
|
|
timeout: 5s
|
|
networks:
|
|
postgres-net:
|
|
aliases: ["home-assistant_postgresql"]
|
|
secrets:
|
|
- home-assistant_postgresql_database
|
|
- home-assistant_postgresql_password
|
|
- home-assistant_postgresql_username
|
|
volumes:
|
|
- "${DATADIR}/pgdata:/var/lib/postgresql/data"
|
|
- "${DATADIR}/pgbackups:/mnt/backups"
|
|
|
|
|