Fixed mobile form
This commit is contained in:
196
Makefile
196
Makefile
@@ -75,16 +75,6 @@ clean:
|
||||
@docker compose down -v --rmi all
|
||||
@docker system prune -f
|
||||
|
||||
test:
|
||||
@echo "Running backend tests in container..."
|
||||
@docker compose exec admin-backend npm test
|
||||
@echo "\nRunning frontend tests in container..."
|
||||
@docker run --rm -v $(PWD)/frontend:/app -w /app node:20-alpine sh -lc 'npm install && npm test'
|
||||
|
||||
test-frontend:
|
||||
@echo "Running frontend tests in container..."
|
||||
@docker run --rm -v $(PWD)/frontend:/app -w /app node:20-alpine sh -lc 'npm install && npm test'
|
||||
|
||||
logs:
|
||||
@docker compose logs -f
|
||||
|
||||
@@ -168,57 +158,6 @@ health-check-all:
|
||||
@echo " Discovered Services: $$(curl -s http://localhost:8080/api/http/services 2>/dev/null | jq '. | length' || echo '0')"
|
||||
@echo " Active Routes: $$(curl -s http://localhost:8080/api/http/routers 2>/dev/null | jq '. | length' || echo '0')"
|
||||
|
||||
# Enhanced monitoring commands for Phase 2
|
||||
metrics:
|
||||
@echo "📊 Prometheus Metrics Collection:"
|
||||
@echo ""
|
||||
@echo "Traefik Metrics:"
|
||||
@curl -s http://localhost:8080/metrics | grep "traefik_" | head -5 || echo "Metrics not available"
|
||||
@echo ""
|
||||
@echo "Service Response Times (last 5min):"
|
||||
@curl -s http://localhost:8080/metrics | grep "traefik_service_request_duration" | head -3 || echo "No duration metrics yet"
|
||||
|
||||
service-auth-test:
|
||||
@echo "🔐 Service-to-Service Authentication Test:"
|
||||
@echo ""
|
||||
@echo "Testing platform API authentication..."
|
||||
@echo " Vehicles API: $$(curl -k -s -o /dev/null -w '%{http_code}' -H 'X-API-Key: mvp-platform-vehicles-secret-key' https://admin.motovaultpro.com/api/platform/vehicles/health 2>/dev/null || echo 'FAIL')"
|
||||
@echo " Tenants API: $$(curl -k -s -o /dev/null -w '%{http_code}' -H 'X-API-Key: mvp-platform-tenants-secret-key' https://admin.motovaultpro.com/api/platform/tenants/health 2>/dev/null || echo 'FAIL')"
|
||||
|
||||
middleware-test:
|
||||
@echo "🛡️ Middleware Security Test:"
|
||||
@echo ""
|
||||
@echo "Testing security headers..."
|
||||
@curl -k -s -I https://admin.motovaultpro.com/ | grep -E "(X-Frame-Options|X-Content-Type-Options|Strict-Transport-Security)" || echo "Security headers not applied"
|
||||
@echo ""
|
||||
@echo "Testing rate limiting..."
|
||||
@for i in $$(seq 1 3); do curl -k -s -o /dev/null -w "Request $$i: %{http_code}\n" https://admin.motovaultpro.com/; done
|
||||
|
||||
network-security-test:
|
||||
@echo "🔒 Network Security Isolation Test:"
|
||||
@echo ""
|
||||
@echo "Testing network isolation:"
|
||||
@docker network inspect motovaultpro_backend motovaultpro_database motovaultpro_platform | jq '.[].Options."com.docker.network.bridge.enable_icc"' | head -3 | sed 's/^/ Network ICC: /'
|
||||
@echo ""
|
||||
@echo "Internal network test:"
|
||||
@echo " Backend → Platform: $$(docker compose exec admin-backend nc -zv mvp-platform-vehicles-api 8000 2>&1 | grep -q 'open' && echo 'CONNECTED' || echo 'ISOLATED')"
|
||||
|
||||
# Mobile Testing Support
|
||||
mobile-setup:
|
||||
@echo "📱 Mobile Testing Setup (K8s-Ready Architecture):"
|
||||
@echo ""
|
||||
@echo "1. Connect mobile device to same network as development machine"
|
||||
@echo "2. Development machine IP: $$(hostname -I | awk '{print $$1}' 2>/dev/null || echo 'unknown')"
|
||||
@echo "3. Add to mobile device DNS/hosts (if rooted):"
|
||||
@echo " $$(hostname -I | awk '{print $$1}' 2>/dev/null) motovaultpro.com"
|
||||
@echo " $$(hostname -I | awk '{print $$1}' 2>/dev/null) admin.motovaultpro.com"
|
||||
@echo "4. Install and trust certificate from: https://$$(hostname -I | awk '{print $$1}' 2>/dev/null)/certs/motovaultpro.com.crt"
|
||||
@echo "5. Access applications:"
|
||||
@echo " 🌐 Landing: https://motovaultpro.com"
|
||||
@echo " 📱 Admin App: https://admin.motovaultpro.com"
|
||||
@echo ""
|
||||
@echo "Certificate Generation (if needed): make generate-certs"
|
||||
|
||||
# SSL Certificate Generation
|
||||
generate-certs:
|
||||
@echo "Generating multi-domain SSL certificate for mobile compatibility..."
|
||||
@@ -230,67 +169,6 @@ generate-certs:
|
||||
-extensions SAN
|
||||
@echo "✅ Certificate generated with SAN for mobile compatibility (includes $(shell hostname -I | awk '{print $$1}'))"
|
||||
|
||||
# Configuration Management Commands (Phase 3)
|
||||
config-validate:
|
||||
@echo "🔍 K8s-Equivalent Configuration Validation:"
|
||||
@./scripts/config-validator.sh
|
||||
|
||||
config-setup:
|
||||
@echo "📝 Setting up K8s-equivalent configuration and secrets:"
|
||||
@./scripts/config-validator.sh --generate-templates
|
||||
@echo ""
|
||||
@echo "Next steps:"
|
||||
@echo " 1. Update secret values: edit files in secrets/app/ and secrets/platform/"
|
||||
@echo " 2. Validate configuration: make config-validate"
|
||||
@echo " 3. Deploy with new config: make deploy-with-config"
|
||||
|
||||
config-status:
|
||||
@echo "📊 Configuration Management Status:"
|
||||
@echo ""
|
||||
@echo "ConfigMaps (K8s equivalent):"
|
||||
@find config -name "*.yml" -exec echo " ✅ {}" \; 2>/dev/null || echo " ❌ No config files found"
|
||||
@echo ""
|
||||
@echo "Secrets (K8s equivalent):"
|
||||
@find secrets -name "*.txt" | grep -v example | wc -l | sed 's/^/ 📁 Secret files: /'
|
||||
@echo ""
|
||||
@echo "Docker Compose mounts:"
|
||||
@grep -c "config.*yml\|/run/secrets" docker-compose.yml | sed 's/^/ 🔗 Configuration mounts: /' || echo " ❌ No configuration mounts found"
|
||||
|
||||
deploy-with-config:
|
||||
@echo "🚀 Deploying with K8s-equivalent configuration management:"
|
||||
@echo "1. Validating configuration..."
|
||||
@./scripts/config-validator.sh
|
||||
@echo ""
|
||||
@echo "2. Stopping existing services..."
|
||||
@docker compose down
|
||||
@echo ""
|
||||
@echo "3. Starting services with file-based configuration..."
|
||||
@docker compose up -d --build
|
||||
@echo ""
|
||||
@echo "4. Verifying configuration loading..."
|
||||
@sleep 10
|
||||
@make health-check-all
|
||||
|
||||
config-reload:
|
||||
@echo "🔄 Hot-reloading configuration (K8s ConfigMap equivalent):"
|
||||
@echo "Restarting services that support configuration hot-reload..."
|
||||
@docker compose restart traefik
|
||||
@echo "✅ Configuration reloaded for supported services"
|
||||
@echo "⚠️ Note: Some services may require full restart for config changes"
|
||||
|
||||
config-backup:
|
||||
@echo "💾 Backing up current configuration:"
|
||||
@mkdir -p backups/config-$$(date +%Y%m%d-%H%M%S)
|
||||
@cp -r config secrets backups/config-$$(date +%Y%m%d-%H%M%S)/
|
||||
@echo "✅ Configuration backed up to backups/config-$$(date +%Y%m%d-%H%M%S)/"
|
||||
|
||||
config-diff:
|
||||
@echo "🔍 Configuration diff from defaults:"
|
||||
@echo "App configuration changes:"
|
||||
@diff -u config/app/production.yml.example config/app/production.yml || echo " (No example file to compare)"
|
||||
@echo ""
|
||||
@echo "Secret files status:"
|
||||
@ls -la secrets/app/*.txt | grep -v example || echo " No secrets found"
|
||||
|
||||
# Enhanced log commands with filtering
|
||||
logs-traefik:
|
||||
@@ -302,75 +180,5 @@ logs-platform:
|
||||
logs-backend-full:
|
||||
@docker compose logs -f admin-backend admin-postgres admin-redis admin-minio
|
||||
|
||||
# Phase 4: Optimization & Monitoring Commands
|
||||
resource-optimization:
|
||||
@echo "🔧 Resource Optimization Analysis:"
|
||||
@echo ""
|
||||
@echo "Current Resource Usage:"
|
||||
@docker stats --no-stream --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}" | head -15
|
||||
@echo ""
|
||||
@echo "Resource Recommendations:"
|
||||
@echo " 🔍 Checking for over-allocated services..."
|
||||
@docker stats --no-stream | awk 'NR>1 {if ($$3 ~ /%/ && $$3+0 < 50) print " ⬇️ "$1" can reduce CPU allocation (using "$3")"}' | head -5
|
||||
@docker stats --no-stream | awk 'NR>1 {if ($$7 ~ /%/ && $$7+0 < 50) print " ⬇️ "$1" can reduce memory allocation (using "$7")"}' | head -5
|
||||
|
||||
performance-baseline:
|
||||
@echo "📊 Performance Baseline Measurement:"
|
||||
@echo ""
|
||||
@echo "Service Response Times:"
|
||||
@curl -k -s -o /dev/null -w "Admin Frontend: %{time_total}s\n" https://admin.motovaultpro.com/
|
||||
@curl -k -s -o /dev/null -w "Platform Landing: %{time_total}s\n" https://motovaultpro.com/
|
||||
@curl -k -s -H "X-API-Key: mvp-platform-vehicles-secret-key" -o /dev/null -w "Vehicles API: %{time_total}s\n" https://admin.motovaultpro.com/api/platform/vehicles/health
|
||||
@curl -k -s -H "X-API-Key: mvp-platform-tenants-secret-key" -o /dev/null -w "Tenants API: %{time_total}s\n" https://admin.motovaultpro.com/api/platform/tenants/health
|
||||
@echo ""
|
||||
@echo "Database Connections:"
|
||||
@docker compose exec admin-postgres psql -U postgres -d motovaultpro -c "SELECT count(*) as active_connections FROM pg_stat_activity WHERE state = 'active';" -t 2>/dev/null || echo " Admin DB: Connection check failed"
|
||||
@docker compose exec platform-postgres psql -U platform_user -d platform -c "SELECT count(*) as active_connections FROM pg_stat_activity WHERE state = 'active';" -t 2>/dev/null || echo " Platform DB: Connection check failed"
|
||||
|
||||
monitoring-setup:
|
||||
@echo "📈 Setting up enhanced monitoring configuration..."
|
||||
@echo "Creating monitoring directory structure..."
|
||||
@mkdir -p config/monitoring/alerts logs/monitoring
|
||||
@echo "✅ Monitoring configuration created"
|
||||
@echo ""
|
||||
@echo "To enable full monitoring:"
|
||||
@echo " 1. Review config/monitoring/prometheus.yml"
|
||||
@echo " 2. Deploy with: make deploy-with-monitoring"
|
||||
@echo " 3. Access metrics: make metrics-dashboard"
|
||||
|
||||
deploy-with-monitoring:
|
||||
@echo "🚀 Deploying with enhanced monitoring..."
|
||||
@echo "1. Validating configuration..."
|
||||
@./scripts/config-validator.sh
|
||||
@echo ""
|
||||
@echo "2. Restarting services with monitoring configuration..."
|
||||
@docker compose up -d --build --remove-orphans
|
||||
@echo ""
|
||||
@echo "3. Verifying monitoring setup..."
|
||||
@sleep 10
|
||||
@make health-check-all
|
||||
@echo ""
|
||||
@echo "✅ Monitoring deployment complete!"
|
||||
|
||||
metrics-dashboard:
|
||||
@echo "📊 Metrics Dashboard Access:"
|
||||
@echo ""
|
||||
@echo "Available metrics endpoints:"
|
||||
@echo " 🔧 Traefik metrics: http://localhost:8080/metrics"
|
||||
@echo " 📈 Service discovery: http://localhost:8080/api"
|
||||
@echo ""
|
||||
@echo "Sample Traefik metrics:"
|
||||
@curl -s http://localhost:8080/metrics | grep "traefik_" | head -5 || echo " Metrics not available yet"
|
||||
|
||||
capacity-planning:
|
||||
@echo "🎯 Capacity Planning Analysis:"
|
||||
@echo ""
|
||||
@echo "Current Deployment Footprint:"
|
||||
@echo " Services: $$(docker compose ps --format '{{.Service}}' | wc -l) containers"
|
||||
@echo " Networks: $$(docker network ls --filter name=motovaultpro | wc -l) isolated networks"
|
||||
@echo " Memory Allocation: $$(docker stats --no-stream --format '{{.MemUsage}}' | sed 's/MiB.*//' | awk '{sum+=$$1} END {print sum "MiB total"}' 2>/dev/null || echo 'calculating...')"
|
||||
@echo ""
|
||||
@echo "Resource Efficiency:"
|
||||
@docker stats --no-stream --format "{{.Container}}" | wc -l | awk '{print " Running containers: " $$1}'
|
||||
@echo " Docker Storage:"
|
||||
@docker system df | grep -v REPOSITORY
|
||||
logs-clear:
|
||||
@sudo sh -c "truncate -s 0 /var/lib/docker/containers/**/*-json.log"
|
||||
Reference in New Issue
Block a user