Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/perf-profiler/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ARG ASYNC_PROFILER_SHA256=1233f26fc95753e75ce32733bbcaf8f0bedc2c098b0e798af87935
RUN yum install -y tar gzip && yum clean all

# Bake async-profiler into the image (no runtime GitHub fetch); verify the download.
RUN curl -sSL -o /tmp/ap.tgz \
RUN curl -fsSL --retry 5 --retry-delay 5 --retry-all-errors -o /tmp/ap.tgz \
"https://github.com/async-profiler/async-profiler/releases/download/v${ASYNC_PROFILER_VERSION}/async-profiler-${ASYNC_PROFILER_VERSION}-linux-${TARGETARCH}.tar.gz" \
&& echo "${ASYNC_PROFILER_SHA256} /tmp/ap.tgz" | sha256sum -c - \
&& mkdir -p /opt/async-profiler \
Expand Down
12 changes: 8 additions & 4 deletions infra/scripts/deploy/java-on-amazon-eks/metrics-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set -uo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
[ -f "${SCRIPT_DIR}/../../lib/common.sh" ] && source "${SCRIPT_DIR}/../../lib/common.sh"
source "${SCRIPT_DIR}/../../lib/retry.sh"
command -v log_info >/dev/null 2>&1 || {
log_info() { echo "ℹ️ $*"; }
log_success() { echo "✅ $*"; }
Expand All @@ -23,10 +24,13 @@ LOG="${WORKSHOP_LOG_DIR:-/tmp}/metrics-server.log"
METRICS_SERVER_CHART_VERSION="${METRICS_SERVER_CHART_VERSION:-3.14.0}" # metrics-server 0.9.0

log_info "Installing metrics-server (chart ${METRICS_SERVER_CHART_VERSION})..."
helm repo add metrics-server https://kubernetes-sigs.github.io/metrics-server/ >/dev/null 2>&1 || true
helm repo update >/dev/null 2>&1
if helm upgrade --install metrics-server metrics-server/metrics-server \
--namespace kube-system --version "${METRICS_SERVER_CHART_VERSION}" \
CHARTS="$(mktemp -d)"
trap 'rm -rf "${CHARTS}"' EXIT
retry_command 5 5 LOG "metrics-server chart ${METRICS_SERVER_CHART_VERSION}" \
"helm repo add --force-update metrics-server https://kubernetes-sigs.github.io/metrics-server/ >>'$LOG' 2>&1 && helm pull metrics-server/metrics-server --version ${METRICS_SERVER_CHART_VERSION} --destination '${CHARTS}' >>'$LOG' 2>&1" \
|| { log_error "Download of the metrics-server chart failed — last 20 lines of $LOG:"; tail -n 20 "$LOG"; exit 1; }
if helm upgrade --install metrics-server "${CHARTS}/metrics-server-${METRICS_SERVER_CHART_VERSION}.tgz" \
--namespace kube-system \
--wait --timeout 5m >>"$LOG" 2>&1; then
log_success "metrics-server installed (kubectl top / eks-node-viewer utilization available)"
else
Expand Down
13 changes: 9 additions & 4 deletions infra/scripts/deploy/java-on-amazon-eks/perf-profiler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/../../lib/common.sh"
source "${SCRIPT_DIR}/../../lib/retry.sh"
LOG="${WORKSHOP_LOG_DIR}/perf-profiler.log"
[ -f /etc/profile.d/workshop.sh ] && source /etc/profile.d/workshop.sh

Expand Down Expand Up @@ -65,11 +66,15 @@ install() {
case "${image_ref}" in *@sha256:*) ;; *) log_error "no perf-profiler image found — run '$0 build' first"; exit 1;; esac

