chore: organize project structure and cleanup root directory
- Move all deployment documentation to docs/deployment/ (16 files) - Move all phase documentation to docs/phases/ (9 files) - Move deployment scripts to scripts/ (3 PowerShell scripts) - Remove temporary deployment zip files (5 files) - Remove duplicate documentation files - Create documentation indexes for better navigation - Clean up root directory to essential files only - Update documentation references Root directory reduced from ~50+ files to 20 essential files. All documentation properly organized and indexed.
This commit is contained in:
391
docs/deployment/DEPLOYMENT_NEXT_STEPS.md
Normal file
391
docs/deployment/DEPLOYMENT_NEXT_STEPS.md
Normal file
@@ -0,0 +1,391 @@
|
||||
# 🚀 Complete Next Steps - Ensure All Endpoints Fully Deployed
|
||||
|
||||
**Date:** November 12, 2025
|
||||
**Objective:** Ensure all endpoints are fully deployed and operational
|
||||
|
||||
---
|
||||
|
||||
## 📊 Current Deployment Status
|
||||
|
||||
### ✅ Infrastructure: COMPLETE
|
||||
- All 9 Azure resources deployed and operational
|
||||
- Static Web App: Created (Standard SKU)
|
||||
- Function App: Created and running
|
||||
- Key Vault: Configured with secrets
|
||||
- Application Insights: Connected
|
||||
- Monitoring: Alerts configured
|
||||
|
||||
### ⚠️ Application Deployment: IN PROGRESS
|
||||
- **Static Web App:** Shows default Azure page (needs frontend deployment)
|
||||
- **Function App:** Running but functions may need deployment
|
||||
- **Endpoints:** Partially operational
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Immediate Actions Required
|
||||
|
||||
### 1. Deploy Frontend to Static Web App ⚠️ CRITICAL
|
||||
|
||||
**Current Issue:** Static Web App is showing Azure default page instead of your application.
|
||||
|
||||
**Recommended Solution: Use Azure Portal**
|
||||
|
||||
1. **Go to Azure Portal:**
|
||||
- Navigate to: https://portal.azure.com
|
||||
- Find: Static Web App `mim-prod-igiay4-web`
|
||||
- Go to: **Deployment Center**
|
||||
|
||||
2. **Deploy via Portal:**
|
||||
- Option A: Connect to GitHub repository (automatic deployments)
|
||||
- Option B: Upload zip file (`swa-deploy.zip` already created)
|
||||
- Option C: Use local Git deployment
|
||||
|
||||
3. **Or Use GitHub Actions (if repository connected):**
|
||||
```bash
|
||||
# Push to trigger deployment
|
||||
git add .
|
||||
git commit -m "Deploy to production"
|
||||
git push origin main
|
||||
```
|
||||
|
||||
**Alternative: Fix SWA CLI Deployment**
|
||||
```bash
|
||||
# The config has been fixed (removed apiRuntime)
|
||||
# Try deployment again:
|
||||
DEPLOY_TOKEN=$(az staticwebapp secrets list \
|
||||
--name mim-prod-igiay4-web \
|
||||
--resource-group rg-miraclesinmotion-prod \
|
||||
--query "properties.apiKey" -o tsv)
|
||||
|
||||
swa deploy ./dist \
|
||||
--env production \
|
||||
--deployment-token $DEPLOY_TOKEN \
|
||||
--no-use-keychain \
|
||||
--no-use-keychain
|
||||
```
|
||||
|
||||
**Verify Deployment:**
|
||||
```bash
|
||||
# Should show your React app, not Azure default page
|
||||
curl https://lemon-water-015cb3010.3.azurestaticapps.net | grep -i "miracles\|react\|vite"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 2. Deploy Function App Code ⚠️ CRITICAL
|
||||
|
||||
**Status:** Function App exists but functions need to be deployed.
|
||||
|
||||
**Deployment Steps:**
|
||||
```bash
|
||||
# 1. Ensure API is built
|
||||
cd api
|
||||
npm run build
|
||||
cd ..
|
||||
|
||||
# 2. Create deployment package
|
||||
cd api/dist
|
||||
zip -r ../../api-func-deploy.zip . -x "*.map" "*.d.ts"
|
||||
cd ../..
|
||||
|
||||
# 3. Deploy to Function App
|
||||
az functionapp deployment source config-zip \
|
||||
--resource-group rg-miraclesinmotion-prod \
|
||||
--name mim-prod-igiay4-func \
|
||||
--src api-func-deploy.zip
|
||||
|
||||
# 4. Verify deployment
|
||||
az functionapp show \
|
||||
--name mim-prod-igiay4-func \
|
||||
--resource-group rg-miraclesinmotion-prod \
|
||||
--query "{state:state, lastModifiedTimeUtc:lastModifiedTimeUtc}"
|
||||
```
|
||||
|
||||
**Test Functions:**
|
||||
```bash
|
||||
# Test function endpoints
|
||||
curl https://mim-prod-igiay4-func.azurewebsites.net/api/donations
|
||||
curl https://mim-prod-igiay4-func.azurewebsites.net/api/health
|
||||
```
|
||||
|
||||
**Expected:** JSON responses from your functions, not 404 errors.
|
||||
|
||||
---
|
||||
|
||||
### 3. Verify All Endpoints ✅
|
||||
|
||||
**Test Commands:**
|
||||
```bash
|
||||
# Static Web App - should show your app
|
||||
echo "Testing Static Web App..."
|
||||
curl -I https://lemon-water-015cb3010.3.azurestaticapps.net
|
||||
curl -s https://lemon-water-015cb3010.3.azurestaticapps.net | head -20
|
||||
|
||||
# Function App - should respond
|
||||
echo "Testing Function App..."
|
||||
curl -I https://mim-prod-igiay4-func.azurewebsites.net
|
||||
curl -s https://mim-prod-igiay4-func.azurewebsites.net
|
||||
|
||||
# API Endpoints
|
||||
echo "Testing API endpoints..."
|
||||
curl https://mim-prod-igiay4-func.azurewebsites.net/api/donations
|
||||
curl https://mim-prod-igiay4-func.azurewebsites.net/api/health
|
||||
```
|
||||
|
||||
**Success Criteria:**
|
||||
- ✅ Static Web App returns your React application HTML
|
||||
- ✅ Function App responds (200 OK or function responses)
|
||||
- ✅ API endpoints return JSON or proper responses
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Configuration Verification
|
||||
|
||||
### 4. Verify Environment Variables
|
||||
|
||||
**Check Current Settings:**
|
||||
```bash
|
||||
# Static Web App
|
||||
az staticwebapp appsettings list \
|
||||
--name mim-prod-igiay4-web \
|
||||
--resource-group rg-miraclesinmotion-prod \
|
||||
--query "properties"
|
||||
|
||||
# Function App
|
||||
az functionapp config appsettings list \
|
||||
--name mim-prod-igiay4-func \
|
||||
--resource-group rg-miraclesinmotion-prod \
|
||||
--query "[?name=='KEY_VAULT_URL' || name=='APPINSIGHTS_INSTRUMENTATIONKEY' || name=='STRIPE_SECRET_KEY']"
|
||||
```
|
||||
|
||||
**Update if Missing:**
|
||||
```bash
|
||||
# Static Web App
|
||||
az staticwebapp appsettings set \
|
||||
--name mim-prod-igiay4-web \
|
||||
--resource-group rg-miraclesinmotion-prod \
|
||||
--setting-names \
|
||||
"AZURE_CLIENT_ID=c96a96c9-24a2-4c9d-a4fa-286071bf1909" \
|
||||
"AZURE_TENANT_ID=fb97e99d-3e94-4686-bfde-4bf4062e05f3" \
|
||||
"VITE_STRIPE_PUBLISHABLE_KEY=@Microsoft.KeyVault(SecretUri=https://mim-prod-igiay4-kv.vault.azure.net/secrets/stripe-publishable-key/)"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ☁️ Cloudflare Setup (Optional but Recommended)
|
||||
|
||||
### 5. Complete Cloudflare Configuration
|
||||
|
||||
**Prerequisites:**
|
||||
Add to `.env.production`:
|
||||
```
|
||||
CLOUDFLARE_API_TOKEN=your-token-here
|
||||
CLOUDFLARE_ZONE_ID=your-zone-id-here
|
||||
```
|
||||
|
||||
**Run Automation:**
|
||||
```bash
|
||||
bash scripts/setup-cloudflare-auto.sh
|
||||
```
|
||||
|
||||
**What it configures:**
|
||||
- DNS records (www and apex domain)
|
||||
- SSL/TLS (Full mode, Always HTTPS)
|
||||
- Security settings (Medium level, Browser check)
|
||||
- Performance (Minification, Brotli compression)
|
||||
- Custom domain in Azure
|
||||
|
||||
---
|
||||
|
||||
## 🌐 Custom Domain (Optional)
|
||||
|
||||
### 6. Configure Custom Domain
|
||||
|
||||
**DNS Setup:**
|
||||
1. At your DNS provider, add:
|
||||
- CNAME: `www` → `lemon-water-015cb3010.3.azurestaticapps.net`
|
||||
- CNAME: `@` → `lemon-water-015cb3010.3.azurestaticapps.net` (or use Cloudflare)
|
||||
|
||||
**Azure Configuration:**
|
||||
```bash
|
||||
az staticwebapp hostname set \
|
||||
--name mim-prod-igiay4-web \
|
||||
--resource-group rg-miraclesinmotion-prod \
|
||||
--hostname "mim4u.org"
|
||||
|
||||
az staticwebapp hostname set \
|
||||
--name mim-prod-igiay4-web \
|
||||
--resource-group rg-miraclesinmotion-prod \
|
||||
--hostname "www.mim4u.org"
|
||||
```
|
||||
|
||||
**Timeline:**
|
||||
- DNS propagation: 5-30 minutes
|
||||
- SSL certificate: 1-24 hours
|
||||
|
||||
---
|
||||
|
||||
## 🧪 Comprehensive Testing
|
||||
|
||||
### 7. Run Full Test Suite
|
||||
|
||||
**Automated Tests:**
|
||||
```bash
|
||||
bash scripts/test-deployment.sh
|
||||
```
|
||||
|
||||
**Manual Testing Checklist:**
|
||||
- [ ] Static Web App loads your application
|
||||
- [ ] Function App responds to requests
|
||||
- [ ] API endpoints return expected data
|
||||
- [ ] Authentication works (if configured)
|
||||
- [ ] HTTPS is enforced
|
||||
- [ ] Performance is acceptable (< 3s load time)
|
||||
|
||||
**Performance Testing:**
|
||||
```bash
|
||||
# Response times
|
||||
echo "Static Web App:" && time curl -s -o /dev/null https://lemon-water-015cb3010.3.azurestaticapps.net
|
||||
echo "Function App:" && time curl -s -o /dev/null https://mim-prod-igiay4-func.azurewebsites.net
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📊 Monitoring & Alerts
|
||||
|
||||
### 8. Verify Monitoring
|
||||
|
||||
**Check Application Insights:**
|
||||
- Portal: https://portal.azure.com → Application Insights → mim-prod-igiay4-appinsights
|
||||
- Verify telemetry is being collected
|
||||
|
||||
**Check Alerts:**
|
||||
```bash
|
||||
az monitor metrics alert list \
|
||||
--resource-group rg-miraclesinmotion-prod \
|
||||
--query "[].{name:name, enabled:enabled, description:description}"
|
||||
```
|
||||
|
||||
**Set Up Additional Alerts (if needed):**
|
||||
- Response time alerts
|
||||
- Availability alerts
|
||||
- Error rate thresholds
|
||||
|
||||
---
|
||||
|
||||
## 🔐 Security Verification
|
||||
|
||||
### 9. Security Checklist
|
||||
|
||||
- [x] HTTPS enforced (automatic)
|
||||
- [x] Key Vault for secrets
|
||||
- [ ] CORS configured (if needed)
|
||||
- [ ] Authentication working
|
||||
- [x] Environment variables secured
|
||||
- [x] Monitoring active
|
||||
|
||||
**Configure CORS (if needed):**
|
||||
```bash
|
||||
az functionapp cors add \
|
||||
--name mim-prod-igiay4-func \
|
||||
--resource-group rg-miraclesinmotion-prod \
|
||||
--allowed-origins "https://lemon-water-015cb3010.3.azurestaticapps.net"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📋 Deployment Priority
|
||||
|
||||
### Critical (Do First)
|
||||
1. ✅ **Deploy Frontend** - Static Web App needs your application
|
||||
2. ✅ **Deploy Functions** - Function App needs function code
|
||||
3. ✅ **Verify Endpoints** - Ensure everything responds correctly
|
||||
|
||||
### Important (Do Next)
|
||||
4. ⚠️ **Complete Cloudflare** - Performance and security
|
||||
5. ⚠️ **Configure Custom Domain** - Professional URL
|
||||
6. ⚠️ **Final Testing** - Comprehensive verification
|
||||
|
||||
### Optional (Can Do Later)
|
||||
7. 📝 **Performance Optimization** - Fine-tune response times
|
||||
8. 📝 **Additional Monitoring** - More detailed alerts
|
||||
9. 📝 **Documentation** - Update deployment guides
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Quick Deployment Commands
|
||||
|
||||
### Complete Deployment in One Go
|
||||
|
||||
```bash
|
||||
# 1. Build everything
|
||||
npm run build
|
||||
cd api && npm run build && cd ..
|
||||
|
||||
# 2. Deploy Function App
|
||||
cd api/dist && zip -r ../../api-func-deploy.zip . && cd ../..
|
||||
az functionapp deployment source config-zip \
|
||||
--resource-group rg-miraclesinmotion-prod \
|
||||
--name mim-prod-igiay4-func \
|
||||
--src api-func-deploy.zip
|
||||
|
||||
# 3. Deploy Static Web App (choose method)
|
||||
# Method A: Azure Portal (recommended)
|
||||
# Method B: GitHub Actions (if connected)
|
||||
# Method C: SWA CLI (if fixed)
|
||||
|
||||
# 4. Verify
|
||||
curl -I https://lemon-water-015cb3010.3.azurestaticapps.net
|
||||
curl -I https://mim-prod-igiay4-func.azurewebsites.net
|
||||
|
||||
# 5. Run tests
|
||||
bash scripts/test-deployment.sh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ✅ Success Criteria
|
||||
|
||||
Deployment is **COMPLETE** when:
|
||||
|
||||
- [x] All infrastructure resources deployed ✅
|
||||
- [ ] Static Web App shows your application (not default page) ⚠️
|
||||
- [ ] Function App has functions deployed ⚠️
|
||||
- [ ] All endpoints return expected responses ⚠️
|
||||
- [x] Configuration verified ✅
|
||||
- [x] Monitoring active ✅
|
||||
- [ ] Cloudflare configured (optional) ⚠️
|
||||
- [ ] Custom domain working (optional) ⚠️
|
||||
|
||||
---
|
||||
|
||||
## 📚 Reference Documentation
|
||||
|
||||
- **Full Next Steps:** `NEXT_STEPS_COMPLETE.md`
|
||||
- **Deployment Status:** `DEPLOYMENT_STATUS.md`
|
||||
- **Verification Report:** `DEPLOYMENT_VERIFICATION_REPORT.md`
|
||||
- **Cloudflare Guide:** `CLOUDFLARE_AUTOMATION_COMPLETE.md`
|
||||
- **Custom Domain:** `CUSTOM_DOMAIN_SETUP.md`
|
||||
|
||||
---
|
||||
|
||||
## 🆘 Troubleshooting
|
||||
|
||||
### Static Web App Shows Default Page
|
||||
**Solution:** Deploy via Azure Portal → Deployment Center or fix SWA CLI
|
||||
|
||||
### Function App Returns 404
|
||||
**Solution:** Deploy function code using zip deployment
|
||||
|
||||
### Endpoints Not Responding
|
||||
**Solution:** Check Function App state, verify deployment, check logs
|
||||
|
||||
### Authentication Not Working
|
||||
**Solution:** Verify Azure AD configuration, check redirect URIs
|
||||
|
||||
---
|
||||
|
||||
**🎯 Focus: Deploy frontend and Function App code to make all endpoints fully operational!**
|
||||
|
||||
**Next Action:** Use Azure Portal to deploy Static Web App, then deploy Function App code.
|
||||
|
||||
Reference in New Issue
Block a user