1- #! /bin/bash
1+ #! /usr/bin/env bash
2+
3+ SCRIPT_DIR=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd )
24
35# Prompt the user to start the installation process
46echo " 🚀 Shortcut: This script will install Knative, and deploy the bookstore's frontend and backend on your cluster"
57
6- # Validate that the user is in the correct directory /start
7- if [ " ${PWD##*/ } " != " start" ]; then
8- echo " ⚠️ Please run this script in the /start directory. Exiting..."
9- exit
10- fi
11- echo " ✅ You are in the correct directory: /start"
128read -p " 🛑 Press ENTER to continue or Ctrl+C to abort..."
139
1410# Install Knative Serving
@@ -40,7 +36,7 @@ echo "✅ Knative In-Memory Channel and Broker installed successfully."
4036if ! command -v func & > /dev/null
4137then
4238 echo " "
43- echo " ⚠️ Knative CLI 'func' not found. Please install the Knative CLI by following the instructions at https://knative.dev/docs/admin /install/kn-cli/. "
39+ echo " ⚠️ Knative CLI 'func' not found. Please install the Knative CLI by following the instructions at https://knative.dev/docs/functions /install-func "
4440 exit
4541fi
4642
@@ -57,8 +53,7 @@ echo "📚 Installing the Sample Bookstore Frontend"
5753read -p " 🛑 Press ENTER to continue..."
5854
5955# Install the front end first
60- cd frontend
61- kubectl apply -f config
56+ kubectl apply -f " ${SCRIPT_DIR} /frontend/config"
6257
6358# Wait for the frontend to be ready
6459echo " "
@@ -76,8 +71,7 @@ echo ""
7671echo " 📚 Installing the Sample Bookstore Backend (node-server)"
7772
7873# Install the node-server
79- cd ../node-server
80- kubectl apply -f config/100-deployment.yaml
74+ kubectl apply -f " ${SCRIPT_DIR} /node-server/config/100-deployment.yaml"
8175
8276# Wait for the backend to be ready
8377echo " "
0 commit comments