From fbb708b1f11714d34cbc6ac476fc4f477da69846 Mon Sep 17 00:00:00 2001 From: Adrien Poupa Date: Thu, 18 Jan 2024 23:06:58 -0500 Subject: [PATCH] feat(homeassistant): Add Home Assistant --- .env.example | 2 ++ .gitignore | 3 +- README.md | 59 ++++++++++++++++++++++++++------------ adguardhome/certs/.gitkeep | 0 adguardhome/conf/.gitkeep | 0 adguardhome/work/.gitkeep | 0 docker-compose.yml | 37 ++++++++++++++++++++++++ 7 files changed, 80 insertions(+), 21 deletions(-) delete mode 100644 adguardhome/certs/.gitkeep delete mode 100644 adguardhome/conf/.gitkeep delete mode 100644 adguardhome/work/.gitkeep diff --git a/.env.example b/.env.example index dbd15e9..fda84e4 100644 --- a/.env.example +++ b/.env.example @@ -10,6 +10,7 @@ PIA_USER= PIA_PASS= PIA_LOCAL_NETWORK="192.168.0.0/16" HOSTNAME=localhost +HOMEASSISTANT_HOSTNAME= ADGUARD_HOSTNAME= ADGUARD_USERNAME= ADGUARD_PASSWORD= @@ -29,6 +30,7 @@ PROWLARR_API_KEY= JELLYFIN_API_KEY= JELLYSEERR_API_KEY= SABNZBD_API_KEY= +HOMEASSISTANT_ACCESS_TOKEN= HOMEPAGE_VAR_TITLE="Docker-Compose NAS" HOMEPAGE_VAR_SEARCH_PROVIDER=google HOMEPAGE_VAR_HEADER_STYLE=boxed diff --git a/.gitignore b/.gitignore index 4bb0d45..fc96e73 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,6 @@ docker-compose.override.yml /jellyseerr /adguardhome/certs /adguardhome/conf -!/adguardhome/conf/.gitkeep /adguardhome/work -!/adguardhome/work/.gitkeep /sabnzbd +/homeassistant diff --git a/README.md b/README.md index fb9a4ae..1f4014d 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ I am running it in Ubuntu Server 22.04; I also tested this setup on a [Synology * [Expose DNS Server with Tailscale](#expose-dns-server-with-tailscale) * [Tandoor](#tandoor) * [Joplin](#joplin) + * [Home Assistant](#home-assistant) * [Customization](#customization) * [Optional: Using the VPN for *arr apps](#optional-using-the-vpn-for-arr-apps) * [Synology Quirks](#synology-quirks) @@ -54,26 +55,27 @@ I am running it in Ubuntu Server 22.04; I also tested this setup on a [Synology ## Applications -| **Application** | **Description** | **Image** | **URL** | -|--------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|--------------| -| [Sonarr](https://sonarr.tv) | PVR for newsgroup and bittorrent users | [linuxserver/sonarr](https://hub.docker.com/r/linuxserver/sonarr) | /sonarr | -| [Radarr](https://radarr.video) | Movie collection manager for Usenet and BitTorrent users | [linuxserver/radarr](https://hub.docker.com/r/linuxserver/radarr) | /radarr | -| [Prowlarr](https://github.com/Prowlarr/Prowlarr) | Indexer aggregator for Sonarr and Radarr | [linuxserver/prowlarr:latest](https://hub.docker.com/r/linuxserver/prowlarr) | /prowlarr | +| **Application** | **Description** | **Image** | **URL** | +|-------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|--------------| +| [Sonarr](https://sonarr.tv) | PVR for newsgroup and bittorrent users | [linuxserver/sonarr](https://hub.docker.com/r/linuxserver/sonarr) | /sonarr | +| [Radarr](https://radarr.video) | Movie collection manager for Usenet and BitTorrent users | [linuxserver/radarr](https://hub.docker.com/r/linuxserver/radarr) | /radarr | +| [Prowlarr](https://github.com/Prowlarr/Prowlarr) | Indexer aggregator for Sonarr and Radarr | [linuxserver/prowlarr:latest](https://hub.docker.com/r/linuxserver/prowlarr) | /prowlarr | | [PIA WireGuard VPN](https://github.com/thrnz/docker-wireguard-pia) | Encapsulate qBittorrent traffic in [PIA](https://www.privateinternetaccess.com/) using [WireGuard](https://www.wireguard.com/) with port forwarding. | [thrnz/docker-wireguard-pia](https://hub.docker.com/r/thrnz/docker-wireguard-pia) | | -| [qBittorrent](https://www.qbittorrent.org) | Bittorrent client with a complete web UI
Uses VPN network
Using Libtorrent 1.x | [linuxserver/qbittorrent:libtorrentv1](https://hub.docker.com/r/linuxserver/qbittorrent) | /qbittorrent | -| [Unpackerr](https://unpackerr.zip) | Automated Archive Extractions | [golift/unpackerr](https://hub.docker.com/r/golift/unpackerr) | | -| [Jellyfin](https://jellyfin.org) | Media server designed to organize, manage, and share digital media files to networked devices | [linuxserver/jellyfin](https://hub.docker.com/r/linuxserver/jellyfin) | /jellyfin | -| [Jellyseer](https://jellyfin.org) | Manages requests for your media library | [fallenbagel/jellyseerr](https://hub.docker.com/r/fallenbagel/jellyseerr) | /jellyseer | -| [Homepage](https://gethomepage.dev) | Application dashboard | [gethomepage/homepage](https://github.com/gethomepage/homepage/pkgs/container/homepage) | / | -| [Traefik](https://traefik.io) | Reverse proxy | [traefik](https://hub.docker.com/_/traefik) | | -| [Watchtower](https://containrrr.dev/watchtower/) | Automated Docker images update | [containrrr/watchtower](https://hub.docker.com/r/containrrr/watchtower) | | -| [Autoheal](https://github.com/willfarrell/docker-autoheal/) | Monitor and restart unhealthy Docker containers | [willfarrell/autoheal](https://hub.docker.com/r/willfarrell/autoheal) | | -| [Lidarr](https://lidarr.audio) | Optional - Music collection manager for Usenet and BitTorrent users
Enable with `COMPOSE_PROFILES=lidarr` | [linuxserver/lidarr](https://hub.docker.com/r/linuxserver/lidarr) | /lidarr | -| [SABnzbd](https://sabnzbd.org/) | Optional - Free and easy binary newsreader
Enable with `COMPOSE_PROFILES=sabnzbd` | [linuxserver/sabnzbd](https://hub.docker.com/r/linuxserver/sabnzbd) | /sabnzbd | -| [FlareSolverr](https://github.com/FlareSolverr/FlareSolverr) | Optional - Proxy server to bypass Cloudflare protection in Prowlarr
Enable with `COMPOSE_PROFILES=flaresolverr` | [flaresolverr/flaresolverr](https://hub.docker.com/r/flaresolverr/flaresolverr) | | -| [AdGuard Home](https://adguard.com/en/adguard-home/overview.html) | Optional - Network-wide software for blocking ads & tracking
Enable with `COMPOSE_PROFILES=adguardhome` | [adguard/adguardhome](https://hub.docker.com/r/adguard/adguardhome) | | -| [Tandoor](https://tandoor.dev) | Optional - Smart recipe management
Enable with `COMPOSE_PROFILES=tandoor` | [vabene1111/recipes](https://hub.docker.com/r/vabene1111/recipes) | /recipes | -| [Joplin](https://joplinapp.org/) | Optional - Note taking application
Enable with `COMPOSE_PROFILES=joplin` | [joplin/server](https://hub.docker.com/r/joplin/server) | /joplin | +| [qBittorrent](https://www.qbittorrent.org) | Bittorrent client with a complete web UI
Uses VPN network
Using Libtorrent 1.x | [linuxserver/qbittorrent:libtorrentv1](https://hub.docker.com/r/linuxserver/qbittorrent) | /qbittorrent | +| [Unpackerr](https://unpackerr.zip) | Automated Archive Extractions | [golift/unpackerr](https://hub.docker.com/r/golift/unpackerr) | | +| [Jellyfin](https://jellyfin.org) | Media server designed to organize, manage, and share digital media files to networked devices | [linuxserver/jellyfin](https://hub.docker.com/r/linuxserver/jellyfin) | /jellyfin | +| [Jellyseer](https://jellyfin.org) | Manages requests for your media library | [fallenbagel/jellyseerr](https://hub.docker.com/r/fallenbagel/jellyseerr) | /jellyseer | +| [Homepage](https://gethomepage.dev) | Application dashboard | [gethomepage/homepage](https://github.com/gethomepage/homepage/pkgs/container/homepage) | / | +| [Traefik](https://traefik.io) | Reverse proxy | [traefik](https://hub.docker.com/_/traefik) | | +| [Watchtower](https://containrrr.dev/watchtower/) | Automated Docker images update | [containrrr/watchtower](https://hub.docker.com/r/containrrr/watchtower) | | +| [Autoheal](https://github.com/willfarrell/docker-autoheal/) | Monitor and restart unhealthy Docker containers | [willfarrell/autoheal](https://hub.docker.com/r/willfarrell/autoheal) | | +| [Lidarr](https://lidarr.audio) | Optional - Music collection manager for Usenet and BitTorrent users
Enable with `COMPOSE_PROFILES=lidarr` | [linuxserver/lidarr](https://hub.docker.com/r/linuxserver/lidarr) | /lidarr | +| [SABnzbd](https://sabnzbd.org/) | Optional - Free and easy binary newsreader
Enable with `COMPOSE_PROFILES=sabnzbd` | [linuxserver/sabnzbd](https://hub.docker.com/r/linuxserver/sabnzbd) | /sabnzbd | +| [FlareSolverr](https://github.com/FlareSolverr/FlareSolverr) | Optional - Proxy server to bypass Cloudflare protection in Prowlarr
Enable with `COMPOSE_PROFILES=flaresolverr` | [flaresolverr/flaresolverr](https://hub.docker.com/r/flaresolverr/flaresolverr) | | +| [AdGuard Home](https://adguard.com/en/adguard-home/overview.html) | Optional - Network-wide software for blocking ads & tracking
Enable with `COMPOSE_PROFILES=adguardhome` | [adguard/adguardhome](https://hub.docker.com/r/adguard/adguardhome) | | +| [Tandoor](https://tandoor.dev) | Optional - Smart recipe management
Enable with `COMPOSE_PROFILES=tandoor` | [vabene1111/recipes](https://hub.docker.com/r/vabene1111/recipes) | /recipes | +| [Joplin](https://joplinapp.org/) | Optional - Note taking application
Enable with `COMPOSE_PROFILES=joplin` | [joplin/server](https://hub.docker.com/r/joplin/server) | /joplin | +| [Home Assistant](https://www.home-assistant.io/) | Optional - Open source home automation that puts local control and privacy first
Enable with `COMPOSE_PROFILES=homeassistant` | [home-assistant/home-assistant:stable](https://ghcr.io/home-assistant/home-assistant) | | Optional containers are not enabled by default, they need to be enabled, see [Optional Services](#optional-services) for more information. @@ -378,6 +380,25 @@ See [here](./tandoor/README.md). See [here](./joplin/README.md). +### Home Assistant + +Enable Home Assistant by setting `COMPOSE_PROFILES=homeassistant`. + +Set the `HOMEASSISTANT_HOSTNAME`, since it does not support +[running in a subfolder](https://github.com/home-assistant/architecture/issues/156). +Add the necessary DNS records in your domain. + +You will need to allow Traefik to access Home Assistant by adding the following in `homeassistant/configuration.yaml`: + +```yaml +http: + use_x_forwarded_for: true + trusted_proxies: + - 172.0.0.0/8 # You can put a more precise range instead +``` + +Set the `HOMEASSISTANT_ACCESS_TOKEN` for homepage support. + ## Customization You can override the configuration of a service or add new services by creating a new `docker-compose.override.yml` file, diff --git a/adguardhome/certs/.gitkeep b/adguardhome/certs/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/adguardhome/conf/.gitkeep b/adguardhome/conf/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/adguardhome/work/.gitkeep b/adguardhome/work/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/docker-compose.yml b/docker-compose.yml index 7c8a390..34f2050 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,6 +33,8 @@ services: volumes: - ./letsencrypt:/letsencrypt - "/var/run/docker.sock:/var/run/docker.sock:ro" + extra_hosts: + - host.docker.internal:172.17.0.1 healthcheck: test: [ "CMD", "traefik", "healthcheck", "--ping" ] interval: 5s @@ -401,6 +403,41 @@ services: - homepage.widget.type=jellyfin - homepage.widget.url=http://jellyfin:8096/jellyfin - homepage.widget.key=${JELLYFIN_API_KEY} + homeassistant: + image: ghcr.io/home-assistant/home-assistant:stable + container_name: homeassistant + network_mode: host + environment: + - PUID=${USER_ID} + - PGID=${GROUP_ID} + - TZ=${TIMEZONE} + volumes: + - ./homeassistant:/config + - /etc/localtime:/etc/localtime:ro + - /run/dbus:/run/dbus:ro + restart: always + healthcheck: + test: [ "CMD", "curl", "--fail", "http://127.0.0.1:8123" ] + interval: 5s + retries: 10 + privileged: true + labels: + - traefik.enable=true + - traefik.http.routers.homeassistant.rule=(Host(`${HOMEASSISTANT_HOSTNAME}`)) + - traefik.http.routers.homeassistant.tls=true + - traefik.http.routers.homeassistant.tls.certresolver=myresolver + - traefik.http.services.homeassistant.loadbalancer.server.port=8123 + - homepage.group=Apps + - homepage.name=Home Assistant + - homepage.icon=home-assistant.png + - homepage.href=https://${HOMEASSISTANT_HOSTNAME} + - homepage.description=Open source home automation that puts local control and privacy first + - homepage.weight=3 + - homepage.widget.type=homeassistant + - homepage.widget.url=https://${HOMEASSISTANT_HOSTNAME} + - homepage.widget.key=${HOMEASSISTANT_ACCESS_TOKEN} + profiles: + - homeassistant homepage: image: ghcr.io/gethomepage/homepage:latest container_name: homepage