29 lines
2 KiB
Bash
29 lines
2 KiB
Bash
#!/usr/bin/env bash
|
|
# Seafile CE 13.0, offizielles Compose laut manual.seafile.com/latest (= 13.0).
|
|
# Aufruf: sf-install.sh DOMAIN. Nur die als "required" markierten Felder werden gesetzt.
|
|
source /root/ep19fs/lib.sh; source /root/ep19fs/secrets
|
|
D=$1; mkdir -p /opt/seafile && cd /opt/seafile
|
|
wget -q -O .env https://manual.seafile.com/13.0/repo/docker/ce/env
|
|
wget -q https://manual.seafile.com/13.0/repo/docker/ce/seafile-server.yml
|
|
wget -q https://manual.seafile.com/13.0/repo/docker/seadoc.yml
|
|
wget -q https://manual.seafile.com/13.0/repo/docker/caddy.yml
|
|
cp .env env.orig
|
|
sed -i "s/^SEAFILE_SERVER_HOSTNAME=.*/SEAFILE_SERVER_HOSTNAME=$D/" .env
|
|
sed -i "s/^SEAFILE_SERVER_PROTOCOL=.*/SEAFILE_SERVER_PROTOCOL=https/" .env
|
|
sed -i "s/^JWT_PRIVATE_KEY=.*/JWT_PRIVATE_KEY=$SF_JWT/" .env
|
|
echo "geänderte Zeilen gegenüber der offiziellen .env: $(diff env.orig .env | grep -c '^>')"
|
|
grep -E '^(INIT_SEAFILE_ADMIN_EMAIL|INIT_SEAFILE_ADMIN_PASSWORD|SEAFILE_MYSQL_DB_PASSWORD|INIT_SEAFILE_MYSQL_ROOT_PASSWORD|ENABLE_NOTIFICATION_SERVER|ENABLE_SEADOC|SEAFILE_IMAGE)=' .env
|
|
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 Anmeldung mit den Werten aus der offiziellen .env klappt (INIT_SEAFILE_ADMIN_EMAIL/PASSWORD, unverändert)
|
|
U=https://$D; last=""
|
|
AE=$(grep ^INIT_SEAFILE_ADMIN_EMAIL= .env | cut -d= -f2); AP=$(grep ^INIT_SEAFILE_ADMIN_PASSWORD= .env | cut -d= -f2)
|
|
while :; do
|
|
r=$(curl -s -m 5 -o /tmp/sflogon -w '%{http_code}' -d "username=$AE" -d "password=$AP" "$U/api2/auth-token/")
|
|
[ "$r" != "$last" ] && echo " $(ts) +$(el $T0 $(now)) s POST /api2/auth-token/ HTTP $r" && last=$r
|
|
grep -q '"token"' /tmp/sflogon 2>/dev/null && break; sleep 1; done
|
|
echo "Erste erfolgreiche Admin-Anmeldung mit me@example.com / asecret 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}}'
|