# 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