From 1ba8e9883ec7e1bcf1aa9b57bbe100211edfadb2 Mon Sep 17 00:00:00 2001 From: Amro Misbah Date: Tue, 31 Dec 2024 14:57:06 +0200 Subject: [PATCH] fix(startjanssendemo): remove unneeded code and packages installation (#10531) fix(startjanssendemo): enhance the script Signed-off-by: Amro Misbah Co-authored-by: Mohammad Abudayyeh <47318409+moabu@users.noreply.github.com> --- automation/startjanssendemo.sh | 42 +++++-------------------- docs/includes/cn-system-requirements.md | 1 + 2 files changed, 9 insertions(+), 34 deletions(-) diff --git a/automation/startjanssendemo.sh b/automation/startjanssendemo.sh index 278e5cef86d..5f73b928919 100644 --- a/automation/startjanssendemo.sh +++ b/automation/startjanssendemo.sh @@ -21,7 +21,9 @@ if [[ $JANS_PERSISTENCE != "MYSQL" ]] && [[ $JANS_PERSISTENCE != "PGSQL" ]]; the echo "[E] Incorrect entry. Please enter either MYSQL or PGSQL" exit 1 fi - +if [[ -z $JANS_VERSION ]]; then + JANS_VERSION="0.0.0-nightly" +fi LOG_TARGET="FILE" LOG_LEVEL="TRACE" if [[ -z $JANS_CI_CD_RUN ]]; then @@ -33,28 +35,13 @@ if [[ -z $EXT_IP ]]; then EXT_IP=$(curl ipinfo.io/ip) fi -wait_for_services() { - code=404 - while [[ "$code" != "200" ]]; do - echo "Waiting for https://${JANS_FQDN}/$1 to respond with 200" - code=$(curl -s -o /dev/null -w ''%{http_code}'' -k https://"${JANS_FQDN}"/"$1") - sleep 5 - done -} - sudo apt-get update -sudo apt-get install openssl -y sudo apt-get install python3-pip -y -sudo pip3 install pip --upgrade -sudo pip3 install setuptools --upgrade -sudo pip3 install pyOpenSSL --upgrade -sudo apt-get update -sudo apt-get install build-essential unzip -y sudo pip3 install requests --upgrade sudo pip3 install shiv sudo snap install microk8s --classic sudo microk8s.status --wait-ready -sudo microk8s.enable dns registry ingress hostpath-storage +sudo microk8s.enable dns registry ingress hostpath-storage helm3 sudo microk8s kubectl get daemonset.apps/nginx-ingress-microk8s-controller -n ingress -o yaml | sed -s "s@ingress-class=public@ingress-class=nginx@g" | microk8s kubectl apply -f - sudo apt-get update sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y @@ -62,12 +49,10 @@ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" sudo apt-get update sudo apt-get install net-tools -curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 -chmod 700 get_helm.sh -./get_helm.sh sudo apt-get install docker-ce docker-ce-cli containerd.io -y sudo microk8s config | sudo tee ~/.kube/config > /dev/null sudo snap alias microk8s.kubectl kubectl +sudo snap alias microk8s.helm3 helm KUBECONFIG=~/.kube/config sudo microk8s.kubectl create namespace jans --kubeconfig="$KUBECONFIG" || echo "namespace exists" @@ -100,7 +85,6 @@ config: cnSqldbUserPassword: Test1234# EOF fi - if [[ $JANS_PERSISTENCE == "PGSQL" ]]; then sudo microk8s.kubectl get po --kubeconfig="$KUBECONFIG" sudo helm install my-release --set auth.postgresPassword=Test1234#,auth.database=jans -n jans oci://registry-1.docker.io/bitnamicharts/postgresql --kubeconfig="$KUBECONFIG" @@ -120,7 +104,6 @@ config: cnSqldbUserPassword: Test1234# EOF fi - echo "$EXT_IP $JANS_FQDN" | sudo tee -a /etc/hosts > /dev/null cat << EOF >> override.yaml global: @@ -192,23 +175,13 @@ nginx-ingress: - secretName: tls-certificate hosts: - $JANS_FQDN -auth-server: - livenessProbe: - initialDelaySeconds: 300 - readinessProbe: - initialDelaySeconds: 300 EOF sudo helm repo add janssen https://docs.jans.io/charts sudo helm repo update sudo helm install janssen janssen/janssen -n jans -f override.yaml --kubeconfig="$KUBECONFIG" --version="$JANS_VERSION" - -wait_for_services jans-config-api/api/v1/health/ready -wait_for_services jans-scim/sys/health-check - cat << EOF > testendpoints.sh sudo microk8s config > config KUBECONFIG="$PWD"/config -sleep 10 echo -e "Testing openid-configuration endpoint.. \n" curl -k https://$JANS_FQDN/.well-known/openid-configuration echo -e "Testing scim-configuration endpoint.. \n" @@ -217,6 +190,7 @@ echo -e "Testing fido2-configuration endpoint.. \n" curl -k https://$JANS_FQDN/.well-known/fido2-configuration cd .. EOF -sudo microk8s.kubectl -n jans wait --for=condition=available --timeout=300s deploy/janssen-auth-server --kubeconfig="$KUBECONFIG" || echo "Couldn't find deployment running tests anyways..." +echo "Waiting for Janssen to come up. Please do not cancel out. This can take up to 5 minutes." +sudo microk8s.kubectl -n jans wait --for=condition=available --timeout=300s deploy/janssen-auth-server --kubeconfig="$KUBECONFIG" || echo "auth-server deployment is not ready. Running tests anyways..." sudo bash testendpoints.sh -echo -e "You may re-execute bash testendpoints.sh to do a quick test to check the openid-configuration endpoint." +echo -e "You may re-execute the command 'bash testendpoints.sh' to do a quick test to check the openid-configuration endpoint." \ No newline at end of file diff --git a/docs/includes/cn-system-requirements.md b/docs/includes/cn-system-requirements.md index af06b356bef..3bbe6ad2209 100644 --- a/docs/includes/cn-system-requirements.md +++ b/docs/includes/cn-system-requirements.md @@ -19,5 +19,6 @@ Use the listing below for a detailed estimation of minimum required resources. T | casa | 0.5 | 0.5GB | N/A | 64 Bit | No | | link | 0.5 | 1GB | N/A | 64 Bit | No | | saml | 0.5 | 1GB | N/A | 64 Bit | No | +| kc-scheduler - job| 0.3 | 0.3GB | N/A | 64 Bit | No | Releases of images are in style 1.0.0-beta.0, 1.0.0-0 \ No newline at end of file