Skip to content

Commit

Permalink
fix(startjanssendemo): remove unneeded code and packages installation (
Browse files Browse the repository at this point in the history
…#10531)

fix(startjanssendemo): enhance the script

Signed-off-by: Amro Misbah <[email protected]>
Co-authored-by: Mohammad Abudayyeh <[email protected]>
  • Loading branch information
misba7 and moabu authored Dec 31, 2024
1 parent 3409098 commit 1ba8e98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 34 deletions.
42 changes: 8 additions & 34 deletions automation/startjanssendemo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -33,41 +35,24 @@ 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
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"

Expand Down Expand Up @@ -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"
Expand All @@ -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:
Expand Down Expand Up @@ -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"
Expand All @@ -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."
1 change: 1 addition & 0 deletions docs/includes/cn-system-requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1ba8e98

Please sign in to comment.