docs: archive entra materials and simplify deployment docs
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Phase 4: Database & Storage Setup
|
||||
# Configure PostgreSQL, Storage Accounts, Redis, OpenSearch
|
||||
# Validate PostgreSQL, storage, Redis, and search configuration inputs for the Sankofa runtime.
|
||||
#
|
||||
|
||||
set -euo pipefail
|
||||
@@ -13,77 +13,37 @@ log_info "=========================================="
|
||||
log_info "Phase 4: Database & Storage Setup"
|
||||
log_info "=========================================="
|
||||
|
||||
# 4.1 PostgreSQL Database Setup
|
||||
log_step "4.1 Configuring PostgreSQL database..."
|
||||
|
||||
# Check if database exists
|
||||
DB_EXISTS=$(az postgres db show \
|
||||
--resource-group "${AKS_RESOURCE_GROUP}" \
|
||||
--server-name "${POSTGRES_SERVER_NAME}" \
|
||||
--name "${POSTGRES_DB_NAME}" \
|
||||
--query name -o tsv 2>/dev/null || echo "")
|
||||
|
||||
if [ -z "${DB_EXISTS}" ]; then
|
||||
log_info "Creating database ${POSTGRES_DB_NAME}..."
|
||||
az postgres db create \
|
||||
--resource-group "${AKS_RESOURCE_GROUP}" \
|
||||
--server-name "${POSTGRES_SERVER_NAME}" \
|
||||
--name "${POSTGRES_DB_NAME}" \
|
||||
|| error_exit "Failed to create database"
|
||||
log_success "Database created"
|
||||
log_step "4.1 Checking database configuration inputs..."
|
||||
if [ -n "${DATABASE_URL:-}" ]; then
|
||||
log_success "DATABASE_URL is set"
|
||||
else
|
||||
log_success "Database already exists"
|
||||
log_warning "DATABASE_URL is not set. Phase 7 will require it."
|
||||
fi
|
||||
|
||||
# Configure firewall rules for AKS
|
||||
log_step "4.2 Configuring database firewall rules..."
|
||||
|
||||
# Get AKS outbound IPs (if using NAT gateway)
|
||||
# For now, allow Azure services
|
||||
az postgres server firewall-rule create \
|
||||
--resource-group "${AKS_RESOURCE_GROUP}" \
|
||||
--server-name "${POSTGRES_SERVER_NAME}" \
|
||||
--name "AllowAzureServices" \
|
||||
--start-ip-address "0.0.0.0" \
|
||||
--end-ip-address "0.0.0.0" \
|
||||
--output none 2>/dev/null || log_info "Firewall rule may already exist"
|
||||
|
||||
log_success "Database firewall configured"
|
||||
|
||||
# 4.2 Storage Account Setup
|
||||
log_step "4.3 Configuring storage accounts..."
|
||||
|
||||
# Verify storage account exists
|
||||
STORAGE_EXISTS=$(az storage account show \
|
||||
--name "${STORAGE_ACCOUNT_NAME}" \
|
||||
--resource-group "${AKS_RESOURCE_GROUP}" \
|
||||
--query name -o tsv 2>/dev/null || echo "")
|
||||
|
||||
if [ -z "${STORAGE_EXISTS}" ]; then
|
||||
log_warning "Storage account ${STORAGE_ACCOUNT_NAME} not found"
|
||||
log_info "Storage account should be created by Terraform"
|
||||
else
|
||||
log_success "Storage account found"
|
||||
|
||||
# Create containers
|
||||
CONTAINERS=("intake-documents" "dataroom-deals" "credentials")
|
||||
|
||||
for container in "${CONTAINERS[@]}"; do
|
||||
log_info "Creating container: ${container}..."
|
||||
az storage container create \
|
||||
--name "${container}" \
|
||||
--account-name "${STORAGE_ACCOUNT_NAME}" \
|
||||
--auth-mode login \
|
||||
--output none 2>/dev/null && \
|
||||
log_success "Container ${container} created" || \
|
||||
log_info "Container ${container} may already exist"
|
||||
done
|
||||
if [ -n "${ORDER_POSTGRES_PRIMARY:-}" ]; then
|
||||
log_info "Order PostgreSQL primary: ${ORDER_POSTGRES_PRIMARY}"
|
||||
fi
|
||||
|
||||
log_step "4.2 Checking storage configuration inputs..."
|
||||
if [ -n "${ORDER_STORAGE_ROOT:-}" ]; then
|
||||
log_success "ORDER_STORAGE_ROOT is set to ${ORDER_STORAGE_ROOT}"
|
||||
else
|
||||
log_warning "ORDER_STORAGE_ROOT is not set. Configure it if document storage is required."
|
||||
fi
|
||||
|
||||
log_step "4.3 Checking Redis / search configuration inputs..."
|
||||
if [ -n "${ORDER_REDIS_IP:-}" ]; then
|
||||
log_info "Order Redis host: ${ORDER_REDIS_IP}"
|
||||
fi
|
||||
if [ -n "${IP_ORDER_OPENSEARCH:-}" ]; then
|
||||
log_info "Order OpenSearch host: ${IP_ORDER_OPENSEARCH}"
|
||||
fi
|
||||
|
||||
log_info "Database and storage validation complete. Create or update the underlying services through the Proxmox runtime as needed."
|
||||
|
||||
# Save state
|
||||
save_state "phase4" "complete"
|
||||
|
||||
log_success "=========================================="
|
||||
log_success "Phase 4: Database & Storage - COMPLETE"
|
||||
log_success "=========================================="
|
||||
|
||||
|
||||
Reference in New Issue
Block a user