Some checks failed
CI/CD Pipeline / Code Quality & Linting (push) Has been cancelled
CI/CD Pipeline / Policy Validation (push) Has been cancelled
CI/CD Pipeline / Test Suite (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-coverage) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-extract) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-firm-connectors) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-forms) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-hmrc) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-ingestion) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-kg) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-normalize-map) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-ocr) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-rag-indexer) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-rag-retriever) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-reason) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-rpa) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (ui-review) (push) Has been cancelled
CI/CD Pipeline / Security Scanning (svc-coverage) (push) Has been cancelled
CI/CD Pipeline / Security Scanning (svc-extract) (push) Has been cancelled
CI/CD Pipeline / Security Scanning (svc-kg) (push) Has been cancelled
CI/CD Pipeline / Security Scanning (svc-rag-retriever) (push) Has been cancelled
CI/CD Pipeline / Security Scanning (ui-review) (push) Has been cancelled
CI/CD Pipeline / Generate SBOM (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Notifications (push) Has been cancelled
6.0 KiB
6.0 KiB
AI Tax Agent - Automation Guide
This document describes the comprehensive automation system for deploying and managing the AI Tax Agent infrastructure.
🚀 Quick Start
# Complete automated deployment
make run
# Access services
# - Traefik Dashboard: http://localhost:8080
# - Authentik SSO: https://auth.local
# - Grafana: https://grafana.local
📋 Automation Scripts
Core Deployment Scripts
| Script | Purpose | Usage |
|---|---|---|
scripts/deploy-with-fixes.sh |
Complete deployment with all fixes | make run |
scripts/fix-database-issues.sh |
Fix database connectivity issues | make fix-databases |
scripts/troubleshoot.sh |
Comprehensive troubleshooting | make troubleshoot |
scripts/create-networks.sh |
Create Docker networks | make networks |
scripts/generate-dev-certs.sh |
Generate TLS certificates | Auto-called |
scripts/verify-infra.sh |
Verify all endpoints | make verify |
Makefile Targets
Primary Commands
make run- Complete automated deployment with fixesmake bootstrap- Initialize development environmentmake troubleshoot- Run comprehensive diagnostics and fixesmake verify- Verify all service endpoints
Infrastructure Management
make deploy-infra- Deploy infrastructure services onlymake deploy-services- Deploy application services onlymake fix-databases- Fix database connectivity issuesmake restart-authentik- Restart Authentik components properlymake restart-unleash- Restart Unleash with database fixes
Monitoring & Debugging
make status- Show container statusmake health- Check service healthmake logs- View all service logsmake logs-service SERVICE=name- View specific service logs
🔧 Automated Fixes
The automation system handles these common issues:
Database Issues
- Authentik Password Reset: Automatically resets authentik user password
- Database Creation: Creates missing databases (unleash, authentik)
- Connection Verification: Ensures databases are ready before service startup
Service Ordering
- Dependency Management: Starts services in correct order
- Health Monitoring: Waits for services to be healthy
- Retry Logic: Automatically retries failed operations
Network & Security
- Docker Networks: Creates required frontend/backend networks
- TLS Certificates: Generates self-signed certificates for HTTPS
- Host Configuration: Sets up local domain resolution
Authentik SSO
- Component Ordering: Starts Authentik services in correct sequence
- Database Connectivity: Ensures proper database connection
- Health Verification: Monitors Authentik health status
🐛 Troubleshooting Automation
Automatic Diagnostics
The make troubleshoot command performs:
- Network Verification: Checks Docker networks exist
- Container Status: Verifies all containers are running
- Health Checks: Monitors container health status
- Endpoint Testing: Tests all service endpoints
- Common Issues: Checks for typical configuration problems
Automatic Fixes
When issues are detected, the system automatically:
- Recreates Networks: If Docker networks are missing
- Restarts Services: If containers are unhealthy
- Fixes Databases: If database connectivity fails
- Regenerates Certificates: If TLS certificates are missing
📊 Monitoring Integration
Health Checks
- Container health monitoring
- Endpoint availability testing
- Database connectivity verification
- Service dependency validation
Logging
- Centralized log collection
- Service-specific log filtering
- Error pattern detection
- Performance monitoring
🔄 Deployment Workflow
Standard Deployment (make run)
- Network Setup: Create Docker networks
- Certificate Generation: Generate TLS certificates
- Core Infrastructure: Start Traefik, PostgreSQL, Redis
- Database Fixes: Apply database connectivity fixes
- Authentik Deployment: Start Authentik components in order
- Infrastructure Services: Start remaining infrastructure
- Health Verification: Wait for Authentik to be healthy
- Application Services: Start all microservices
- Final Verification: Run endpoint tests
Infrastructure Only (make deploy-infra)
- Network Setup: Create Docker networks
- Certificate Generation: Generate TLS certificates
- Database Services: Start PostgreSQL, Redis, Authentik DB
- Database Fixes: Apply connectivity fixes
- Infrastructure: Start all infrastructure services
- Health Monitoring: Wait for services to be ready
🛠️ Customization
Environment Variables
Key variables in infra/compose/.env:
# Database Configuration
POSTGRES_PASSWORD=postgres
AUTHENTIK_DB_PASSWORD=authentik
# Authentik Configuration
AUTHENTIK_SECRET_KEY=changeme
# Unleash Configuration
UNLEASH_ADMIN_TOKEN=*:*.unleash-insecure-admin-api-token
# Domain Configuration
DOMAIN=local
Service Configuration
Modify infra/compose/docker-compose.local.yml for:
- Service dependencies
- Health check configurations
- Network assignments
- Volume mounts
🔍 Verification
Endpoint Testing
The automation verifies these endpoints:
- Traefik: http://localhost:8080/dashboard/
- Authentik: https://auth.local
- Grafana: https://grafana.local
- Protected Services: Redirect to Authentik
Health Monitoring
Continuous monitoring of:
- Container health status
- Database connectivity
- Service availability
- Network connectivity
📚 Best Practices
- Always use
make runfor initial deployment - Run
make troubleshootif issues occur - Use
make verifyto test endpoints - Check
make statusfor container health - Use
make logs-servicefor specific debugging
🚨 Emergency Procedures
Complete Reset
make clean
make run
Authentik Issues
make restart-authentik
Database Problems
make fix-databases
Network Issues
make networks-clean
make networks