Compare commits

..

31 commits

Author SHA1 Message Date
fauno 7fe80d7fb4 Merge branch 'issue-47' into 'antifascista'
fix: no usar sysctl sin root #47

See merge request sutty/haini.sh!52
2023-01-18 16:50:05 +00:00
f 02efc493aa fix: no usar sysctl sin root #47 2023-01-16 14:54:50 -03:00
f c23ce4b2cc fix: $HOME 2022-12-01 14:15:01 -03:00
f 01a1eca869 fix: expandir la ruta 2022-12-01 14:12:11 -03:00
f 4149df450a fix: detectar presencia de Xauthority 2022-12-01 14:10:05 -03:00
fauno ac4bd0a57a Merge branch 'issue-34' into 'antifascista'
fix: leer stdin solo si es una terminal real #34

See merge request sutty/haini.sh!46
2022-12-01 16:41:32 +00:00
fauno 1127d5ab61 Merge branch 'soportar-x' into 'antifascista'
soportar X

See merge request sutty/haini.sh!42
2022-12-01 16:40:50 +00:00
f def36cf183 fix: montar xauthority ro 2022-11-28 12:05:37 -03:00
f 79f72a80f0 fix: instalar npm 2022-11-16 16:47:22 -03:00
f 5729880a37 fix: no actualizar en cronjobs 2022-11-10 13:32:30 -03:00
f 306ec0efc0 fix: leer stdin solo si es una terminal real #34 2022-11-09 20:04:51 -03:00
Nulo 834d485b18 Merge branch 'issue-36' into 'antifascista'
fix: comprobar actualizacion de hainish

See merge request sutty/haini.sh!45
2022-10-30 14:30:01 +00:00
f 8698a22f0a fix: no mostrar la salida del ping
relacionado con #28
2022-10-29 18:25:22 -03:00
f 9bd12bc8fd fix: typo en la comprobación #36 2022-10-29 18:25:04 -03:00
f 6de964e649 soportar X
por si estamos testeando en navegadores por ejemplo
2022-08-27 22:40:00 -03:00
Nulo 6a465a1fa4 Merge branch 'unprivileged_userns_clone' into 'antifascista'
no fallar si no existe  /proc/sys/kernel/unprivileged_userns_clone

See merge request sutty/haini.sh!37
2022-03-30 17:47:20 +00:00
fauno ba1a7c75fe Merge branch 'optimizar-imagenes' into 'antifascista'
instalar optimizadores de imagenes

See merge request sutty/haini.sh!40
2022-03-30 17:46:34 +00:00
fauno 77e8f140f3 Merge branch 'auto-update' into 'antifascista'
hacer autoactualización

See merge request sutty/haini.sh!39
2022-03-17 16:14:53 +00:00
Cat /dev/Nulo 09e732bdc4 Notificar cuando se actualiza o falla 2022-03-17 15:25:49 +00:00
f 6010347b8c instalar optimizadores de imagenes 2022-03-15 13:55:35 -03:00
f 9095a54a97 hacer autoactualización 2022-03-15 13:52:10 -03:00
fauno 0229fa5fbc Merge branch 'localized-pack' into 'antifascista'
que el js funcione en otros idiomas

See merge request sutty/haini.sh!38
2022-02-16 18:37:10 +00:00
f 6b00075d63 que el js funcione en otros idiomas 2022-02-10 19:23:39 -03:00
f 2f7d16626b no fallar si no existe /proc/sys/kernel/unprivileged_userns_clone 2022-01-07 12:02:27 -03:00
fauno 69e0d7f9c4 Merge branch 'custom-nginx' into 'antifascista'
nginx.conf: permitir configuración propia del sitio

Closes #27

See merge request sutty/haini.sh!35
2021-11-25 22:57:16 +00:00
fauno 034924f69e Merge branch 'env-file' into 'antifascista'
Aceptar un parametro ENV_FILE

Closes #11

