From 41b1b8a2996f1b8bcca6f467f1c8b135350fdc1e Mon Sep 17 00:00:00 2001 From: f Date: Sat, 8 May 2021 18:31:13 -0300 Subject: [PATCH 1/2] usar nginx como servidor de prueba MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cambios: * compartir los pids permite correr `haini.sh "nginx -s reload"` después de iniciar `nginx`, antes no encontraba el pid. * se reemplazan `darkhttpd` y `nghttp2` en sutty-base-jekyll-theme. * todos los sitios tienen que terminar con `-jekyll-theme` para funcionar. --- haini.sh | 14 ++++++++++++-- nginx.conf | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 nginx.conf diff --git a/haini.sh b/haini.sh index 8c3b92f..08afd67 100755 --- a/haini.sh +++ b/haini.sh @@ -1,6 +1,9 @@ #!/bin/sh # Fallar ante cualquier error set -e +set -E + +DIR="`realpath $0 | xargs -r dirname`" # Por ahora sólo soportamos x86_64 uname -m | grep -q x86_64 || exit 1 @@ -28,7 +31,6 @@ function correr() { bwrap \ --unshare-user-try \ --unshare-ipc \ - --unshare-pid \ --unshare-uts \ --unshare-cgroup-try \ --bind "$ENTORNO" / \ @@ -82,7 +84,7 @@ function crear_entorno() { tzdata bash ffmpeg vips file git make \ ruby ruby-bundler ruby-json ruby-bigdecimal ruby-irb ruby-rake \ nodejs yarn \ - gnutls-utils nghttp2 \ + gnutls-utils nginx \ less" # Habilitar la instalación de gemas binarias @@ -95,6 +97,14 @@ function crear_entorno() { echo "Instalando node_modules..." correr "cd /Sutty/sutty && yarn install" + + # Deshabilitar el usuario de nginx + sed -re "/user nginx/d" -i "$ENTORNO/etc/nginx/nginx.conf" + + # Crear el directorio del PID + install -dm 755 "$ENTORNO/run/nginx" + # Instalar la configuración + install -m 640 "$DIR/nginx.conf" "$ENTORNO/etc/nginx/http.d/default.conf" } crear_entorno diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..8d2082f --- /dev/null +++ b/nginx.conf @@ -0,0 +1,21 @@ +server { + server_name ~(?.+).sutty.local; + listen 4000 ssl http2 default_server; + + ssl_certificate /Sutty/sutty.local/domain/sutty.local.crt; + ssl_certificate_key /Sutty/sutty.local/domain/sutty.local.key; + + root /Sutty/$domain-jekyll-theme/_site; + + add_header Cache-Control "no-store; max-age=0"; + + location /assets/js/ { + proxy_pass http://127.0.0.1:65001; + } + + location /sockjs-node/ { + proxy_set_header Connection "upgrade"; + proxy_set_header Upgrade $http_upgrade; + proxy_pass http://127.0.0.1:65001; + } +} From 04b8577a76782b8a5fdb61b847ec925beeaabecc Mon Sep 17 00:00:00 2001 From: void Date: Sun, 16 May 2021 16:20:29 +0000 Subject: [PATCH 2/2] =?UTF-8?q?POSIXificaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- haini.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/haini.sh b/haini.sh index de776af..9daeef1 100755 --- a/haini.sh +++ b/haini.sh @@ -1,9 +1,8 @@ #!/bin/sh # Fallar ante cualquier error set -e -set -E -DIR="`realpath $0 | xargs -r dirname`" +DIR="$(realpath "$0" | xargs -r dirname)" # Por ahora sólo soportamos x86_64 uname -m | grep -q x86_64 || exit 1