28 lines
2 KiB
Bash
28 lines
2 KiB
Bash
#!/usr/bin/env bash
|
|
# OpenCloud, offizielles Compose (opencloud-compose, Weg "Default Setup with Traefik" ohne Collabora).
|
|
# Aufruf: oc-install.sh DOMAIN (Admin-Passwort aus /root/ep19fs/secrets: OC_ADMIN_PW)
|
|
source /root/ep19fs/lib.sh; source /root/ep19fs/secrets
|
|
D=$1; cd /root
|
|
git clone -q https://github.com/opencloud-eu/opencloud-compose.git && cd opencloud-compose && git log -1 --format='compose repo commit %h %cs'
|
|
cp .env.example .env
|
|
# Änderungen laut offizieller Anleitung (docs.opencloud.eu, Default Setup with Traefik):
|
|
sed -i 's/^INSECURE=true/# INSECURE=true/' .env
|
|
sed -i "s/^OC_DOMAIN=.*/OC_DOMAIN=$D/" .env
|
|
sed -i "s/^TRAEFIK_ACME_MAIL=.*/TRAEFIK_ACME_MAIL=you@your-real-domain.tld/" .env
|
|
sed -i "s/^INITIAL_ADMIN_PASSWORD=.*/INITIAL_ADMIN_PASSWORD=$OC_ADMIN_PW/" .env
|
|
echo 'COMPOSE_FILE=docker-compose.yml:traefik/opencloud.yml' >> .env
|
|
echo "geänderte Zeilen gegenüber .env.example: $(diff .env.example .env | grep -c '^>')"
|
|
T0=$(now); echo "T0 $(ts) UTC docker compose up -d"
|
|
docker compose up -d 2>&1 | tail -3
|
|
echo "compose up returned after $(el $T0 $(now)) s"
|
|
echo $T0 > /root/ep19fs/T0
|
|
# Warten bis die Admin-Anmeldung am eingebauten IdP klappt (gleicher Aufruf wie das Anmeldeformular)
|
|
U=https://$D; last=""
|
|
while :; do
|
|
r=$(curl -s -m 5 -o /tmp/oclogon -w '%{http_code}' -X POST "$U/signin/v1/identifier/_/logon" -H 'Content-Type: application/json' -H 'Kopano-Konnect-XSRF: 1' -H "Referer: $U/signin/v1/identifier" -H "Origin: $U" \
|
|
-d "{\"params\":[\"admin\",\"$OC_ADMIN_PW\",\"1\"],\"hello\":{\"scope\":\"openid profile email\",\"client_id\":\"web\",\"redirect_uri\":\"$U/oidc-callback.html\",\"flow\":\"oidc\"}}")
|
|
[ "$r" != "$last" ] && echo " $(ts) +$(el $T0 $(now)) s logon HTTP $r" && last=$r
|
|
grep -q '"success":true' /tmp/oclogon 2>/dev/null && break; sleep 1; done
|
|
echo "Erste erfolgreiche Admin-Anmeldung nach $(el $T0 $(now)) s ($(ts) UTC)"
|
|
curl -s -o /dev/null -w "Zertifikat gültig: ssl_verify_result=%{ssl_verify_result}\n" $U/
|
|
docker compose ps --format '{{.Name}} {{.Image}} {{.Status}}'
|