# Bootstrap Deployment Workflow - User Guide
> **π Welcome!** This guide explains what happens when you run the bootstrap tool and how to use the generated scripts.
---
## π― What You'll Get
When you call `bootstrap_validation_loop`, the tool will:
1. β
Detect your deployment platform (Kubernetes, Docker, OpenShift, etc.)
2. β
Generate deployment scripts customized for your platform
3. β
Create an ADR documenting your deployment plan
4. β
Track all resources so you can clean them up later
5. β
Give you validation scripts to verify everything works
## π Visual Workflow - What Happens Step by Step
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Step 1: You Call the Tool β
β β
β You: "bootstrap_validation_loop" β
β Tool: "Let me detect your platform..." β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Step 2: Platform Detection β
β β
β Tool looks at your files: β
β β’ Found kubernetes.yaml β "You're using Kubernetes!" β
β β’ Found Dockerfile β "You have Docker too!" β
β β’ Confidence: 92% sure it's Kubernetes β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Step 3: Load Best Practices β
β β
β Tool: "Loading Kubernetes best practices..." β
β β’ Official documentation: kubernetes.io β
β β’ Deployment steps: 6 phases β
β β’ Validation checks: 5 critical checks β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Step 4: Start Tracking Resources β
β β
β Tool: "Creating SystemCard to track everything..." β
β β’ Namespace: myapp β β
β β’ Deployment: myapp β β
β β’ Service: myapp β β
β β
β (This lets you clean up everything later!) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Step 5: Generate Your Deployment Plan β
β β
β Tool creates an ADR document with: β
β β What platform you're using β
β β What files you need (deployment.yaml, etc.) β
β β What environment variables are required β
β β Step-by-step deployment instructions β
β β How to validate it worked β
β β How to clean up when done β
β β
β File: docs/adrs/bootstrap-deployment-{timestamp}.md β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Step 6: Generate Deployment Scripts β
β β
β Tool creates 3 scripts for you: β
β β
β π bootstrap.sh β
β β Deploys your app automatically β
β β
β π validate_bootstrap.sh β
β β Checks if deployment worked β
β β
β π cleanup.sh β
β β Removes everything cleanly β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Step 7: You're Ready to Deploy! β
β β
β Tool: "β
Bootstrap complete! Here's what to do next:" β
β β
β 1. Review the ADR in docs/adrs/ β
β 2. Run ./bootstrap.sh to deploy β
β 3. Run ./validate_bootstrap.sh to verify β
β 4. When done, run ./cleanup.sh to remove everything β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
## π Files Created in Your Project
After running the tool, you'll see these new files:
```
your-project/
βββ docs/
β βββ adrs/
β βββ bootstrap-deployment-2025-01-23.md β Your deployment plan
β
βββ bootstrap.sh β Deploy script (run this!)
βββ validate_bootstrap.sh β Validation script
βββ cleanup.sh β Cleanup script
βββ .system-card.json β Resource tracking (internal use)
```
## π How to Use the Generated Scripts
### 1οΈβ£ First: Read Your ADR
```bash
# Open and read the generated ADR
cat docs/adrs/bootstrap-deployment-*.md
```
**What to look for:**
- β
Is Kubernetes the right platform? (or Docker, etc.)
- β
Do you have all required files?
- β
Are all environment variables set?
- β
Do the deployment steps make sense?
### 2οΈβ£ Second: Run Bootstrap Script
```bash
# Make sure you're connected to your cluster
kubectl cluster-info # or: docker ps
# Deploy your application
./bootstrap.sh
```
**What this does:**
```
Phase 1: Check prerequisites (kubectl installed, cluster accessible)
β
Phase 2: Create namespace (myapp)
β
Phase 3: Create secrets (from your .env file)
β
Phase 4: Deploy application (pods, services)
β
Phase 5: Deploy ingress (if needed)
β
Phase 6: Wait for everything to be ready
β
Done! β
```
**Watch the output:**
```
========================================
Bootstrap Deployment - kubernetes
Pattern: Kubernetes
========================================
Starting Phase 1: Prerequisites Validation
β Verify kubectl is installed
kubectl version --client
β Verify cluster connectivity
kubectl cluster-info
β Phase 1 complete
Starting Phase 2: Namespace Setup
β Create namespace
kubectl create namespace myapp
β Phase 2 complete
...
========================================
β
Bootstrap deployment complete!
========================================
```
### 3οΈβ£ Third: Validate Deployment
```bash
# Check if everything deployed correctly
./validate_bootstrap.sh
```
**What this checks:**
- β
Can we connect to the cluster?
- β
Is the namespace created?
- β
Are all pods running?
- β
Does the service have endpoints?
- β
Is the application responding?
**Success looks like:**
```
========================================
Bootstrap Validation
========================================
Checking: Cluster Connection
β
PASSED: Cluster Connection
Checking: Deployment Ready
β
PASSED: Deployment Ready
Checking: Service Has Endpoints
β
PASSED: Service Has Endpoints
Checking: Pods Running
β
PASSED: Pods Running
========================================
β
All validation checks passed!
========================================
```
**If something fails:**
```
Checking: Deployment Ready
β FAILED: Deployment Ready
Some pods are not in Running state
Remediation steps:
- Check pod status: kubectl describe pod <pod-name>
- View pod logs: kubectl logs <pod-name>
- Check resource limits and requests
```
### 4οΈβ£ Fourth: When Done - Cleanup
```bash
# Remove everything cleanly
./cleanup.sh
```
**What this removes:**
```
Phase 1: Delete application (deployments, services)
β
Phase 2: Delete secrets
β
Phase 3: Delete namespace
β
Done! Everything cleaned up β
```
## π Understanding the SystemCard
**What is SystemCard?**
SystemCard is like a "shopping list" that tracks everything the tool creates for you. This way, when you clean up, it knows exactly what to delete.
**What it tracks:**
```json
{
"resources": [
"namespace: myapp",
"deployment: myapp",
"service: myapp",
"secret: app-secrets"
]
}
```
**Why this matters:**
β Without SystemCard:
```bash
# You have to remember everything you created
kubectl delete deployment myapp
kubectl delete service myapp
kubectl delete secret app-secrets
kubectl delete namespace myapp
# Did I forget anything? π€
```
β
With SystemCard:
```bash
# Just run cleanup.sh - it knows everything!
./cleanup.sh
# All done! Nothing left behind β
```
## π¬ Complete Example Walkthrough
Let's say you're deploying a Node.js app to Kubernetes.
### Before You Start
**What you have:**
```
my-nodejs-app/
βββ src/
β βββ index.js
βββ Dockerfile
βββ deployment.yaml β Kubernetes manifest
βββ service.yaml β Kubernetes service
βββ .env β Environment variables
```
### Step 1: Call the Bootstrap Tool
```bash
# In Claude or your MCP client
"Run bootstrap_validation_loop for my project"
```
**Tool responds:**
```
π Detecting platform...
π Found: Kubernetes (92% confidence)
β
Loaded: Kubernetes validated pattern
π Generated: bootstrap-deployment-2025-01-23.md
π Generated: bootstrap.sh
π Generated: validate_bootstrap.sh
π Generated: cleanup.sh
```
### Step 2: Review the Plan
```bash
cat docs/adrs/bootstrap-deployment-2025-01-23.md
```
**You see:**
- Platform: Kubernetes β
- Required files: deployment.yaml β, service.yaml β, .env β
- Environment variables: DATABASE_URL, JWT_SECRET
- 6 deployment phases with commands
- 5 validation checks
**You think:** "Looks good! Let's deploy!"
### Step 3: Deploy
```bash
# First, make sure you're connected to your cluster
kubectl cluster-info
# Output: Kubernetes control plane is running at https://...
# Now deploy
./bootstrap.sh
```
**You see:**
```
========================================
Bootstrap Deployment - kubernetes
========================================
Phase 1: Prerequisites Validation
β kubectl is installed
β Cluster is accessible
Phase 2: Namespace Setup
β Created namespace: myapp
Phase 3: Secrets
β Created secrets from .env
Phase 4: Application Deployment
β Deployment created: myapp
β Service created: myapp
Phase 5: Waiting for pods...
β Pods are running (3/3)
========================================
β
Bootstrap complete! (took 2m 34s)
========================================
```
### Step 4: Validate
```bash
./validate_bootstrap.sh
```
**You see:**
```
Checking: Cluster Connection β
PASSED
Checking: Namespace Exists β
PASSED
Checking: Deployment Ready β
PASSED
Checking: Service Has Endpoints β
PASSED
Checking: Pods Running β
PASSED
β
All 5 checks passed! Your app is live!
```
### Step 5: Access Your App
```bash
# Get the service IP
kubectl get service myapp
# Output:
# NAME TYPE EXTERNAL-IP PORT(S)
# myapp LoadBalancer 203.0.113.42 80:30123/TCP
# Open in browser
open http://203.0.113.42
```
**π Your app is live!**
### Step 6: Later - Cleanup
```bash
# When you're done testing
./cleanup.sh
```
**You see:**
```
π§Ή Starting deployment cleanup...
Phase 1: Delete application
β Deleted deployment: myapp
β Deleted service: myapp
Phase 2: Delete secrets
β Deleted secret: app-secrets
Phase 3: Delete namespace
β Deleted namespace: myapp
β
Cleanup complete! (took 45s)
Nothing left behind - all resources removed.
```
## π€ Common Questions
### Q: Do I need to understand all the internals?
**A:** No! You just need to:
1. Read the generated ADR
2. Run `./bootstrap.sh`
3. Run `./validate_bootstrap.sh`
4. Use `./cleanup.sh` when done
The tool handles all the complexity.
### Q: What if I want to customize the deployment?
**A:** You can edit the generated scripts! They're just bash scripts with clear phases. Or, modify your deployment.yaml and re-run the tool.
### Q: Can I use this in CI/CD?
**A:** Yes! Example:
```yaml
# .github/workflows/deploy.yml
- name: Deploy to Kubernetes
run: |
./bootstrap.sh
./validate_bootstrap.sh
```
### Q: What if validation fails?
**A:** The validation script tells you exactly what failed and how to fix it. Example:
```
β FAILED: Deployment Ready
Remediation steps:
- Check pod status: kubectl describe pod <pod-name>
- View pod logs: kubectl logs <pod-name>
```
Follow the remediation steps, then re-run validation.
### Q: Can I deploy to multiple environments?
**A:** Yes! The tool accepts `targetEnvironment` parameter:
```typescript
bootstrap_validation_loop({
targetEnvironment: "production" // or "staging", "development"
})
```
This generates environment-specific ADRs and scripts.
### Q: What platforms are supported?
The tool auto-detects:
- β
Kubernetes
- β
OpenShift
- β
Docker / Docker Compose
- β
Firebase
- β
AWS
- β
More being added!
If your platform isn't supported, the tool uses AI to generate a deployment plan.
## π Pro Tips
### Tip 1: Read the ADR First
The ADR has **everything** you need to know:
- What platform was detected
- What files you need
- What could go wrong
- How to fix problems
### Tip 2: Run Validation Often
```bash
# After deployment
./validate_bootstrap.sh
# After making changes
./validate_bootstrap.sh
# Before committing
./validate_bootstrap.sh
```
### Tip 3: Keep Scripts in Git
```bash
git add bootstrap.sh validate_bootstrap.sh cleanup.sh
git commit -m "Add deployment automation"
```
Now your whole team can use them!
### Tip 4: Use Cleanup in CI/CD
```yaml
# Test workflow
- name: Deploy test environment
run: ./bootstrap.sh
- name: Run tests
run: npm test
- name: Cleanup test environment
run: ./cleanup.sh
```
This gives you clean test environments every time.
### Tip 5: Check SystemCard
```bash
# See what resources are being tracked
cat .system-card.json | jq .
```
This shows you exactly what will be deleted during cleanup.
## π Next Steps
1. **Run the tool** and get your deployment scripts
2. **Read your ADR** to understand the plan
3. **Deploy** with `./bootstrap.sh`
4. **Validate** with `./validate_bootstrap.sh`
5. **Use in CI/CD** for automated deployments
## π Need Help?
- **ADR unclear?** Open an issue: [GitHub Issues](https://github.com/tosin2013/mcp-adr-analysis-server/issues)
- **Validation failed?** Check the remediation steps in the validation output
- **Want to customize?** Edit the generated scripts - they're just bash!
- **Found a bug?** Please report it so we can improve!
---
**Remember:** The tool does the hard work of detecting your platform, finding best practices, and generating scripts. You just run them! π
**Generated by**: MCP ADR Analysis Server v2.1.11
**Documentation**: https://github.com/tosin2013/mcp-adr-analysis-server/tree/main/docs