Files
gallinero-init/traefik-init.sh

44 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
set -e
ok () { echo "ok -- $@" >&2; }
not_ok () { echo "not ok -- $@" >&2; }
if test $UID -eq 0 ; then
not_ok "No correr con sudo!"
exit 1
fi
abra servidor agregar --local
if ! test -d ~/certificados; then
ok "Clonando repositorio de certificados"
git clone https://git.coopcloud.tech/escuela-comun/certificados.git ~/certificados
fi
cd ~/certificados
ok "Actualizando repositorio de certificados"
git pull
domain=$HOSTNAME.rap.partidopirata.com.ar
traefik=traefik.$domain
if ! test -f ~/.abra/servers/default/$traefik.env; then
ok "Creando Traefik"
abra aplicacion nueva traefik -D $traefik -s default
fi
ok "Activando certificados locales"
sed -re "s/^#(WILDCARDS_ENABLED=1)$/\1/" \
-e "s/^#(SECRET_WILDCARD_CERT_VERSION=v1)$/\1/" \
-e "s/^#(SECRET_WILDCARD_KEY_VERSION=v1)$/\1/" \
-e "s/^#(COMPOSE_FILE=\".COMPOSE_FILE:compose.wildcard.yml\")$/\1/" \
-i ~/.abra/servers/default/$traefik.env
ok "Generando e instalando certificados"
make coopcloud domain=$domain
ok "Desplegando"
abra aplicacion desplegar -n $traefik