Skip to content

Home Assistant QNAP

mttstt edited this page Mar 16, 2019 · 63 revisions

Todo

  • Docker-compose HA
  • Docker-compose MQTT
  • Disable redirect port 80 on Qnap
  • Caddy configuration

Docker-compose HA+MQTT+... (to be tested)

version: '3'
services:
  mqtt:
    container_name: MQTT
    restart: unless-stopped
    image: eclipse-mosquitto
    volumes:
      - /Public/home-container/mosquitto/config/mosquitto.conf:/mosquitto/config/mosquitto.conf
      - /Public/home-container/mosquitto/config/log:/mosquitto/log
      - /Public/home-container/mosquitto/data:/mosquitto/data
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "1883:1883"
      - "9001:9001"
   homeassistant:
    container_name: home-assistant
    restart: unless-stopped
    image: homeassistant/home-assistant    
    devices:
      - /dev/ttyACM0:/dev/ttyACM0
    volumes:
      - /Public/VM/home-container/hass-config:/config
    network_mode: host
    privileged: true

version: '3'

services: mosquitto: container_name: mosquitto image: eclipse-mosquitto:latest restart: always ports: - 1883:1883 volumes: - /share/Public/container-station-data/mosquitto/config:/mosquitto/config - /share/Public/container-station-data/mosquitto/data:/mosquitto/data - /share/Public/container-station-data/mosquitto/log:/mosquitto/log network_mode: "host" homeassistant: container_name: home-assistant image: homeassistant/home-assistant:latest restart: always ports: - 8123:8123 volumes: - /share/Public/container-station-data/homeassistant:/config depends_on: - mosquitto network_mode: "host" caddy: container_name: caddy:latest image: caddy:latest restart: always environment: - ACME_AGREE=false - ENABLE_TELEMETRY=false - PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin volumes: - /share/Public/container-station-data/caddy:/etc/caddy command: ["--conf", "/etc/caddy/Caddyfile", "--log", "stdout", "--agree=false"] network_mode: "host"

Disable redirect port 80 on Qnap

Enable QNAP web server service and change the port (e-g- 80 -->81). Now TCP 80 port is not more redirected.

Caddy configuration Server reverse proxy

Docker Version: no-stats

Command: --conf /etc/caddy/Caddyfile --log stdout --agree=$ACME_AGREE --restart=always

(-ca https://acme-staging-v02.api.letsencrypt.org/directory )

Entrypoint: /bin/parent caddy

Volume from host: /etc/caddy /share/Public/container-station-data/caddy

Networking: HOST

Variables: ACME_AGREE false ENABLE_TELEMETRY false PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Edit /etc/Caddyfile:

 smaxxx.dlinkddns.com {
    proxy / 192.168.1.108:8123 {
        websocket
        transparent
    }
    log stdout
}

Eclipse-mosquitto

/mosquitto/config /share/Public/container-station-data/mosquitto/config /mosquitto/data /share/Public/container-station-data/mosquitto/data /mosquitto/log /share/Public/container-station-data/mosquitto/log

Clone this wiki locally