diff options
Diffstat (limited to 'roles/lounge/templates')
| -rw-r--r-- | roles/lounge/templates/error.html | 37 | ||||
| -rw-r--r-- | roles/lounge/templates/nginx-site-config | 63 | ||||
| -rw-r--r-- | roles/lounge/templates/thelounge.service | 11 |
3 files changed, 111 insertions, 0 deletions
diff --git a/roles/lounge/templates/error.html b/roles/lounge/templates/error.html new file mode 100644 index 0000000..5e2a093 --- /dev/null +++ b/roles/lounge/templates/error.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>{{lounge_domain}} currently unavailable</title> + <style> + body { padding: 20px; font-family: Arial, sans-serif } + </style> +</head> +<body> + <h1>Web-based chat is currently unavailable (code 502)</h1> + + <p>The web-based IRC interface will be available during <a href="https://{{emacsconf_domain}}/{{emacsconf_year}}">{{emacsconf_name}} {{emacsconf_year}}</a>. Please check back then. In the meantime, you can also connect to {{irc_network}}:{{irc_port}} with your favorite IRC client and join {{irc_channels}}. + + <p>This page will refresh when the site is back. You can also check <a href="https://status.emacsconf.org">status.emacsconf.org</a> for updates.</p> + + <noscript>Your browser doesn’t support javascript. Please try refreshing the page manually every few minutes.</noscript> + + <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> + <script> + var retryCurrent = 30, retryMax = 60 * 5; + async function check() { + let result = await fetch(window.location.href, { method: HEAD }).then(resp => { + if (resp.status == 200) { + window.location.reload(true); + } else if (resp.status == 502) { + if (retryCurrent < retryMax) { + retryCurrent = Math.min(retryCurrent * 2, retryMax); + } + setTimeout(check, retryCurrent * 1000); + } + }); + } + setTimeout(check_response, retryCurrent * 1000); + </script> +</body> +</html> diff --git a/roles/lounge/templates/nginx-site-config b/roles/lounge/templates/nginx-site-config new file mode 100644 index 0000000..cc6aa4d --- /dev/null +++ b/roles/lounge/templates/nginx-site-config @@ -0,0 +1,63 @@ +upstream backend { + server 127.0.0.1:9000; +} + +proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=thelounge_cache:10m max_size=3g inactive=120m use_temp_path=off; + + +server { + listen 80; + listen [::]:80; + server_name chat.emacsconf.org; + + include snippets/well-known-acme-challenge.conf; + + location /js-licenses.html { root /var/www/{{lounge_domain}}; } + + location / { + return 302 https://$server_name$request_uri; + } +} + +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + server_name {{lounge_domain}}; + + include /etc/nginx/tls/{{emacsconf_domain}}.conf; + + location /js-licenses.html { root /var/www/{{lounge_domain}}; } + error_page 502 /error.html; + location = /error.html { + root /var/www/{{lounge_domain}}; + } + location / { + proxy_pass http://backend; + proxy_http_version 1.1; + proxy_set_header Connection "upgrade"; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + + # by default nginx times out connections in one minute + proxy_read_timeout 1d; + } + +} + +#server { +# listen 443 ssl http2; +# listen [::]:443 ssl http2; +# server_name chat.emacsconf.org; +# +# include /etc/nginx/tls/emacsconf.org.conf; +# root /var/www/chat.emacsconf.org; +#} + +server { + listen 80; + listen [::]:80; + server_name chat.emacsconf.com chat.emacsconf.net; + + return 302 $scheme://{{lounge_domain}}$request_uri; +} diff --git a/roles/lounge/templates/thelounge.service b/roles/lounge/templates/thelounge.service new file mode 100644 index 0000000..abc4868 --- /dev/null +++ b/roles/lounge/templates/thelounge.service @@ -0,0 +1,11 @@ +[Unit] +Description=The Lounge IRC Client +After=network.target + +[Service] +ExecStart=/usr/bin/thelounge start +User=thelounge +WorkingDirectory=/var/lib/thelounge + +[Install] +WantedBy=multi-user.target |