See merge request sutty/haini.sh!33
2021-11-25 22:56:40 +00:00
Cat /dev/Nulo c6287ab8ff nginx.conf: usar _nginx.conf de los sitios 2021-11-25 22:49:17 +00:00
fauno c4efdd0334 Merge branch 'certificados-tienda' into 'antifascista'
domains.ext: generar certificados para la tienda

Closes #13

See merge request sutty/haini.sh!36
2021-11-25 21:38:13 +00:00
Cat /dev/Nulo ec471e1d4e domains.ext: generar certificados para la tienda 2021-11-25 21:28:58 +00:00
Cat /dev/Nulo 8e1a834e47 nginx.conf: permitir configuración propia del sitio 2021-11-25 21:27:03 +00:00
Cat /dev/Nulo b3c9e18fac Aceptar un parametro ENV_FILE 2021-10-28 15:29:56 -03:00
8 changed files with 39 additions and 65 deletions

View file

@ -1,30 +0,0 @@
pipeline:
shellcheck:
image: docker.io/alpine:3.14
commands:
- apk add shellcheck
- shellcheck haini.sh
publish:
image: plugins/docker
registry: registry.nulo.in
repo: registry.nulo.in/sutty/haini.sh
tags: latest,root
dockerfile: Containerfile
username: sutty
secrets:
- docker_password
when:
branch: container-ci
event: push
publish-rootless:
image: plugins/docker
registry: registry.nulo.in
repo: registry.nulo.in/sutty/haini.sh
tags: rootless
dockerfile: Containerfile.rootless
username: sutty
secrets:
- docker_password
when:
branch: container-ci
event: push

View file

