diff --git a/.travis.yml b/.travis.yml index 7db96ae..4cb3dfc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ python: - '3.5' install: - 'pip3 install homeassistant' - - 'mv secrets.yaml.sample secrets.yaml' + - 'mv hass/settings/secrets.yaml.sample hass/settings/secrets.yaml' script: - 'cd hass/settings/ && hass -c . --script check_config | tee check.output' - '! less check.output | grep -q ERROR' diff --git a/docker-compose.yml b/docker-compose.yml index df9b30b..307cd86 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -73,14 +73,21 @@ services: links: - "hass" - "appdaemon" + env_file: ./nginx/settings/nginx.env volumes: - - /srv/homeassistant/hosts.txt:/etc/hosts:ro - volumes: + - ./hass/settings/hosts.txt:/etc/hosts:ro + - ./nginx/settings/site-confs:/etc/nginx/conf.d.source:ro - /srv/ssl:/config/keys - - ./nginx-config/site-confs:/etc/nginx/conf.d ports: - "80:80" - "443:443" + command: | + /bin/bash -c "cp -R /etc/nginx/conf.d.source/* /etc/nginx/conf.d && \ + sed -i \"s/%DOMAIN%/$$HASS_DOMAIN/g\" /etc/nginx/conf.d/*.conf && \ + sed -i \"s/%PASS%/$$HASS_PASSWORD/g\" /etc/nginx/conf.d/*.conf && \ + sed -i \"s/%SERVER_IP%/$$SERVER_IP/g\" /etc/nginx/conf.d/*.conf && \ + cat /etc/nginx/conf.d/*.conf && \ + nginx -g 'daemon off;'" logging: driver: json-file options: @@ -117,9 +124,10 @@ services: driver: json-file options: max-size: 50m -########################### -# GRAFANA # -########################### + + ########################### + # GRAFANA # + ########################### grafana: image: grafana/grafana container_name: grafana diff --git a/nginx-config/site-confs/default b/nginx-config/site-confs/default deleted file mode 100644 index a538260..0000000 --- a/nginx-config/site-confs/default +++ /dev/null @@ -1,23 +0,0 @@ -server { - listen 80 default_server; - listen 443 default ssl; - - root /config/www; - index index.html index.htm index.php; - - server_name _; - - ssl_certificate /config/keys/cert.crt; - ssl_certificate_key /config/keys/cert.key; - - client_max_body_size 0; - - #letsencrypt challenge response - location ~/.well-known/acme-challenge/(.*)$ { - return 200 '$1'; - } - - location / { - try_files $uri $uri/ /index.html /index.php?$args =404; - } -} diff --git a/nginx/settings/nginx.env.sample b/nginx/settings/nginx.env.sample new file mode 100644 index 0000000..a707a97 --- /dev/null +++ b/nginx/settings/nginx.env.sample @@ -0,0 +1,3 @@ +HASS_DOMAIN=xxxxxxxxx +HASS_PASSWORD=xxxxxxxxx +SERVER_IP=xxxxxxxxx \ No newline at end of file