Initial commit: add .gitignore and README
This commit is contained in:
57
migration/migrate-readme.sh
Executable file
57
migration/migrate-readme.sh
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Load shared libraries
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/../lib/init.sh"
|
||||
|
||||
# Script to update project READMEs using standardized template
|
||||
|
||||
set -e
|
||||
|
||||
TEMPLATE=".github/README_TEMPLATE.md"
|
||||
GUIDE="docs/README_UPDATE_GUIDE.md"
|
||||
|
||||
echo "📝 Updating project READMEs using standardized template..."
|
||||
|
||||
# Check if template exists
|
||||
if [ ! -f "$TEMPLATE" ]; then
|
||||
echo "❌ Template not found: $TEMPLATE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# List of projects to update (excluding monorepos and special directories)
|
||||
PROJECTS=(
|
||||
"dbis_core"
|
||||
"the_order"
|
||||
"smom-dbis-138"
|
||||
"Sankofa"
|
||||
"loc_az_hci"
|
||||
"Datacenter-Control-Complete"
|
||||
"miracles_in_motion"
|
||||
"metaverseDubai"
|
||||
"quorum-test-network"
|
||||
)
|
||||
|
||||
for project in "${PROJECTS[@]}"; do
|
||||
if [ -d "$project" ]; then
|
||||
readme_path="$project/README.md"
|
||||
|
||||
if [ -f "$readme_path" ]; then
|
||||
echo "📄 Found README: $readme_path"
|
||||
echo " → Review and update manually using template: $TEMPLATE"
|
||||
echo " → Follow guide: $GUIDE"
|
||||
else
|
||||
echo "⚠️ Missing README: $readme_path"
|
||||
echo " → Create using template: $TEMPLATE"
|
||||
fi
|
||||
else
|
||||
echo "⚠️ Project not found: $project"
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "✅ README update check complete!"
|
||||
echo " → Use template: $TEMPLATE"
|
||||
echo " → Follow guide: $GUIDE"
|
||||
echo " → Update projects manually for best results"
|
||||
|
||||
61
migration/migrate-terraform.sh
Executable file
61
migration/migrate-terraform.sh
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Load shared libraries
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/../lib/init.sh"
|
||||
|
||||
# Script to help migrate projects to shared Terraform modules
|
||||
|
||||
set -e
|
||||
|
||||
echo "🏗️ Terraform Module Migration Helper"
|
||||
echo ""
|
||||
|
||||
# Check if Terraform is installed
|
||||
if ! command -v terraform &> /dev/null; then
|
||||
echo "❌ Terraform not found. Please install Terraform first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if we're in a project directory with Terraform
|
||||
if [ ! -f "main.tf" ] && [ ! -d "terraform" ]; then
|
||||
echo "⚠️ No Terraform configuration found in current directory"
|
||||
echo " → Navigate to a project with Terraform files"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "📋 Migration Steps:"
|
||||
echo ""
|
||||
echo "1. Review current Terraform configuration"
|
||||
echo "2. Identify resources to migrate"
|
||||
echo "3. Update configuration to use shared modules"
|
||||
echo "4. Test migration with 'terraform plan'"
|
||||
echo "5. Apply changes with 'terraform apply'"
|
||||
echo ""
|
||||
echo "📚 Available modules:"
|
||||
echo " - infrastructure/terraform/modules/azure/networking"
|
||||
echo " - infrastructure/terraform/modules/azure/keyvault"
|
||||
echo " - infrastructure/terraform/modules/azure/storage"
|
||||
echo " - infrastructure/terraform/modules/kubernetes/namespace"
|
||||
echo ""
|
||||
echo "📖 See docs/TERRAFORM_MIGRATION_GUIDE.md for detailed instructions"
|
||||
echo ""
|
||||
|
||||
# Check for existing modules
|
||||
if [ -d "../../infrastructure/terraform/modules" ]; then
|
||||
echo "✅ Shared modules found"
|
||||
echo ""
|
||||
echo "Available modules:"
|
||||
find ../../infrastructure/terraform/modules -type d -mindepth 2 -maxdepth 2 | sed 's|../../infrastructure/terraform/modules/||' | sort
|
||||
else
|
||||
echo "⚠️ Shared modules not found"
|
||||
echo " → Check path to infrastructure/terraform/modules"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "💡 Tips:"
|
||||
echo " - Always test in dev/staging first"
|
||||
echo " - Review terraform plan carefully"
|
||||
echo " - Backup state before migration"
|
||||
echo " - Use version constraints for modules"
|
||||
|
||||
120
migration/migrate-to-api-gateway.sh
Executable file
120
migration/migrate-to-api-gateway.sh
Executable file
@@ -0,0 +1,120 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Load shared libraries
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/../lib/init.sh"
|
||||
|
||||
# Script to help migrate projects to unified API gateway
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_NAME="${1:-}"
|
||||
SERVICE_URL="${2:-}"
|
||||
|
||||
if [ -z "$PROJECT_NAME" ] || [ -z "$SERVICE_URL" ]; then
|
||||
echo "🚪 API Gateway Migration Helper"
|
||||
echo ""
|
||||
echo "Usage: $0 <project-name> <service-url>"
|
||||
echo ""
|
||||
echo "Example: $0 my-service http://my-service:8080"
|
||||
echo ""
|
||||
echo "This script helps migrate a project to use the unified API gateway."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "🚪 Migrating $PROJECT_NAME to unified API gateway..."
|
||||
|
||||
# Create Kong service configuration
|
||||
cat > "/tmp/${PROJECT_NAME}-kong-service.yaml" << EOF
|
||||
apiVersion: configuration.konghq.com/v1
|
||||
kind: KongService
|
||||
metadata:
|
||||
name: ${PROJECT_NAME}
|
||||
namespace: api-gateway
|
||||
spec:
|
||||
url: ${SERVICE_URL}
|
||||
protocol: http
|
||||
port: 80
|
||||
path: /
|
||||
connect_timeout: 60000
|
||||
write_timeout: 60000
|
||||
read_timeout: 60000
|
||||
EOF
|
||||
|
||||
# Create Kong route configuration
|
||||
cat > "/tmp/${PROJECT_NAME}-kong-route.yaml" << EOF
|
||||
apiVersion: configuration.konghq.com/v1
|
||||
kind: KongRoute
|
||||
metadata:
|
||||
name: ${PROJECT_NAME}-route
|
||||
namespace: api-gateway
|
||||
spec:
|
||||
service: ${PROJECT_NAME}
|
||||
paths:
|
||||
- /api/${PROJECT_NAME}
|
||||
methods:
|
||||
- GET
|
||||
- POST
|
||||
- PUT
|
||||
- DELETE
|
||||
strip_path: false
|
||||
preserve_host: true
|
||||
EOF
|
||||
|
||||
# Create Kong plugin for rate limiting
|
||||
cat > "/tmp/${PROJECT_NAME}-kong-plugin.yaml" << EOF
|
||||
apiVersion: configuration.konghq.com/v1
|
||||
kind: KongPlugin
|
||||
metadata:
|
||||
name: ${PROJECT_NAME}-rate-limit
|
||||
namespace: api-gateway
|
||||
plugin: rate-limiting
|
||||
config:
|
||||
minute: 100
|
||||
hour: 1000
|
||||
policy: local
|
||||
fault_tolerant: true
|
||||
hide_client_headers: false
|
||||
EOF
|
||||
|
||||
# Create Kong plugin for CORS
|
||||
cat > "/tmp/${PROJECT_NAME}-kong-cors.yaml" << EOF
|
||||
apiVersion: configuration.konghq.com/v1
|
||||
kind: KongPlugin
|
||||
metadata:
|
||||
name: ${PROJECT_NAME}-cors
|
||||
namespace: api-gateway
|
||||
plugin: cors
|
||||
config:
|
||||
origins:
|
||||
- "*"
|
||||
methods:
|
||||
- GET
|
||||
- POST
|
||||
- PUT
|
||||
- DELETE
|
||||
- OPTIONS
|
||||
headers:
|
||||
- Accept
|
||||
- Authorization
|
||||
- Content-Type
|
||||
exposed_headers:
|
||||
- X-Auth-Token
|
||||
credentials: true
|
||||
max_age: 3600
|
||||
EOF
|
||||
|
||||
echo "✅ Created Kong configuration templates:"
|
||||
echo " - /tmp/${PROJECT_NAME}-kong-service.yaml"
|
||||
echo " - /tmp/${PROJECT_NAME}-kong-route.yaml"
|
||||
echo " - /tmp/${PROJECT_NAME}-kong-plugin.yaml"
|
||||
echo " - /tmp/${PROJECT_NAME}-kong-cors.yaml"
|
||||
echo ""
|
||||
echo "📝 Next steps:"
|
||||
echo " 1. Review and customize configurations"
|
||||
echo " 2. Update service URL if needed"
|
||||
echo " 3. Apply Kong resources:"
|
||||
echo " kubectl apply -f /tmp/${PROJECT_NAME}-kong-*.yaml"
|
||||
echo ""
|
||||
echo "📖 See docs/API_GATEWAY_MIGRATION_GUIDE.md for detailed instructions"
|
||||
|
||||
145
migration/migrate-to-k8s.sh
Executable file
145
migration/migrate-to-k8s.sh
Executable file
@@ -0,0 +1,145 @@
|
||||
#!/bin/bash
|
||||
# Script to help migrate projects to shared Kubernetes cluster
|
||||
|
||||
set -e
|
||||
|
||||
# Load shared libraries
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/../lib/init.sh"
|
||||
|
||||
PROJECT_NAME="${1:-}"
|
||||
|
||||
if [ -z "$PROJECT_NAME" ]; then
|
||||
log_heading "☸️ Kubernetes Migration Helper"
|
||||
echo ""
|
||||
echo "Usage: $0 <project-name>"
|
||||
echo ""
|
||||
echo "This script helps migrate a project to the shared Kubernetes cluster."
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Validate input
|
||||
validate_project_name "$PROJECT_NAME"
|
||||
|
||||
NAMESPACE="${PROJECT_NAME}"
|
||||
|
||||
log_heading "☸️ Migrating $PROJECT_NAME to shared Kubernetes cluster..."
|
||||
|
||||
# Create namespace using Terraform module or kubectl
|
||||
echo "📦 Creating namespace: $NAMESPACE"
|
||||
|
||||
cat > "/tmp/${PROJECT_NAME}-namespace.yaml" << EOF
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: ${NAMESPACE}
|
||||
labels:
|
||||
app: ${PROJECT_NAME}
|
||||
managed: terraform
|
||||
spec: {}
|
||||
EOF
|
||||
|
||||
# Create basic deployment template
|
||||
cat > "/tmp/${PROJECT_NAME}-deployment.yaml" << EOF
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: ${PROJECT_NAME}
|
||||
namespace: ${NAMESPACE}
|
||||
spec:
|
||||
replicas: 2
|
||||
selector:
|
||||
matchLabels:
|
||||
app: ${PROJECT_NAME}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: ${PROJECT_NAME}
|
||||
spec:
|
||||
containers:
|
||||
- name: ${PROJECT_NAME}
|
||||
image: ${PROJECT_NAME}:latest
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
name: http
|
||||
resources:
|
||||
requests:
|
||||
memory: "256Mi"
|
||||
cpu: "100m"
|
||||
limits:
|
||||
memory: "512Mi"
|
||||
cpu: "500m"
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 8080
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /ready
|
||||
port: 8080
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
EOF
|
||||
|
||||
# Create service template
|
||||
cat > "/tmp/${PROJECT_NAME}-service.yaml" << EOF
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: ${PROJECT_NAME}
|
||||
namespace: ${NAMESPACE}
|
||||
spec:
|
||||
selector:
|
||||
app: ${PROJECT_NAME}
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 8080
|
||||
protocol: TCP
|
||||
name: http
|
||||
EOF
|
||||
|
||||
# Create ingress template
|
||||
cat > "/tmp/${PROJECT_NAME}-ingress.yaml" << EOF
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: ${PROJECT_NAME}
|
||||
namespace: ${NAMESPACE}
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: nginx
|
||||
cert-manager.io/cluster-issuer: letsencrypt-prod
|
||||
spec:
|
||||
tls:
|
||||
- hosts:
|
||||
- ${PROJECT_NAME}.example.com
|
||||
secretName: ${PROJECT_NAME}-tls
|
||||
rules:
|
||||
- host: ${PROJECT_NAME}.example.com
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: ${PROJECT_NAME}
|
||||
port:
|
||||
number: 80
|
||||
EOF
|
||||
|
||||
log_success "Created migration templates:"
|
||||
log_info " - /tmp/${PROJECT_NAME}-namespace.yaml"
|
||||
log_info " - /tmp/${PROJECT_NAME}-deployment.yaml"
|
||||
log_info " - /tmp/${PROJECT_NAME}-service.yaml"
|
||||
log_info " - /tmp/${PROJECT_NAME}-ingress.yaml"
|
||||
echo ""
|
||||
log_step "Next steps:"
|
||||
log_info " 1. Review and customize templates"
|
||||
log_info " 2. Update image name and configuration"
|
||||
log_info " 3. Apply resources:"
|
||||
log_info " kubectl apply -f /tmp/${PROJECT_NAME}-*.yaml"
|
||||
echo ""
|
||||
log_info "📖 See docs/K8S_MIGRATION_GUIDE.md for detailed instructions"
|
||||
|
||||
61
migration/migrate-to-monitoring.sh
Executable file
61
migration/migrate-to-monitoring.sh
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Load shared libraries
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/../lib/init.sh"
|
||||
|
||||
# Script to help migrate projects to shared monitoring stack
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_NAME="${1:-}"
|
||||
NAMESPACE="${2:-default}"
|
||||
|
||||
if [ -z "$PROJECT_NAME" ]; then
|
||||
echo "📊 Monitoring Migration Helper"
|
||||
echo ""
|
||||
echo "Usage: $0 <project-name> [namespace]"
|
||||
echo ""
|
||||
echo "This script helps migrate a project to use the shared monitoring stack."
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "📊 Migrating $PROJECT_NAME to shared monitoring stack..."
|
||||
|
||||
# Check if ServiceMonitor CRD exists
|
||||
if ! kubectl get crd servicemonitors.monitoring.coreos.com &>/dev/null; then
|
||||
echo "⚠️ ServiceMonitor CRD not found"
|
||||
echo " → Ensure Prometheus operator is installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create ServiceMonitor template
|
||||
cat > "/tmp/${PROJECT_NAME}-servicemonitor.yaml" << EOF
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: ${PROJECT_NAME}
|
||||
namespace: ${NAMESPACE}
|
||||
labels:
|
||||
app: ${PROJECT_NAME}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: ${PROJECT_NAME}
|
||||
endpoints:
|
||||
- port: metrics
|
||||
path: /metrics
|
||||
interval: 30s
|
||||
EOF
|
||||
|
||||
echo "✅ Created ServiceMonitor template: /tmp/${PROJECT_NAME}-servicemonitor.yaml"
|
||||
echo ""
|
||||
echo "📝 Next steps:"
|
||||
echo " 1. Ensure your service exposes metrics on /metrics endpoint"
|
||||
echo " 2. Add 'metrics' port to your service"
|
||||
echo " 3. Review and apply ServiceMonitor:"
|
||||
echo " kubectl apply -f /tmp/${PROJECT_NAME}-servicemonitor.yaml"
|
||||
echo ""
|
||||
echo "📖 See docs/K8S_MIGRATION_GUIDE.md for detailed instructions"
|
||||
|
||||
52
migration/migrate-to-shared-packages.sh
Executable file
52
migration/migrate-to-shared-packages.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Load shared libraries
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/../lib/init.sh"
|
||||
|
||||
# Script to help migrate projects to shared packages
|
||||
|
||||
set -e
|
||||
|
||||
echo "📦 Shared Packages Migration Helper"
|
||||
echo ""
|
||||
|
||||
# Check if pnpm is installed
|
||||
if ! command -v pnpm &> /dev/null; then
|
||||
echo "⚠️ pnpm not found. Install with: npm install -g pnpm"
|
||||
fi
|
||||
|
||||
# Check if we're in a project directory
|
||||
if [ ! -f "package.json" ]; then
|
||||
echo "⚠️ No package.json found in current directory"
|
||||
echo " → Navigate to a project directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "📋 Available shared packages:"
|
||||
echo " 1. @workspace/shared-types"
|
||||
echo " 2. @workspace/shared-auth"
|
||||
echo " 3. @workspace/shared-utils"
|
||||
echo " 4. @workspace/shared-config"
|
||||
echo " 5. @workspace/api-client"
|
||||
echo " 6. @workspace/validation"
|
||||
echo " 7. @workspace/blockchain"
|
||||
echo ""
|
||||
|
||||
# Check for workspace-shared
|
||||
if [ -d "../../workspace-shared" ]; then
|
||||
echo "✅ Shared packages found"
|
||||
else
|
||||
echo "⚠️ Shared packages not found"
|
||||
echo " → Check path to workspace-shared/"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "💡 Migration steps:"
|
||||
echo " 1. Install package: pnpm add @workspace/shared-types@workspace:*"
|
||||
echo " 2. Update imports in your code"
|
||||
echo " 3. Remove duplicate code"
|
||||
echo " 4. Test thoroughly"
|
||||
echo ""
|
||||
echo "📖 See docs/SHARED_PACKAGES_MIGRATION_GUIDE.md for detailed instructions"
|
||||
|
||||
Reference in New Issue
Block a user