diff --git a/.werf/nginx-local.conf b/.werf/nginx-local.conf index b25bad4..2ba29cb 100644 --- a/.werf/nginx-local.conf +++ b/.werf/nginx-local.conf @@ -9,7 +9,15 @@ events { } http { + resolver 127.0.0.11 valid=30s ipv6=off; + resolver_timeout 30s; proxy_cache_path /cache keys_zone=dcache:10m max_size=200m inactive=30d; + + # Global timeout settings + keepalive_timeout 65; + client_body_timeout 60s; + client_header_timeout 60s; + send_timeout 60s; log_format json_combined escape=json '{ "time_local": "$time_local", ' '"host": "$host", ' @@ -36,7 +44,7 @@ http { hostnames; ".deckhouse.ru" "ru"; # for test environments - ".deckhouse.ru.*" "ru"; + ".deckhouse-ru.*" "ru"; "ru.localhost" "ru"; default "en"; } @@ -59,6 +67,11 @@ http { default "deckhouse.ru"; } + map $http_upgrade $connection_upgrade { + default upgrade; + '' close; + } + upstream deckhouse_io { server deckhouse.io:443; } @@ -67,6 +80,16 @@ http { server deckhouse.ru:443; } + upstream hugo_1313 { + zone hugo_1313 64k; + server hugo:1313 resolve max_fails=0; + } + + upstream hugo_1314 { + zone hugo_1314 64k; + server hugo:1314 resolve max_fails=0; + } + server { root /app; index index.html; @@ -101,27 +124,46 @@ http { proxy_pass $publicdocupstream; } - location ~* /products/development-platform/(livereload|documentation/).*$ { + # Specific location for livereload WebSocket endpoint + location ~* ^.*/(livereload|livereload\.js) { + # Don't retry WebSocket connections - they can't be retried + proxy_next_upstream off; + proxy_next_upstream_timeout 0; + proxy_next_upstream_tries 1; + proxy_redirect off; - proxy_intercept_errors on; + proxy_intercept_errors off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Original-URI $request_uri; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - # WebSocket support for livereload + proxy_connect_timeout 10s; + proxy_send_timeout 3600s; + proxy_read_timeout 3600s; + + proxy_buffering off; + proxy_request_buffering off; + + # WebSocket support - ensure proper headers proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; + proxy_set_header Connection $connection_upgrade; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $host; proxy_pass http://$hugo_upstream; } - } - upstream hugo_1313 { - server hugo:1313; - } - upstream hugo_1314 { - server hugo:1314; + location ~* ^/products/development-platform/documentation/.*$ { + proxy_redirect off; + proxy_intercept_errors on; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Original-URI $request_uri; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + proxy_pass http://$hugo_upstream; + } } } diff --git a/README.md b/README.md index 7a12b6e..914536a 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ This is the source for the Deckhouse Development Platform documentation website. +The project uses [Hugo](https://gohugo.io/) SSG and the [hugo-web-product-module](https://github.com/deckhouse/hugo-web-product-module/) module for a theme. + +Read [`hugo-web-product-module` README.md](https://github.com/deckhouse/hugo-web-product-module/blob/main/README.md) for information about content markup and other details. + +## How to run the documentation site locally + To run locally: 1. Install werf and docker. 1. Run: @@ -11,5 +17,3 @@ To run locally: ``` 1. Open `http://localhost/products/development-platform/documentation/` in your browser (for the english version) or `http://ru.localhost/products/development-platform/documentation/` (for the russian version). - -The project uses the [hugo-web-product-module](https://github.com/deckhouse/hugo-web-product-module/). diff --git a/docker-compose.yml b/docker-compose.yml index 40d546c..1e3ea4a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,8 @@ services: ports: - "80:80" depends_on: - - hugo + hugo: + condition: service_healthy hugo: image: hugomods/hugo:debian-ci-0.150.1 @@ -18,3 +19,9 @@ services: volumes: - "./:/src" - "../hugo-web-product-module/:/hugo-web-product-module:ro" + healthcheck: + test: ["CMD-SHELL", "curl -s http://localhost:1313 > /dev/null || exit 1"] + interval: 5s + timeout: 2s + retries: 10 + start_period: 1s