log_info "Installing Kyverno ${KYVERNO_CHART_VERSION}..."
helm repo add kyverno https://kyverno.github.io/kyverno/ >/dev/null 2>&1 || true
helm repo update >/dev/null
helm upgrade --install kyverno kyverno/kyverno \
--namespace kyverno --create-namespace --version "${KYVERNO_CHART_VERSION}" \
local charts
charts="$(mktemp -d)"
retry_command 5 5 LOG "Kyverno chart ${KYVERNO_CHART_VERSION}" \
"helm repo add --force-update kyverno https://kyverno.github.io/kyverno/ >>'$LOG' 2>&1 && helm pull kyverno/kyverno --version ${KYVERNO_CHART_VERSION} --destination '${charts}' >>'$LOG' 2>&1" \
|| { log_error "Download of the Kyverno chart failed — last 40 lines of $LOG:"; tail -n 40 "$LOG"; exit 1; }
helm upgrade --install kyverno "${charts}/kyverno-${KYVERNO_CHART_VERSION}.tgz" \
--namespace kyverno --create-namespace \
--wait --timeout 10m >>"$LOG" 2>&1 || { log_error "kyverno helm install failed — last 40 lines of $LOG:"; tail -n 40 "$LOG"; exit 1; }
rm -rf "${charts}"
log_success "Kyverno installed"

