Add Homeassistant container
This commit is contained in:
parent
9f723d9026
commit
aa34375806
3 changed files with 62 additions and 22 deletions
|
@ -2,4 +2,4 @@
|
||||||
HOMEASSISTANT_VERSION=latest
|
HOMEASSISTANT_VERSION=latest
|
||||||
|
|
||||||
# Homeassistant Domain
|
# Homeassistant Domain
|
||||||
HOMEASSISTANT_DOMAIN=Homeassistant.example.com
|
HOMEASSISTANT_DOMAIN=homeassistant.example.com
|
|
@ -1,27 +1,62 @@
|
||||||
# HomeassistantDocker Deployment
|
# Home Assistant Docker Setup with Traefik
|
||||||
|
|
||||||
This repository provides a `docker-compose` configuration for deploying the Homeassistant container, which is accessible via Traefik as a reverse proxy.
|
This guide provides instructions for deploying Home Assistant using Docker and Traefik as a reverse proxy. The setup includes securing the Home Assistant instance with HTTPS and configuring a trusted proxy.
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
- Docker and Docker Compose must be installed
|
- Docker and Docker Compose installed on your system
|
||||||
- Traefik must be set up as a reverse proxy
|
- Traefik configured as your reverse proxy
|
||||||
|
- A domain name pointing to your Home Assistant instance
|
||||||
|
|
||||||
## Installation
|
## Environment Variables
|
||||||
|
Before deploying the container, create a `.env` file from the provided `.env-example` file and adjust the values as needed.
|
||||||
|
|
||||||
1. **Configure the `.env` file**
|
```sh
|
||||||
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.
|
cp .env-example .env
|
||||||
|
nano .env
|
||||||
```bash
|
|
||||||
mv .env-example .env
|
|
||||||
```
|
|
||||||
Modify the .env file
|
|
||||||
```
|
```
|
||||||
|
|
||||||
2. **Start Docker-Compose**
|
### `.env-example` file
|
||||||
|
```ini
|
||||||
|
# Home Assistant Version (Default: latest)
|
||||||
|
HOMEASSISTANT_VERSION=latest
|
||||||
|
|
||||||
```sh
|
# Home Assistant Domain
|
||||||
docker-compose up -d
|
HOMEASSISTANT_DOMAIN=homeassistant.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
## Access
|
## Starting the Container
|
||||||
Once the container is running, Homeassistant will be available at the configured domain.
|
Once the `.env` file is configured, start the Home Assistant container using:
|
||||||
|
```sh
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuring the Reverse Proxy
|
||||||
|
To enable proper proxy support in Home Assistant, update `data/config/configuration.yaml` with the following settings:
|
||||||
|
|
||||||
|
### Finding the Local Subnet IP
|
||||||
|
To determine the Docker subnet used by Home Assistant, run:
|
||||||
|
```sh
|
||||||
|
docker inspect homeassistant | grep Gateway
|
||||||
|
```
|
||||||
|
|
||||||
|
### `configuration.yaml`
|
||||||
|
```yaml
|
||||||
|
http:
|
||||||
|
ip_ban_enabled: true
|
||||||
|
login_attempts_threshold: 5
|
||||||
|
use_x_forwarded_for: true
|
||||||
|
trusted_proxies:
|
||||||
|
- 10.0.0.0/24 # Local Subnet
|
||||||
|
- 172.18.0.0/24 # Your Docker Subnet
|
||||||
|
```
|
||||||
|
|
||||||
|
## Accessing Home Assistant
|
||||||
|
Once everything is set up, restart Home Assistant and it should be accessible via the configured domain:
|
||||||
|
```
|
||||||
|
https://homeassistant.example.com
|
||||||
|
```
|
||||||
|
|
||||||
|
If there are any issues, check the container logs with:
|
||||||
|
```sh
|
||||||
|
docker logs -f homeassistant
|
||||||
|
```
|
|
@ -9,7 +9,8 @@ services:
|
||||||
- /run/dbus:/run/dbus:ro
|
- /run/dbus:/run/dbus:ro
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
privileged: true
|
privileged: true
|
||||||
network_mode: host
|
networks:
|
||||||
|
- traefik
|
||||||
environment:
|
environment:
|
||||||
- TZ=Europe/Rome
|
- TZ=Europe/Rome
|
||||||
cap_add:
|
cap_add:
|
||||||
|
@ -28,3 +29,7 @@ services:
|
||||||
- "traefik.http.routers.homeassistant-secure.tls=true"
|
- "traefik.http.routers.homeassistant-secure.tls=true"
|
||||||
- "traefik.http.routers.homeassistant-secure.service=homeassistant"
|
- "traefik.http.routers.homeassistant-secure.service=homeassistant"
|
||||||
- "traefik.http.services.homeassistant.loadbalancer.server.port=8123"
|
- "traefik.http.services.homeassistant.loadbalancer.server.port=8123"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
Loading…
Add table
Reference in a new issue