From de29603e75173ef25547048ace288c8674a2cb63 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Mon, 2 May 2022 17:59:11 +0000 Subject: [PATCH] nextcloud: rework for automation --- nextcloud/README.md | 35 ---------------- nextcloud/docker-compose.yaml | 13 +++--- nextcloud/setup | 75 +++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 41 deletions(-) delete mode 100644 nextcloud/README.md create mode 100755 nextcloud/setup diff --git a/nextcloud/README.md b/nextcloud/README.md deleted file mode 100644 index 83f2a55..0000000 --- a/nextcloud/README.md +++ /dev/null @@ -1,35 +0,0 @@ -Enable SSO: - -``` -( cd ../keycloak ; sudo docker-compose exec -T keycloak \ - /opt/keycloak/bin/kcadm.sh \ - create clients \ - --realm master --user admin --password admin \ - -r spacestation \ - -f - ) <&2 "$@" ; exit 1 ; } + +DIRNAME="$(dirname $0)" +cd "$DIRNAME" +[ -r env.production ] && source env.production +[ -r ../env.production ] && source ../env.production + +sudo docker-compose exec -u www-data -T nextcloud \ + ./occ app:install sociallogin \ +|| die "unable to install sociallogin app" + +sudo docker-compose exec -u www-data -T nextcloud \ + ./occ config:app:set sociallogin prevent_create_email_exists --value=1 \ +|| die "unable to config sociallogin" + +sudo docker-compose exec -u www-data -T nextcloud \ + ./occ config:app:set sociallogin update_profile_on_login --value=1 \ +|| die "unable to config sociallogin" + +BASE="https://$KEYCLOAK_HOSTNAME/realms/$REALM/protocol/openid-connect" +SECRET="$(openssl rand -hex 20)" +PROVIDER="$(jq -c . <