log_info "Applying inject-perf-profiler MutatingPolicy (image ${image_ref}, app UID ${APP_UID})..."
Expand Down
3 changes: 2 additions & 1 deletion infra/scripts/deploy/java-on-amazon-eks/startup-cpu-boost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ set -uo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
[ -f "${SCRIPT_DIR}/../../lib/common.sh" ] && source "${SCRIPT_DIR}/../../lib/common.sh"
[ -f /etc/profile.d/workshop.sh ] && source /etc/profile.d/workshop.sh
source "${SCRIPT_DIR}/../../lib/retry.sh"
command -v log_info >/dev/null 2>&1 || {
log_info() { echo "ℹ️ $*"; }
log_success() { echo "✅ $*"; }
Expand All @@ -35,7 +36,7 @@ NS="kube-startup-cpu-boost-system"
log_info "Installing Kube Startup CPU Boost ${BOOST_VERSION} (cluster-wide controller + webhook)..."
# --server-side: the bundled CRD is large; client-side apply can exceed the
# last-applied annotation size limit.
if kubectl apply --server-side --force-conflicts -f "${MANIFEST}"; then
if retry_command 5 5 LOG "Startup CPU Boost manifest" "kubectl apply --server-side --force-conflicts -f '${MANIFEST}'"; then
kubectl -n "${NS}" rollout status deploy/kube-startup-cpu-boost-controller-manager --timeout=180s \
&& log_success "Kube Startup CPU Boost ${BOOST_VERSION} installed (controller Ready)" \
|| log_warning "Boost controller applied but not Ready yet (webhook may lag; the CR still admits later)"
Expand Down
17 changes: 15 additions & 2 deletions infra/scripts/deploy/java-on-amazon-eks/verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set -uo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/../../lib/common.sh"
source "${SCRIPT_DIR}/../../lib/retry.sh"
[ -f /etc/profile.d/workshop.sh ] && source /etc/profile.d/workshop.sh

APP_NS="unicorn-store-spring"
Expand Down Expand Up @@ -49,8 +50,8 @@ done

# 4. Platform: profiler policy, boost controller, sensor.
kubectl get mutatingpolicy inject-perf-profiler >/dev/null 2>&1 && log_success "Sidecar inject policy present" || fail "MutatingPolicy inject-perf-profiler missing"
kubectl -n kube-startup-cpu-boost-system get deploy kube-startup-cpu-boost-controller-manager >/dev/null 2>&1 \
&& log_success "Startup CPU Boost controller present" || log_warning "Startup CPU Boost controller missing (manual resize path still works)"
kubectl -n kube-startup-cpu-boost-system rollout status deploy/kube-startup-cpu-boost-controller-manager --timeout=180s >/dev/null 2>&1 \
&& log_success "Startup CPU Boost controller Ready" || fail "Startup CPU Boost controller not Ready"
kubectl -n monitoring rollout status deploy/perf-sensor --timeout=60s >/dev/null 2>&1 && log_success "perf-sensor Ready" || fail "perf-sensor not Ready"

# 5. Sensor answers with facts for the app, over the IDE's port-forward service (what
Expand Down Expand Up @@ -78,6 +79,18 @@ for s in java-on-eks-checklist java-on-eks-optimization; do
done
command -v claude >/dev/null 2>&1 || [ -x "${HOME}/.local/bin/claude" ] || fail "claude CLI not installed"

# 8. Claude Code answers through Amazon Bedrock. Runs in an empty directory, so no MCP
# servers start and `claude -c` in ~/environment does not resume this session.
CLAUDE_BIN="$(command -v claude || echo "${HOME}/.local/bin/claude")"
CLAUDE_DIR="$(mktemp -d)"
if retry_command 5 5 LOG "Claude Code on Bedrock" \
"(cd '${CLAUDE_DIR}' && timeout 120 '${CLAUDE_BIN}' -p 'Reply with the single word ok' | grep -qi ok)"; then
log_success "Claude Code answers through Bedrock"
else
fail "Claude Code got no answer from Bedrock (model access, region or IAM)"
fi
rm -rf "${CLAUDE_DIR}"

if [ "${FAIL}" -eq 0 ]; then
echo "✅ Success: java-on-amazon-eks environment verified (app ${URL})"
else
Expand Down
20 changes: 13 additions & 7 deletions infra/scripts/ide/shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,32 @@ log_info() {
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1"
}

source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../lib/retry.sh"

# clone <url> <dir>: shallow clone from GitHub, retried; each attempt starts from an empty dir
clone() {
retry_command 5 5 FAIL "git clone $1" "rm -rf '$2' && git clone --depth=1 -q '$1' '$2'"
}

log_info "Installing zsh and dependencies..."
sudo dnf install -y -q zsh util-linux-user >/dev/null

log_info "Setting zsh as default shell..."
sudo chsh -s /bin/zsh ec2-user

log_info "Installing oh-my-zsh..."
rm -rf ~/.oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
retry_command 5 5 FAIL "oh-my-zsh" \
"rm -rf ~/.oh-my-zsh && curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -o /tmp/ohmyzsh-install.sh && sh /tmp/ohmyzsh-install.sh --unattended"

log_info "Installing Powerlevel10k theme..."
git clone --depth=1 -q https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/custom/themes/powerlevel10k
clone https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/custom/themes/powerlevel10k

log_info "Installing zsh plugins..."
git clone --depth=1 -q https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone --depth=1 -q https://github.com/zsh-users/zsh-syntax-highlighting ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
clone https://github.com/zsh-users/zsh-syntax-highlighting ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting

log_info "Installing fzf..."
rm -rf ~/.fzf
git clone --depth=1 -q https://github.com/junegunn/fzf.git ~/.fzf
clone https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install --all --no-bash --no-fish >/dev/null

log_info "Creating .zshrc..."
Expand Down
22 changes: 15 additions & 7 deletions infra/scripts/ide/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ install_maven() {

install_aws_tools() {
log_info "Installing AWS SAM CLI for ${ARCH_SAM}..."
curl -sS -L "https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-${ARCH_SAM}.zip" -o "aws-sam-cli-linux-${ARCH_SAM}.zip"
retry_critical "AWS SAM CLI download" \
"curl -fsSL 'https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-${ARCH_SAM}.zip' -o 'aws-sam-cli-linux-${ARCH_SAM}.zip'"
unzip -q aws-sam-cli-linux-${ARCH_SAM}.zip -d sam-installation
install_with_version "AWS SAM CLI" "sudo ./sam-installation/install --update" "/usr/local/bin/sam --version | awk '{print \$4}'"
rm -rf ./sam-installation/ aws-sam-cli-linux-${ARCH_SAM}.zip
Expand All @@ -104,6 +105,13 @@ install_aws_tools() {
rm session-manager-plugin.rpm
}

# download_e1s: latest e1s release tarball to /tmp/e1s.tar.gz (GitHub API + release asset)
download_e1s() {
local version
version=$(curl -fsS https://api.github.com/repos/keidarcy/e1s/releases/latest | jq -r '.tag_name') || return 1
curl -sSLf "https://github.com/keidarcy/e1s/releases/download/${version}/e1s_${version#v}_linux_${ARCH_K8S}.tar.gz" -o /tmp/e1s.tar.gz
}

install_kubernetes_tools() {
log_info "Installing kubectl ${KUBECTL_VERSION} for ${ARCH_K8S}..."
download_and_verify "https://s3.us-west-2.amazonaws.com/amazon-eks/${KUBECTL_VERSION}/2025-11-13/bin/linux/${ARCH_K8S}/kubectl" "kubectl" "kubectl ${KUBECTL_VERSION}"
Expand All @@ -124,13 +132,13 @@ install_kubernetes_tools() {

log_info "Installing k9s..."
export PATH="$HOME/.local/bin:$PATH"
install_with_version "k9s" "curl -sS https://webinstall.dev/k9s | bash" "k9s version --short 2>/dev/null | grep Version | awk '{print \$2}'" "LOG" || true
retry_optional "k9s" "curl -fsS https://webinstall.dev/k9s -o /tmp/k9s-install.sh && bash /tmp/k9s-install.sh" || true

log_info "Installing e1s..."
E1S_VERSION=$(curl -s https://api.github.com/repos/keidarcy/e1s/releases/latest | jq -r '.tag_name')
curl -sSLf "https://github.com/keidarcy/e1s/releases/download/${E1S_VERSION}/e1s_${E1S_VERSION#v}_linux_${ARCH_K8S}.tar.gz" -o /tmp/e1s.tar.gz
tar -xzf /tmp/e1s.tar.gz -C /tmp
install_with_version "e1s" "cp /tmp/e1s $HOME/.local/bin/ && rm -f /tmp/e1s.tar.gz /tmp/e1s" "e1s --version 2>/dev/null | grep 'Current:' | awk '{print \$2}'" "LOG" || true
if retry_optional "e1s download" download_e1s; then
tar -xzf /tmp/e1s.tar.gz -C /tmp
install_with_version "e1s" "cp /tmp/e1s $HOME/.local/bin/ && rm -f /tmp/e1s.tar.gz /tmp/e1s" "e1s --version 2>/dev/null | grep 'Current:' | awk '{print \$2}'" "LOG" || true
fi
}

install_container_tools() {
Expand All @@ -157,7 +165,7 @@ install_utilities() {
rm yq_linux_${ARCH_YQ}.tar.gz

log_info "Installing direnv..."
install_with_version "direnv" "curl -sfL https://direnv.net/install.sh | bash" "direnv version"
retry_critical "direnv" "curl -fsSL https://direnv.net/install.sh -o /tmp/direnv-install.sh && bash /tmp/direnv-install.sh"
mkdir -p ~/.config/direnv
echo -e '[whitelist]\nprefix = [ "/home/ec2-user/environment" ]' > ~/.config/direnv/direnv.toml
}
Expand Down
12 changes: 6 additions & 6 deletions infra/scripts/setup/monitoring.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ trap cleanup EXIT

# Setup
kubectl create namespace "$NAMESPACE" 2>/dev/null || true
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts || true
helm repo add grafana-community https://grafana-community.github.io/helm-charts || true
helm repo add grafana https://grafana.github.io/helm-charts || true # pyroscope chart
retry_command 5 10 LOG "helm repo update" 'helm repo update >>"$LOG" 2>&1' \
|| { log_error "helm repo update failed — see $LOG"; tail -n 40 "$LOG"; exit 1; }
retry_command 5 5 LOG "helm repos" \
"helm repo add --force-update prometheus-community https://prometheus-community.github.io/helm-charts >>'$LOG' 2>&1 \
&& helm repo add --force-update grafana-community https://grafana-community.github.io/helm-charts >>'$LOG' 2>&1 \
&& helm repo add --force-update grafana https://grafana.github.io/helm-charts >>'$LOG' 2>&1" \
|| { log_error "helm repo add failed — see $LOG"; tail -n 40 "$LOG"; exit 1; }

# pull_chart <repo/chart> <version>: download the chart into $CHARTS, retried
pull_chart() {
retry_command 5 10 LOG "chart $1 $2" "helm pull $1 --version $2 --destination '$CHARTS' >>'$LOG' 2>&1" \
retry_command 5 5 LOG "chart $1 $2" "helm pull $1 --version $2 --destination '$CHARTS' >>'$LOG' 2>&1" \
|| { log_error "Download of chart $1 $2 failed — last 40 lines of $LOG:"; tail -n 40 "$LOG"; exit 1; }
}
CHARTS=$(mktemp -d)
Expand Down
Loading