@ -1,17 +0,0 @@
FROM docker.io/alpine:3.13
RUN apk add --no-cache openssh-client make git bash coreutils diffutils sudo
RUN echo "https://alpine.sutty.nl/alpine/v3.13/sutty" >> "/etc/apk/repositories" && \
wget https://alpine.sutty.nl/alpine/sutty.pub -O "/etc/apk/keys/alpine@sutty.nl-5ea884cd.rsa.pub"
COPY packages /root/packages
COPY bin /usr/local/bin
RUN chmod 755 /usr/local/bin/*
RUN apk add --no-cache $(cat "/root/packages" | tr "\n" " ")
RUN sed -re "s/#(@platforms = )/\1/" -i "/usr/lib/ruby/2.7.0/rubygems.rb" && \
mkdir -m 700 -p "~/.ssh"
COPY ssh/known_hosts /root/.ssh/known_hosts
COPY .gemrc /root/.gemrc

View file

@ -1,14 +0,0 @@
FROM registry.nulo.in/sutty/haini.sh:root
RUN mkdir -p /home && \
adduser \
--disabled-password \
--gecos "" \
--home /home/suttier \
suttier && \
cp /root/.gemrc /home/suttier/.gemrc && \
cp -r /root/.ssh /home/suttier/.ssh && \
chown -R suttier:suttier /home/suttier/ && \
echo "suttier ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
USER suttier

View file

@ -5,3 +5,4 @@ subjectAltName = @alt_names
[alt_names]
DNS.1 = sutty.local
DNS.2 = *.sutty.local
DNS.3 = *.tienda.sutty.local

View file

@ -21,7 +21,7 @@ if ! test "$HAIN_ENV" && ! type bwrap >/dev/null 2>&1 ; then
exit 1
fi
if test "$(sysctl -n kernel.unprivileged_userns_clone)" -ne 1 ; then
if test -f /proc/sys/kernel/unprivileged_userns_clone && test "$(cat /proc/sys/kernel/unprivileged_userns_clone)" -ne 1 ; then
echo "Necesitamos configurar tu sistema, ingresa tu contraseña para correr el comando" >&2
echo "sudo sysctl -a kernel.unprivileged_userns_clone=1" >&2
sudo sysctl -a kernel.unprivileged_userns_clone=1
@ -50,12 +50,14 @@ correr() {
fi
env -i \
DISPLAY="$DISPLAY" \
TERM="$TERM" \
USER="suttier" \
HOME="/home/suttier" \
HAIN_ENV=true \
RAILS_ENV="${RAILS_ENV:-development}" \
JEKYLL_ENV="${JEKYLL_ENV:-development}" \
$(test -f "$ENV_FILE" && (grep -v '^#' "$ENV_FILE" | xargs -0) || true) \
EDITOR="nano" \
PAGER="less -niSFX" \
SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" \
@ -69,6 +71,7 @@ correr() {
--unshare-cgroup-try \
--bind "$ENTORNO" / \
--bind "$ROOT" /Sutty \
$(test -f ~/.Xauthority && echo "--ro-bind $HOME/.Xauthority /home/suttier/.Xauthority") \
--ro-bind /etc/hosts /etc/hosts \
--ro-bind /etc/resolv.conf /etc/resolv.conf \
--ro-bind /etc/localtime /etc/localtime \
@ -214,6 +217,29 @@ crear_entorno() {
test -f "$ENTORNO/usr/local/share/ca-certificates/ca-sutty.crt" || mv "$ENTORNO/etc/ssl/certs/ca-sutty.crt" "$ENTORNO/usr/local/share/ca-certificates/ca-sutty.crt"
}
# Auto-actualizar una vez por hora
actualizar() {
test ! "$TERM" = "dumb" || return
last_update="$(find "$DIR/.git/FETCH_HEAD" -mmin +60 | wc -l)"
if test ! $last_update -ne 0; then
return
fi
echo -n "Actualizando haini.sh... " >&2
if ping -q -c 1 0xacab.org >/dev/null 2>&1; then
git -C "$DIR" pull --ff-only
if test "$DIR/.git/FETCH_HEAD" -ot "$DIR/.git/ORIG_HEAD"; then
echo "haini.sh se actualizó, por favor volvé a ejecutar el comando" >&2
exit 0
fi
else
echo "no se pudo conectar 0xacab.org, intentando la próxima vez." >&2
fi
}
DEFAULT="sh"
case $1 in
@ -245,8 +271,9 @@ else
fi
fi
actualizar
crear_entorno
stdin=/dev/stdin correr "${*:-$DEFAULT}" ; salida=$?
stdin="$(test "$TERM" = "dumb" || echo "/dev/stdin")" correr "${*:-$DEFAULT}" ; salida=$?
${SSH_ADHOC} && ssh-agent -k

View file

@ -9,6 +9,10 @@ server {
add_header Cache-Control "no-store; max-age=0";
location ~ /../assets/js/pack.js {
rewrite ^ /assets/js/pack.js last;
}
location /assets/js/pack.js {
proxy_pass http://127.0.0.1:65001;
}
@ -23,3 +27,5 @@ server {
proxy_pass http://127.0.0.1:65001;
}
}
include /Sutty/*-jekyll-theme/_nginx.conf;

View file

@ -4,6 +4,7 @@ ffmpeg
file
git
git-lfs
jpegoptim
less
libssh2
libxml2
@ -14,15 +15,16 @@ nano-syntax
ncurses-terminfo
nginx
nodejs
npm
openssh-client
openssl
oxipng
postgresql
postgresql-contrib
postgresql-libs
py3-brotli
py3-cffi
py3-fonttools
rsync
ruby
ruby-bigdecimal
ruby-bundler

View file

@ -1,4 +1,3 @@
0xacab.org,198.252.153.239 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKdh69MJNIA4hZNdplalK1BOD4QZEKn8msMwsEzA7nrr
athshe.sutty.nl,172.96.172.58 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIDqJl9IW6WXAxrtZXMzvMnIpTjIZB+Tp+dDUpSaOrqdjqdMVjHVQSFnVh0MLHbvdjKKtxaKDAuT3JXGrSp8wyA=
anarres.sutty.nl,54.39.161.205 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGw9aXovdiR44WzGfaitjlGiAO7I5OP/XgxFEc+t6HWeS0oqIVaEo17y7j29hLZbTRpN8vWoGSMa+UtquQZ6JG8=
[nulo.in]:420 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHgHIbf5/jkeyLMndnWlEO12DPj41YPqkmz+aIreVOsP