version: '3.8'
services:
homeassistant:
container_name: homeassistant
image: homeassistant/home-assistant
volumes:
- ./homeassistant/app/config:/config
environment:
- TZ=Europe/Rome
- PUID=1000
- PGID=1000
- DB_URL=postgres://${DB_USERNAME}:${DB_PASSWORD}@postgres:5432/${DB_NAME}
restart: always
ports:
- "8123:8123"
depends_on:
postgres:
condition: service_healthy
postgres:
container_name: postgres
image: postgres:13
volumes:
- ./homeassistant/postgres:/var/lib/postgresql/data
environment:
- POSTGRES_DB=${DB_NAME}
- POSTGRES_USER=${DB_USERNAME}
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_INITDB_ARGS="--data-checksums"
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME}"]
interval: 30s
timeout: 10s
retries: 5
redis:
container_name: redis
image: redis:alpine
restart: always
volumes:
- ./homeassistant/redis:/dataDB_NAME=db_name
DB_USERNAME=db_username
DB_PASSWORD=db_password