ADR-010: Bootstrap Deployment Architecture
Statusโ
Accepted
Dateโ
2025-01-23
Contextโ
The MCP ADR Analysis Server needs a comprehensive deployment automation system that can:
- Detect deployment platforms automatically (Kubernetes, OpenShift, Docker, etc.)
- Generate deployment scripts from validated patterns and ADRs
- Track infrastructure resources for proper cleanup
- Validate deployments against architectural decisions
- Provide reproducible workflows for CI/CD integration
Previously, deployment was manual and error-prone. We needed an intelligent system that integrates three key components:
- Validated Patterns Framework - Community-maintained deployment templates
- SystemCard Resource Tracking - Automated resource lifecycle management
- Bootstrap Validation Loop - Iterative deployment with learning
Decisionโ
We will implement a unified bootstrap deployment architecture that integrates Validated Patterns, SystemCard, and Bootstrap Validation Loop into a single developer-facing tool.
Architecture Overviewโ
Component Integration Flowโ
Deployment Workflow Detailโ
Resource Cleanup Architectureโ
Implementation Detailsโ
1. Validated Patterns Frameworkโ
Location: src/utils/validated-pattern-definitions.ts and patterns/infrastructure/*.yaml
Purpose: Provides community-maintained, tested deployment patterns
Structure:
version: '1.0'
id: 'kubernetes-v1'
name: 'Kubernetes'
authoritativeSources:
- type: 'documentation'
url: 'https://kubernetes.io/docs/'
requiredForDeployment: true
deploymentPhases:
- order: 1
name: 'Prerequisites Validation'
commands:
- command: 'kubectl cluster-info'
expectedExitCode: 0
validationChecks:
- id: 'cluster-connection'
command: 'kubectl cluster-info'
severity: 'critical'
Benefits:
- Official documentation links (LLMs should query before deployment)
- Proven deployment workflows
- Platform-specific validation checks
- Troubleshooting guidance
2. SystemCard Resource Trackingโ
Location: src/utils/system-card-manager.ts
Purpose: Track all infrastructure resources for proper cleanup
Key Features:
- Automatic resource detection during deployment
- Generates cleanup phases with proper ordering
- Integrates with CI/CD workflows
- Prevents orphaned resources
SystemCard Structure:
{
systemId: 'kubernetes-bootstrap-1234567890',
platform: {
type: 'kubernetes',
version: '1.28',
detectionConfidence: 0.95
},
resources: [
{
id: 'deployment-myapp',
type: 'deployment',
platform: 'kubernetes',
metadata: {
namespace: 'default',
name: 'myapp'
},
dependencies: ['service-myapp']
}
],
cleanupPhases: [
{
phase: 1,
description: 'Delete application deployments',
commands: ['kubectl delete deployment myapp']
}
]
}
3. Bootstrap Validation Loopโ
Location: src/tools/bootstrap-validation-loop-tool.ts
Purpose: Orchestrate the entire deployment workflow
Key Phases:
Phase 0: Environment Validationโ
- Detect platform type
- Verify connectivity (oc status, kubectl cluster-info, docker ps)
- Confirm target environment with user
Phase 1-5: Iterative Deploymentโ
- Generate bootstrap scripts from validated patterns
- Execute deployment
- Validate against ADR requirements
- Auto-fix failures (if enabled)
- Retry until success or max iterations
Generated Files:
project/
โโโ docs/adrs/
โ โโโ bootstrap-deployment-{timestamp}.md # Deployment ADR
โโโ bootstrap.sh # Deployment script
โโโ validate_bootstrap.sh # Validation script
โโโ cleanup.sh # Cleanup script (from SystemCard)
โโโ .system-card.json # Resource tracking state
4. GitHub Workflows Integrationโ
Publish Workflow (.github/workflows/publish.yml)โ
- name: Test MCP server functionality
run: ./scripts/test-mcp-server.sh
- name: Build project
run: npm run build
- name: Publish to NPM
run: npm publish
Key Scripts Called:
scripts/test-mcp-server.sh- Validates MCP protocol implementationscripts/test-infrastructure.sh- Tests infrastructure deploymentnpm run build- Compiles TypeScript โ JavaScript
Build Workflow (.github/workflows/build.yml)โ
- Type checking
- Linting
- Unit tests
- Integration tests
Test Workflow (.github/workflows/test.yml)โ
- Comprehensive test suite
- Coverage reporting
- Performance benchmarks
5. Tool Entry Point for Developersโ
Tool Call:
bootstrap_validation_loop({
projectPath: '/path/to/project',
adrDirectory: 'docs/adrs',
targetEnvironment: 'production',
maxIterations: 5,
autoFix: true,
updateAdrsWithLearnings: true,
});
Returns:
{
success: true,
iterations: 2,
finalResult: { /* execution details */ },
adrUpdates: [ /* proposed ADR updates */ ],
deploymentPlan: { /* detected platform and steps */ },
bootstrapAdrPath: "docs/adrs/bootstrap-deployment-1234.md",
contextDocumentPath: "docs/context/bootstrap-1234.json",
requiresHumanApproval: true
}