From cf1231e46ab3d5c1eb6065b7ca99efbbf877ab89 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 5 Jan 2023 22:54:45 +0100 Subject: [PATCH] Migrate home assistant container to hypervised --- config/dynamic_conf.yaml | 14 ++++++++++++++ config/traefik.yml | 2 ++ docker-compose.yml | 11 +++++++++++ home_assistant/docker-compose.yml | 26 -------------------------- 4 files changed, 27 insertions(+), 26 deletions(-) create mode 100644 config/dynamic_conf.yaml delete mode 100644 home_assistant/docker-compose.yml diff --git a/config/dynamic_conf.yaml b/config/dynamic_conf.yaml new file mode 100644 index 0000000..9f679e0 --- /dev/null +++ b/config/dynamic_conf.yaml @@ -0,0 +1,14 @@ +http: + routers: + homeAssistant-secure: + entryPoints: + - https + rule: Host(`domo.mrdev023.fr`) + tls: + certResolver: sslResolver + service: homeAssistant + services: + homeAssistant: + loadBalancer: + servers: + - url: "http://172.17.0.1:8123/" diff --git a/config/traefik.yml b/config/traefik.yml index ac9b92d..b9b0875 100644 --- a/config/traefik.yml +++ b/config/traefik.yml @@ -36,6 +36,8 @@ providers: docker: endpoint: "unix:///var/run/docker.sock" exposedByDefault: false + http: + endpoint: "http://http_provider/dynamic_conf.yaml" certificatesResolvers: sslResolver: diff --git a/docker-compose.yml b/docker-compose.yml index 07985a9..54b946d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,7 @@ services: security_opt: - no-new-privileges:true networks: + - providers - proxy ports: - 80:80 @@ -104,8 +105,18 @@ services: - "traefik.http.routers.grafana-secure.service=grafana" - "traefik.http.services.grafana.loadbalancer.server.port=3000" - "traefik.docker.network=proxy" + http_provider: + image: httpd:latest + restart: unless-stopped + container_name: http_provider + networks: + - internal + - providers + volumes: + - ./config/dynamic_conf.yaml:/usr/local/apache2/htdocs/dynamic_conf.yaml networks: + providers: internal: proxy: external: true diff --git a/home_assistant/docker-compose.yml b/home_assistant/docker-compose.yml deleted file mode 100644 index b7a3a0d..0000000 --- a/home_assistant/docker-compose.yml +++ /dev/null @@ -1,26 +0,0 @@ -version: '3' - -services: - home_assistant: - image: homeassistant/home-assistant - restart: always - container_name: home_assistant - environment: - - TZ=Europe/Paris - volumes: - - home_assistant_config:/config - - /etc/localtime:/etc/localtime:ro - network_mode: host - expose: - - 8123 - labels: - - "traefik.enable=true" - - "traefik.http.routers.homeassistant-secure.entrypoints=https" - - "traefik.http.routers.homeassistant-secure.rule=Host(`domo.mrdev023.fr`)" - - "traefik.http.routers.homeassistant-secure.tls=true" - - "traefik.http.routers.homeassistant-secure.tls.certresolver=sslResolver" - # - "traefik.http.routers.homeassistant-secure.service=homeassistant" - - "traefik.http.services.homeassistant.loadbalancer.server.port=8123" - -volumes: - home_assistant_config: