From d0a670796c44b90781b594afacb7a182a651b2e0 Mon Sep 17 00:00:00 2001 From: Florian Zirker Date: Thu, 10 Apr 2025 17:05:16 +0200 Subject: [PATCH 1/4] Home Assistant to network mode --- proxy/Caddyfile | 3 +-- smartHome/docker-compose.yaml | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/proxy/Caddyfile b/proxy/Caddyfile index 2a2d8e3..ad90cd5 100644 --- a/proxy/Caddyfile +++ b/proxy/Caddyfile @@ -43,8 +43,7 @@ @hassi host hassi.{$DOMAIN} handle @hassi { - # reverse_proxy homeassistant:8123 - reverse_proxy {host}:8123 + reverse_proxy homeassistant:8123 } @zigbee2mqtt host zigbee2mqtt.{$DOMAIN} diff --git a/smartHome/docker-compose.yaml b/smartHome/docker-compose.yaml index 026778b..3f9d183 100644 --- a/smartHome/docker-compose.yaml +++ b/smartHome/docker-compose.yaml @@ -8,11 +8,13 @@ services: environment: - TZ=Europe/Berlin restart: unless-stopped - network_mode: host + #network_mode: host + networks: + - web + - smarthome labels: - "docker.group=smartHome" - mqttbroker: image: eclipse-mosquitto:${MOSQUITTO_VERSION} restart: unless-stopped @@ -28,7 +30,6 @@ services: labels: - "docker.group=smartHome" - zigbee2mqtt: restart: unless-stopped image: koenkk/zigbee2mqtt From dc1303c7965a7a94d1f96385ca5616c97256ccc0 Mon Sep 17 00:00:00 2001 From: Florian Zirker Date: Thu, 10 Apr 2025 17:05:26 +0200 Subject: [PATCH 2/4] Add postgres to Smarthome --- smartHome/docker-compose.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/smartHome/docker-compose.yaml b/smartHome/docker-compose.yaml index 3f9d183..4a27a1b 100644 --- a/smartHome/docker-compose.yaml +++ b/smartHome/docker-compose.yaml @@ -46,6 +46,26 @@ services: labels: - "docker.group=smartHome" + db: + image: postgres:${POSTGRES_VERSION} + restart: unless-stopped + networks: + - smarthome + volumes: + - ${VOLUMES_PATH}/smartHome/postgres:/var/lib/postgresql/data + environment: + - POSTGRES_DB=${POSTGRES_DB} + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + healthcheck: + test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"] + start_period: 20s + interval: 30s + retries: 5 + timeout: 5s + labels: + - "docker.group=smartHome" + networks: web: From 2b59b4ce9919a9c6802d1534b6dc2c69c4ca1399 Mon Sep 17 00:00:00 2001 From: Florian Zirker Date: Thu, 10 Apr 2025 17:06:27 +0200 Subject: [PATCH 3/4] proxy auth for uptime kuma --- proxy/Caddyfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/proxy/Caddyfile b/proxy/Caddyfile index ad90cd5..f2d151b 100644 --- a/proxy/Caddyfile +++ b/proxy/Caddyfile @@ -74,7 +74,10 @@ @uptime host uptime.{$DOMAIN} handle @uptime { - reverse_proxy uptime-kuma:3001 + route { + import proxy-auth + reverse_proxy uptime-kuma:3001 + } } @torrent host torrent.{$DOMAIN} From 7fc79f7a21affee5bc7cc2cd7ae836e3db7d55f2 Mon Sep 17 00:00:00 2001 From: Florian Zirker Date: Thu, 10 Apr 2025 17:06:47 +0200 Subject: [PATCH 4/4] Redirect old domain to new one --- proxy/Caddyfile | 9 +++++++++ proxy/docker-compose.yaml | 1 + 2 files changed, 10 insertions(+) diff --git a/proxy/Caddyfile b/proxy/Caddyfile index f2d151b..a245a03 100644 --- a/proxy/Caddyfile +++ b/proxy/Caddyfile @@ -4,6 +4,7 @@ output stdout format console } + auto_https disable_redirects } (proxy-auth) { @@ -15,6 +16,14 @@ } } +http://*.{$DOMAIN} { + redir https://{labels.3}.{$DOMAIN}{uri} permanent +} + +http://*.{$OLD_DOMAIN} { + redir https://{labels.1}.{$DOMAIN}{uri} permanent +} + *.{$DOMAIN} { tls { dns netcup { diff --git a/proxy/docker-compose.yaml b/proxy/docker-compose.yaml index 7c587c9..c6e63dd 100644 --- a/proxy/docker-compose.yaml +++ b/proxy/docker-compose.yaml @@ -16,6 +16,7 @@ services: - web environment: - DOMAIN=${DOMAIN} + - OLD_DOMAIN=${OLD_DOMAIN} - LOCAL_CA_NAME=${LOCAL_CA_NAME} - NETCUP_CUSTOMER_NUMBER=${NETCUP_CUSTOMER_NUMBER} - NETCUP_API_KEY=${NETCUP_API_KEY}