docs: archive entra materials and simplify deployment docs
This commit is contained in:
+87
-51
@@ -22,24 +22,13 @@ readonly SCRIPTS_DIR="${PROJECT_ROOT}/scripts"
|
||||
readonly INFRA_DIR="${PROJECT_ROOT}/infra"
|
||||
readonly TERRAFORM_DIR="${INFRA_DIR}/terraform"
|
||||
readonly K8S_DIR="${INFRA_DIR}/k8s"
|
||||
readonly PROXMOX_WORKSPACE_ROOT="$(cd "${PROJECT_ROOT}/.." && pwd)"
|
||||
|
||||
# Azure configuration
|
||||
readonly AZURE_REGION="${AZURE_REGION:-westeurope}"
|
||||
readonly AZURE_SUBSCRIPTION_ID="${AZURE_SUBSCRIPTION_ID:-}"
|
||||
|
||||
# Region abbreviation mapping
|
||||
get_region_abbrev() {
|
||||
case "${AZURE_REGION}" in
|
||||
westeurope) echo "we" ;;
|
||||
northeurope) echo "ne" ;;
|
||||
uksouth) echo "uk" ;;
|
||||
switzerlandnorth) echo "ch" ;;
|
||||
norwayeast) echo "no" ;;
|
||||
francecentral) echo "fr" ;;
|
||||
germanywestcentral) echo "de" ;;
|
||||
*) echo "we" ;; # Default to westeurope
|
||||
esac
|
||||
}
|
||||
# Load shared Sankofa / Proxmox network inventory when available.
|
||||
if [ -f "${PROXMOX_WORKSPACE_ROOT}/config/ip-addresses.conf" ]; then
|
||||
# shellcheck source=/dev/null
|
||||
source "${PROXMOX_WORKSPACE_ROOT}/config/ip-addresses.conf"
|
||||
fi
|
||||
|
||||
# Environment abbreviation mapping
|
||||
get_env_abbrev() {
|
||||
@@ -52,36 +41,17 @@ get_env_abbrev() {
|
||||
esac
|
||||
}
|
||||
|
||||
# Naming convention: {provider}-{region}-{resource}-{env}-{purpose}
|
||||
readonly REGION_SHORT=$(get_region_abbrev)
|
||||
readonly ENV_SHORT=$(get_env_abbrev)
|
||||
readonly NAME_PREFIX="az-${REGION_SHORT}"
|
||||
readonly NAME_PREFIX="sankofa-${ENV_SHORT}"
|
||||
|
||||
# Environment configuration
|
||||
readonly ENVIRONMENT="${ENVIRONMENT:-dev}"
|
||||
readonly NAMESPACE="the-order-${ENVIRONMENT}"
|
||||
|
||||
# Resource Groups (az-we-rg-dev-main)
|
||||
readonly RESOURCE_GROUP_NAME="${RESOURCE_GROUP_NAME:-${NAME_PREFIX}-rg-${ENV_SHORT}-main}"
|
||||
readonly AKS_RESOURCE_GROUP="${AKS_RESOURCE_GROUP:-${RESOURCE_GROUP_NAME}}"
|
||||
|
||||
# Container registry (azweacrdev - alphanumeric only, max 50 chars)
|
||||
readonly ACR_NAME="${ACR_NAME:-az${REGION_SHORT}acr${ENV_SHORT}}"
|
||||
# Local image / artifact configuration
|
||||
readonly IMAGE_REGISTRY="${IMAGE_REGISTRY:-theorder}"
|
||||
readonly IMAGE_TAG="${IMAGE_TAG:-latest}"
|
||||
|
||||
# Kubernetes configuration (az-we-aks-dev-main)
|
||||
readonly AKS_NAME="${AKS_NAME:-${NAME_PREFIX}-aks-${ENV_SHORT}-main}"
|
||||
|
||||
# Key Vault (az-we-kv-dev-main - max 24 chars)
|
||||
readonly KEY_VAULT_NAME="${KEY_VAULT_NAME:-${NAME_PREFIX}-kv-${ENV_SHORT}-main}"
|
||||
|
||||
# Database (az-we-psql-dev-main)
|
||||
readonly POSTGRES_SERVER_NAME="${POSTGRES_SERVER_NAME:-${NAME_PREFIX}-psql-${ENV_SHORT}-main}"
|
||||
readonly POSTGRES_DB_NAME="${POSTGRES_DB_NAME:-${NAME_PREFIX}-db-${ENV_SHORT}-main}"
|
||||
|
||||
# Storage (azwesadevdata - alphanumeric only, max 24 chars)
|
||||
readonly STORAGE_ACCOUNT_NAME="${STORAGE_ACCOUNT_NAME:-az${REGION_SHORT}sa${ENV_SHORT}data}"
|
||||
|
||||
# Services
|
||||
readonly SERVICES=("identity" "intake" "finance" "dataroom")
|
||||
readonly APPS=("portal-public" "portal-internal")
|
||||
@@ -103,10 +73,61 @@ readonly LOG_FILE="${LOG_DIR}/deployment-$(date +%Y%m%d-%H%M%S).log"
|
||||
# Deployment state
|
||||
readonly STATE_DIR="${PROJECT_ROOT}/.deployment"
|
||||
readonly STATE_FILE="${STATE_DIR}/${ENVIRONMENT}.state"
|
||||
readonly ARTIFACTS_DIR="${STATE_DIR}/artifacts"
|
||||
|
||||
# Sankofa Phoenix / Proxmox deployment topology
|
||||
readonly PROXMOX_HOST="${PROXMOX_HOST:-${PROXMOX_HOST_R630_01:-192.168.11.11}}"
|
||||
readonly PROXMOX_SSH_USER="${PROXMOX_SSH_USER:-root}"
|
||||
readonly SSH_OPTS="${SSH_OPTS:--o BatchMode=yes -o ConnectTimeout=15 -o StrictHostKeyChecking=accept-new}"
|
||||
|
||||
resolve_host_for_vmid() {
|
||||
local vmid="$1"
|
||||
local host
|
||||
local candidates=(
|
||||
"${PROXMOX_HOST_R630_01:-192.168.11.11}"
|
||||
"${PROXMOX_HOST_R630_02:-192.168.11.12}"
|
||||
"${PROXMOX_HOST_R630_03:-192.168.11.13}"
|
||||
"${PROXMOX_HOST_R630_04:-192.168.11.14}"
|
||||
)
|
||||
|
||||
if command -v ssh >/dev/null 2>&1; then
|
||||
for host in "${candidates[@]}"; do
|
||||
if ssh -o BatchMode=yes -o ConnectTimeout=5 -o StrictHostKeyChecking=accept-new \
|
||||
"${PROXMOX_SSH_USER}@${host}" "pct status ${vmid}" >/dev/null 2>&1; then
|
||||
echo "${host}"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
case "${vmid}" in
|
||||
10090|10091|10092|10210) echo "${PROXMOX_HOST_R630_04:-192.168.11.14}" ;;
|
||||
*) echo "${PROXMOX_HOST}" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
readonly ORDER_PORTAL_PUBLIC_VMID="${ORDER_PORTAL_PUBLIC_VMID:-10090}"
|
||||
readonly ORDER_PORTAL_PUBLIC_HOST="${ORDER_PORTAL_PUBLIC_HOST:-$(resolve_host_for_vmid "${ORDER_PORTAL_PUBLIC_VMID}")}"
|
||||
readonly ORDER_PORTAL_PUBLIC_IP="${ORDER_PORTAL_PUBLIC_IP:-192.168.11.36}"
|
||||
readonly ORDER_PORTAL_PUBLIC_PORT="${ORDER_PORTAL_PUBLIC_PORT:-3000}"
|
||||
readonly ORDER_PORTAL_PUBLIC_APP_DIR="${ORDER_PORTAL_PUBLIC_APP_DIR:-/opt/the-order/portal-public}"
|
||||
readonly ORDER_PORTAL_PUBLIC_SERVICE="${ORDER_PORTAL_PUBLIC_SERVICE:-the-order-portal-public}"
|
||||
|
||||
readonly ORDER_HAPROXY_VMID="${ORDER_HAPROXY_VMID:-10210}"
|
||||
readonly ORDER_HAPROXY_HOST="${ORDER_HAPROXY_HOST:-$(resolve_host_for_vmid "${ORDER_HAPROXY_VMID}")}"
|
||||
readonly ORDER_HAPROXY_IP="${ORDER_HAPROXY_IP:-${IP_ORDER_HAPROXY:-192.168.11.39}}"
|
||||
readonly ORDER_HAPROXY_BACKEND_HOST="${ORDER_HAPROXY_BACKEND_HOST:-${ORDER_PORTAL_PUBLIC_IP}}"
|
||||
readonly ORDER_HAPROXY_BACKEND_PORT="${ORDER_HAPROXY_BACKEND_PORT:-${ORDER_PORTAL_PUBLIC_PORT}}"
|
||||
|
||||
readonly THE_ORDER_PUBLIC_URL="${THE_ORDER_PUBLIC_URL:-https://the-order.sankofa.nexus}"
|
||||
readonly THE_ORDER_WWW_URL="${THE_ORDER_WWW_URL:-https://www.the-order.sankofa.nexus}"
|
||||
readonly SANKOFA_PHOENIX_URL="${SANKOFA_PHOENIX_URL:-https://phoenix.sankofa.nexus}"
|
||||
readonly SANKOFA_PORTAL_URL="${SANKOFA_PORTAL_URL:-https://portal.sankofa.nexus}"
|
||||
|
||||
# Create necessary directories
|
||||
mkdir -p "${LOG_DIR}"
|
||||
mkdir -p "${STATE_DIR}"
|
||||
mkdir -p "${ARTIFACTS_DIR}"
|
||||
|
||||
# Logging functions
|
||||
log_info() {
|
||||
@@ -142,24 +163,40 @@ check_command() {
|
||||
fi
|
||||
}
|
||||
|
||||
check_azure_login() {
|
||||
if ! az account show &> /dev/null; then
|
||||
log_warning "Not logged into Azure. Attempting login..."
|
||||
az login || error_exit "Failed to login to Azure"
|
||||
fi
|
||||
}
|
||||
|
||||
check_prerequisites() {
|
||||
log_info "Checking prerequisites..."
|
||||
check_command "node"
|
||||
check_command "pnpm"
|
||||
check_command "az"
|
||||
check_command "terraform"
|
||||
check_command "kubectl"
|
||||
check_command "docker"
|
||||
check_command "git"
|
||||
check_command "jq"
|
||||
check_command "ssh"
|
||||
check_command "scp"
|
||||
check_command "tar"
|
||||
log_success "All prerequisites met"
|
||||
}
|
||||
|
||||
check_proxmox_access() {
|
||||
local hosts=("${PROXMOX_HOST}" "${ORDER_PORTAL_PUBLIC_HOST}" "${ORDER_HAPROXY_HOST}")
|
||||
local unique_hosts=()
|
||||
local host
|
||||
|
||||
for host in "${hosts[@]}"; do
|
||||
[[ -z "${host}" ]] && continue
|
||||
if [[ " ${unique_hosts[*]} " != *" ${host} "* ]]; then
|
||||
unique_hosts+=("${host}")
|
||||
fi
|
||||
done
|
||||
|
||||
for host in "${unique_hosts[@]}"; do
|
||||
log_info "Checking Proxmox access at ${PROXMOX_SSH_USER}@${host}..."
|
||||
ssh ${SSH_OPTS} "${PROXMOX_SSH_USER}@${host}" "echo ok" >/dev/null \
|
||||
|| error_exit "Failed to reach Proxmox host ${host} over SSH"
|
||||
done
|
||||
|
||||
log_success "Proxmox SSH access verified"
|
||||
}
|
||||
|
||||
# State management
|
||||
save_state() {
|
||||
local phase="$1"
|
||||
@@ -177,6 +214,5 @@ load_state() {
|
||||
|
||||
# Export functions
|
||||
export -f log_info log_success log_warning log_error log_step error_exit
|
||||
export -f check_command check_azure_login check_prerequisites
|
||||
export -f check_command check_prerequisites check_proxmox_access
|
||||
export -f save_state load_state
|
||||
|
||||
|
||||
Reference in New Issue
Block a user