From mboxrd@z Thu Jan 1 00:00:00 1970 From: "pelzflorian (Florian Pelz)" Subject: bug#26302: Deploying the =?UTF-8?Q?i18n=E2=80=99d?= web site Date: Thu, 9 Apr 2020 05:21:46 +0200 Message-ID: <20200409032146.tm76qkrwwydfadye@pelzflorian.localdomain> References: <20190908171638.cna67eearj4rbn2k@pelzflorian.localdomain> <16d18a5a9e8.12ab66c8254154.2756956535677606704@zoho.com> <20190915201819.3yxm25fayvbxwdpl@pelzflorian.localdomain> <20191007081502.wog4q4wjptvhmejf@pelzflorian.localdomain> <20191008093719.duvx26l2ods3fg75@pelzflorian.localdomain> <20191117161702.bfmuiukhyacbukqf@pelzflorian.localdomain> <87d090ibk5.fsf_-_@gnu.org> <20200325232100.ynsy7xog4vt6nq5q@pelzflorian.localdomain> <87sghf6lkv.fsf@gnu.org> <20200407220225.zlw64sywakcajvkt@pelzflorian.localdomain> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="rtwdw7hi5bzmgb7o" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:51391) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jMNlT-00086b-BX for bug-guix@gnu.org; Wed, 08 Apr 2020 23:22:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jMNlS-0001oC-0b for bug-guix@gnu.org; Wed, 08 Apr 2020 23:22:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41507) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jMNlR-0001nj-TV for bug-guix@gnu.org; Wed, 08 Apr 2020 23:22:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jMNlR-00029r-OY for bug-guix@gnu.org; Wed, 08 Apr 2020 23:22:01 -0400 Sender: "Debbugs-submit" Resent-Message-ID: Content-Disposition: inline In-Reply-To: <20200407220225.zlw64sywakcajvkt@pelzflorian.localdomain> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane-mx.org@gnu.org Sender: "bug-Guix" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: sirgazil , 26302 <26302@debbugs.gnu.org> --rtwdw7hi5bzmgb7o Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Apr 08, 2020 at 12:02:25AM +0200, pelzflorian (Florian Pelz) wrote: > set_from_accept_language should better be a global directive I think. > No, I was wrong. set_from_accept_language must only appear once, but not in a global directive. I put it in %extra-content for the nginx-configuration now. It seems the attached patch works (after removing the rottlog service), but I could not yet test building the website i.e. if the redirects really work correctly. It is so slow. Then again, better break the website before the release than after (if it does not work). I cannot test tls and certbot anyway. Regards, Florian --rtwdw7hi5bzmgb7o Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="deploy-i18n.patch" diff --git a/hydra/nginx/berlin.scm b/hydra/nginx/berlin.scm index 303fd35..a57640e 100644 --- a/hydra/nginx/berlin.scm +++ b/hydra/nginx/berlin.scm @@ -461,20 +461,24 @@ PUBLISH-URL." (body (list "alias /srv/guix.gnu.org-i18n;"))) (git-http-nginx-location-configuration (git-http-configuration)) ;; For Hurd bootstrap binaries. (nginx-location-configuration (uri "/guix") (body (list "root /var/www;"))) + (nginx-location-configuration + (uri "~ (.html|.htm)$") + (body (list "try_files /$lang/$uri $uri =404;"))) + (nginx-location-configuration ;certbot (uri "/.well-known") (body (list "root /var/www;"))))) (define guix.info-locations (list (nginx-location-configuration ;certbot (uri "~ ^/\\.well-known") (body (list "root /var/www;"))) (nginx-location-configuration (uri "~ /(.*)") @@ -507,31 +511,33 @@ PUBLISH-URL." (list "access_log /var/log/nginx/bootstrappable.access.log;"))) (nginx-server-configuration (listen '("80")) (server-name '("guix.gnu.org")) (root "/srv/guix.gnu.org") (locations guix.gnu.org-locations) (raw-content (list + "rewrite (.*)/$ $1/index.html;" "access_log /var/log/nginx/guix-info.access.log;"))) (nginx-server-configuration (listen '("80")) (server-name '("guix.info" "www.guix.info")) (locations guix.info-locations) (raw-content (append %tls-settings (list + "rewrite (.*)/$ $1/index.html;" "access_log /var/log/nginx/guix-info.https.access.log;")))) (nginx-server-configuration (listen '("80")) (server-name '("issues.guix.info" "issues.guix.gnu.org")) (root "/home/rekado/mumi/") (locations (list (nginx-location-configuration ;certbot (uri "/.well-known") @@ -614,33 +620,35 @@ PUBLISH-URL." (listen '("443 ssl")) (server-name '("guix.info" "www.guix.info")) (ssl-certificate (le "guix.info")) (ssl-certificate-key (le "guix.info" 'key)) (locations guix.info-locations) (raw-content (append %tls-settings (list + "rewrite (.*)/$ $1/index.html;" "access_log /var/log/nginx/guix-info.https.access.log;")))) (nginx-server-configuration (listen '("443 ssl")) (server-name '("guix.gnu.org")) (ssl-certificate (le "guix.gnu.org")) (ssl-certificate-key (le "guix.gnu.org" 'key)) (root "/srv/guix.gnu.org") (locations guix.gnu.org-locations) (raw-content (append %tls-settings (list + "rewrite (.*)/$ $1/index.html;" "access_log /var/log/nginx/guix-gnu-org.https.access.log;")))) (nginx-server-configuration (listen '("443 ssl")) (server-name '("issues.guix.info")) (ssl-certificate (le "issues.guix.info")) (ssl-certificate-key (le "issues.guix.info" 'key)) (root "/home/rekado/mumi/") (locations (list (nginx-location-configuration @@ -710,20 +718,22 @@ PUBLISH-URL." "proxy_send_timeout 600;" "proxy_read_timeout 600;" "send_timeout 600;" "access_log /var/log/nginx/workflows-guix-info.https.access.log;")))))) (define %extra-content (list "default_type application/octet-stream;" "sendfile on;" + "set_from_accept_language $lang en de;" + ;; Maximum chunk size to send. Partly this is a workaround for ;; , but also the nginx docs mention that ;; "Without the limit, one fast connection may seize the worker ;; process entirely." ;; "sendfile_max_chunk 1m;" "keepalive_timeout 65;" ;; Use HTTP 1.1 to talk to the backend so we benefit from keep-alive @@ -768,20 +778,25 @@ PUBLISH-URL." "proxy_connect_timeout 7s;" "proxy_read_timeout 10s;" "proxy_send_timeout 10s;" ;; Cache timeouts for a little while to avoid increasing pressure. "proxy_cache_valid 504 30s;")) (define %nginx-configuration (nginx-configuration (server-blocks %berlin-servers) + (modules + (list + ;; Module to redirect users to the localized pages of their choice. + (file-append nginx-accept-language-module + "/etc/nginx/modules/ngx_http_accept_language_module.so"))) (global-directives ;; This is a 72-core machine, but let's not use all of them for nginx. '((worker_processes . 16) (pcre_jit . on) (events . ((worker_connections . 1024))))) (extra-content (string-join %extra-content "\n")))) (define %zabbix-nginx-server (nginx-server-configuration --rtwdw7hi5bzmgb7o--