#!/usr/bin/env bash # Thin launch vehicle for the Prole installer. # # Local execution (from a repo checkout): # ./install.sh [args...] # # Bootstrap via curl (first-time install): # curl -fsSL https://knoey.com/install.sh | bash # # --------------------------------------------------------------------------- # Dual-cluster GKE architecture (prod / k8s mode) # --------------------------------------------------------------------------- # knoe-dev-0 — Autopilot cluster: app workloads (GitLab, platform), service mesh knoe-0 # knoe-cnpg-0 — Standard GKE cluster: CloudNative-PG only (rw/ro/r pod separation) # 3 nodes × e2-standard-2, node pool: cnpg-db-pool # # GCP quota requirements (project: plenary-truck-485623-p7, region: us-west3): # pd-standard : node boot disks (3 × 50 GB = 150 GB — does NOT count against pd-ssd quota) # pd-ssd : PGDATA PVCs (3 × 50 Gi = 150 Gi) # WAL PVCs (3 × 50 Gi = 150 Gi) # Total pd-ssd = 300 Gi (requires 300 GB pd-ssd regional quota) # # To patch an existing knoe-cnpg-0 cluster with wrong boot disk type: # ./scripts/patch_clusters.sh # dry-run first: DRY_RUN=true ./scripts/patch_clusters.sh # --------------------------------------------------------------------------- set -euo pipefail # Repo URL used only during bootstrap (curl-pipe) installs. PROLE_REPO_URL="${PROLE_REPO_URL:-https://gitlab.knoey.com/prole/prole.git}" # Default install directory for bootstrap installs. _INSTALL_DIR="${PROLE_HOME:-$HOME/prole}" _check_gcp_tools() { local missing=0 if ! command -v gcloud >/dev/null 2>&1; then echo "Error: gcloud CLI is required for GKE cluster management." >&2 echo " Install: https://cloud.google.com/sdk/docs/install" >&2 missing=1 fi if ! command -v kubectl >/dev/null 2>&1; then echo "Error: kubectl is required for Kubernetes cluster operations." >&2 echo " Install: https://kubernetes.io/docs/tasks/tools/" >&2 missing=1 fi if [[ "$missing" -ne 0 ]]; then echo "" >&2 echo "Install missing tools and re-run install.sh." >&2 exit 1 fi } _bootstrap() { echo "==> Bootstrapping Prole installer..." command -v git >/dev/null 2>&1 || { echo "Error: git is required." >&2; exit 1; } command -v python3 >/dev/null 2>&1 || { echo "Error: python3 is required." >&2; exit 1; } if [[ -d "${_INSTALL_DIR}/.git" ]]; then echo "==> Updating existing checkout at ${_INSTALL_DIR} ..." git -C "${_INSTALL_DIR}" pull --ff-only else echo "==> Cloning to ${_INSTALL_DIR} ..." git clone "${PROLE_REPO_URL}" "${_INSTALL_DIR}" fi exec "${_INSTALL_DIR}/install.sh" "$@" } # Resolve script directory; empty when running via curl pipe. _src="${BASH_SOURCE[0]:-}" _script_dir="$(cd "$(dirname "${_src:-/}")" 2>/dev/null && pwd || echo "")" if [[ -n "${_script_dir}" && -d "${_script_dir}/knoe" ]]; then # Local checkout: delegate to the Python installer module. cd "${_script_dir}" # Prefer the venv Python at PROLE_HOME (or the repo root) when available; # it carries all prole_requirements.txt dependencies. _VENV_PYTHON="${PROLE_HOME:-${_script_dir}}/bin/python3" _check_gcp_tools if [[ -x "${_VENV_PYTHON}" ]]; then exec "${_VENV_PYTHON}" -m knoe.ui.screens "$@" fi exec python3 -m knoe.ui.screens "$@" else # No local checkout found — bootstrap from the remote repo. _bootstrap "$@" fi