diff --git a/homeassistant/.env-example b/homeassistant/.env-example new file mode 100644 index 0000000..04df6b7 --- /dev/null +++ b/homeassistant/.env-example @@ -0,0 +1,5 @@ +# Homeassistant Version (Standard: latest) +HOMEASSISTANT_VERSION=latest + +# Homeassistant Domain +HOMEASSISTANT_DOMAIN=Homeassistant.example.com \ No newline at end of file diff --git a/homeassistant/README.md b/homeassistant/README.md new file mode 100644 index 0000000..3a38a68 --- /dev/null +++ b/homeassistant/README.md @@ -0,0 +1,27 @@ +# HomeassistantDocker Deployment + +This repository provides a `docker-compose` configuration for deploying the Homeassistant container, which is accessible via Traefik as a reverse proxy. + +## Prerequisites +- Docker and Docker Compose must be installed +- Traefik must be set up as a reverse proxy + +## Installation + +1. **Configure the `.env` file** +Rename the `.env-example` file to `.env` and update the file with your specific values. This file contains environment variables used by the Traefik service. + +```bash +mv .env-example .env +``` +Modify the .env file +``` + +2. **Start Docker-Compose** + + ```sh + docker-compose up -d + ``` + +## Access +Once the container is running, Homeassistant will be available at the configured domain. \ No newline at end of file diff --git a/homeassistant/docker-compose.yml b/homeassistant/docker-compose.yml new file mode 100644 index 0000000..cc4ed39 --- /dev/null +++ b/homeassistant/docker-compose.yml @@ -0,0 +1,30 @@ +--- +services: + homeassistant: + container_name: homeassistant + image: "ghcr.io/home-assistant/home-assistant:${HOMEASSISTANT_VERSION:-latest}" + volumes: + - ./data/config:/config + - /etc/localtime:/etc/localtime:ro + - /run/dbus:/run/dbus:ro + restart: unless-stopped + privileged: true + network_mode: host + environment: + - TZ=Europe/Rome + cap_add: + - NET_ADMIN + - NET_BIND_SERVICE + - SYS_ADMIN + labels: + - "traefik.enable=true" + - "traefik.docker.network=traefik" + - "traefik.http.routers.homeassistant.entrypoints=http" + - "traefik.http.routers.homeassistant.rule=Host(`${HOMEASSISTANT_DOMAIN:?error}`)" + - "traefik.http.middlewares.homeassistant-https-redirect.redirectscheme.scheme=https" + - "traefik.http.routers.homeassistant.middlewares=homeassistant-https-redirect" + - "traefik.http.routers.homeassistant-secure.entrypoints=https" + - "traefik.http.routers.homeassistant-secure.rule=Host(`${HOMEASSISTANT_DOMAIN:?error}`)" + - "traefik.http.routers.homeassistant-secure.tls=true" + - "traefik.http.routers.homeassistant-secure.service=homeassistant" + - "traefik.http.services.homeassistant.loadbalancer.server.port=8123" \ No newline at end of file