Skip to content

Commit

Permalink
allow script to be run from any directory
Browse files Browse the repository at this point in the history
  • Loading branch information
dprotaso committed Feb 10, 2025
1 parent c4025bc commit ef9c5c1
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions code-samples/eventing/bookstore-sample-app/start/setup.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
#!/bin/bash
#!/usr/bin/env bash

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

# Prompt the user to start the installation process
echo "πŸš€ Shortcut: This script will install Knative, and deploy the bookstore's frontend and backend on your cluster"

# Validate that the user is in the correct directory /start
if [ "${PWD##*/}" != "start" ]; then
echo "⚠️ Please run this script in the /start directory. Exiting..."
exit
fi
echo "βœ… You are in the correct directory: /start"
read -p "πŸ›‘ Press ENTER to continue or Ctrl+C to abort..."

# Install Knative Serving
Expand Down Expand Up @@ -57,8 +53,7 @@ echo "πŸ“š Installing the Sample Bookstore Frontend"
read -p "πŸ›‘ Press ENTER to continue..."

# Install the front end first
cd frontend
kubectl apply -f config
kubectl apply -f "${SCRIPT_DIR}/frontend/config"

# Wait for the frontend to be ready
echo ""
Expand All @@ -76,8 +71,7 @@ echo ""
echo "πŸ“š Installing the Sample Bookstore Backend (node-server)"

# Install the node-server
cd ../node-server
kubectl apply -f config/100-deployment.yaml
kubectl apply -f "${SCRIPT_DIR}/node-server/config/100-deployment.yaml"

# Wait for the backend to be ready
echo ""
Expand Down

0 comments on commit ef9c5c1

Please sign in to comment.