Skip to content

Commit 28a4b6c

Browse files
chitcommitclaude
andcommitted
Add deployment dashboard and production readiness checklist
- Real-time deployment monitoring dashboard - Comprehensive production readiness checklist - Performance targets and security guidelines - Incident response procedures - Scaling strategies documentation πŸ€– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4a27b31 commit 28a4b6c

2 files changed

Lines changed: 388 additions & 0 deletions

File tree

β€ŽPRODUCTION-CHECKLIST.mdβ€Ž

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
# πŸš€ Production Readiness Checklist
2+
3+
## βœ… Deployment Status
4+
5+
### Infrastructure
6+
- [x] CI/CD Pipeline configured with GitHub Actions
7+
- [x] Automated deployment to derail.me on main branch push
8+
- [x] Health monitoring every 15 minutes
9+
- [x] SSL certificate automation with Let's Encrypt
10+
- [x] Nginx reverse proxy configuration
11+
- [x] PM2 process management
12+
- [x] PostgreSQL database setup
13+
- [x] Docker containerization
14+
15+
### Security
16+
- [x] JWT authentication implemented
17+
- [x] Password hashing with bcrypt
18+
- [x] Role-based access control (owner/admin/viewer/guest)
19+
- [x] One-time shareable links with revocation
20+
- [x] CORS protection configured
21+
- [x] Security headers in Nginx
22+
- [x] Environment variables for secrets
23+
- [x] HTTPS enforced with SSL redirect
24+
25+
### Features
26+
- [x] Live RTSP to WebSocket streaming
27+
- [x] HLS.js fallback for compatibility
28+
- [x] Real-time chat via WebSocket
29+
- [x] Camera PTZ control support
30+
- [x] Recording request workflow
31+
- [x] Guest session management
32+
- [x] User layout preferences
33+
- [x] Google Drive integration ready
34+
35+
### Monitoring & Logging
36+
- [x] Health check endpoints (/api/health, /api/ready, /api/live)
37+
- [x] Performance monitoring in health checks
38+
- [x] SSL certificate expiry monitoring
39+
- [x] Database connectivity checks
40+
- [x] Slack webhook notifications
41+
- [x] GitHub Actions status tracking
42+
- [x] PM2 log management
43+
- [x] Nginx access/error logs
44+
45+
## πŸ“‹ Required Configuration
46+
47+
### GitHub Secrets (Required)
48+
```bash
49+
PRODUCTION_HOST=derail.me
50+
PRODUCTION_USER=deploy
51+
PRODUCTION_PORT=22
52+
PRODUCTION_SSH_KEY=[Your SSH Private Key]
53+
JWT_SECRET=[Generated Secret]
54+
SESSION_SECRET=[Generated Secret]
55+
DATABASE_URL=postgresql://streamlink:password@localhost:5432/chittypro_streamlink
56+
ALLOWED_ORIGINS=https://derail.me,https://www.derail.me
57+
```
58+
59+
### Server Requirements
60+
- Ubuntu/Debian Linux
61+
- Node.js 20.x
62+
- PostgreSQL 14+
63+
- Nginx
64+
- PM2
65+
- FFmpeg (for streaming)
66+
- 2GB+ RAM recommended
67+
- 20GB+ storage for recordings
68+
69+
## πŸ”§ Deployment Commands
70+
71+
### Initial Server Setup
72+
```bash
73+
# Run on your server
74+
scp scripts/setup-server.sh deploy@derail.me:~/
75+
ssh deploy@derail.me
76+
./setup-server.sh
77+
```
78+
79+
### Configure GitHub Secrets
80+
```bash
81+
# Run locally
82+
./scripts/configure-github-secrets.sh
83+
```
84+
85+
### Deploy to Production
86+
```bash
87+
# Automatic on push
88+
git push origin main
89+
90+
# Manual deployment
91+
gh workflow run deploy-production.yml
92+
```
93+
94+
### Monitor Deployment
95+
```bash
96+
# Dashboard
97+
./scripts/deployment-dashboard.sh
98+
99+
# Verify deployment
100+
./scripts/verify-deployment.sh derail.me
101+
102+
# Watch GitHub Actions
103+
gh run watch -R chitcommit/chittypro-streamlink
104+
```
105+
106+
### Server Management
107+
```bash
108+
# View logs
109+
ssh deploy@derail.me 'pm2 logs chittypro-streamlink'
110+
111+
# Restart application
112+
ssh deploy@derail.me 'pm2 restart chittypro-streamlink'
113+
114+
# Check status
115+
ssh deploy@derail.me 'pm2 status'
116+
117+
# Database backup
118+
ssh deploy@derail.me 'pg_dump chittypro_streamlink > backup.sql'
119+
```
120+
121+
## 🎯 Performance Targets
122+
123+
- Homepage load: < 2 seconds
124+
- API response: < 500ms
125+
- WebSocket latency: < 100ms
126+
- Health check: < 1 second
127+
- SSL handshake: < 200ms
128+
- Database queries: < 50ms
129+
130+
## πŸ”’ Security Checklist
131+
132+
- [ ] Change default admin password
133+
- [ ] Configure firewall rules (ufw)
134+
- [ ] Set up fail2ban for SSH
135+
- [ ] Enable unattended-upgrades
136+
- [ ] Configure database backups
137+
- [ ] Test restore procedures
138+
- [ ] Review Nginx security headers
139+
- [ ] Audit npm packages regularly
140+
141+
## πŸ“Š Monitoring URLs
142+
143+
- **Application**: https://derail.me
144+
- **Health Check**: https://derail.me/api/health
145+
- **GitHub Actions**: https://github.com/chitcommit/chittypro-streamlink/actions
146+
- **SSL Status**: https://www.ssllabs.com/ssltest/analyze.html?d=derail.me
147+
148+
## 🚨 Incident Response
149+
150+
### Application Down
151+
1. Check health endpoint: `curl https://derail.me/api/health`
152+
2. SSH to server: `ssh deploy@derail.me`
153+
3. Check PM2 status: `pm2 status`
154+
4. Check logs: `pm2 logs chittypro-streamlink`
155+
5. Restart if needed: `pm2 restart chittypro-streamlink`
156+
157+
### Database Issues
158+
1. Check PostgreSQL: `sudo systemctl status postgresql`
159+
2. Check connections: `sudo -u postgres psql -c "SELECT count(*) FROM pg_stat_activity;"`
160+
3. Review logs: `sudo tail -f /var/log/postgresql/*.log`
161+
4. Restart if needed: `sudo systemctl restart postgresql`
162+
163+
### High Load
164+
1. Check server resources: `htop`
165+
2. Check PM2 cluster: `pm2 status`
166+
3. Scale workers: `pm2 scale chittypro-streamlink 4`
167+
4. Check Nginx: `sudo nginx -t && sudo systemctl reload nginx`
168+
169+
### SSL Certificate Issues
170+
1. Check expiry: `sudo certbot certificates`
171+
2. Renew manually: `sudo certbot renew`
172+
3. Restart Nginx: `sudo systemctl restart nginx`
173+
174+
## πŸ“ˆ Scaling Options
175+
176+
### Vertical Scaling
177+
- Upgrade server RAM/CPU
178+
- Increase PostgreSQL connections
179+
- Add PM2 cluster workers
180+
181+
### Horizontal Scaling
182+
- Add load balancer (HAProxy/Nginx)
183+
- Database read replicas
184+
- CDN for static assets (Cloudflare)
185+
- Separate streaming servers
186+
187+
### Storage Scaling
188+
- Google Drive integration (configured)
189+
- S3-compatible object storage
190+
- Network-attached storage (NAS)
191+
- Automated cleanup policies
192+
193+
## βœ… Final Checks
194+
195+
Before going live:
196+
1. [ ] Test all user roles (admin/viewer/guest)
197+
2. [ ] Verify camera streaming works
198+
3. [ ] Test one-time share links
199+
4. [ ] Confirm recording storage
200+
5. [ ] Check mobile responsiveness
201+
6. [ ] Test WebSocket reconnection
202+
7. [ ] Verify SSL certificate
203+
8. [ ] Review security headers
204+
9. [ ] Test backup/restore
205+
10. [ ] Document admin credentials
206+
207+
## πŸŽ‰ Launch!
208+
209+
Your ChittyPro Streamlink is production-ready!
210+
211+
Monitor at: https://github.com/chitcommit/chittypro-streamlink/actions
212+
Access at: https://derail.me
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
#!/bin/bash
2+
3+
# ChittyPro Streamlink Deployment Dashboard
4+
# Real-time monitoring of your production deployment
5+
6+
set -e
7+
8+
# Colors for output
9+
RED='\033[0;31m'
10+
GREEN='\033[0;32m'
11+
YELLOW='\033[1;33m'
12+
BLUE='\033[0;34m'
13+
NC='\033[0m' # No Color
14+
15+
# Configuration
16+
GITHUB_REPO="chitcommit/chittypro-streamlink"
17+
PRODUCTION_URL="https://derail.me"
18+
API_BASE="$PRODUCTION_URL/api"
19+
20+
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
21+
echo -e "${BLUE} ChittyPro Streamlink Deployment Dashboard ${NC}"
22+
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
23+
echo ""
24+
25+
# Function to check service status
26+
check_status() {
27+
local url=$1
28+
local name=$2
29+
30+
if curl -s -f -o /dev/null --max-time 5 "$url"; then
31+
echo -e " ${GREEN}βœ“${NC} $name"
32+
return 0
33+
else
34+
echo -e " ${RED}βœ—${NC} $name"
35+
return 1
36+
fi
37+
}
38+
39+
# Function to get response time
40+
get_response_time() {
41+
local url=$1
42+
local time=$(curl -o /dev/null -s -w "%{time_total}" --max-time 5 "$url" 2>/dev/null || echo "N/A")
43+
44+
if [ "$time" != "N/A" ]; then
45+
printf "%.2fs" "$time"
46+
else
47+
echo "N/A"
48+
fi
49+
}
50+
51+
# Function to check GitHub Actions
52+
check_github_actions() {
53+
echo -e "${YELLOW}πŸ“Š GitHub Actions Status${NC}"
54+
55+
if command -v gh &> /dev/null; then
56+
# Get latest workflow runs
57+
runs=$(gh run list -R "$GITHUB_REPO" --limit 5 --json status,name,createdAt,conclusion 2>/dev/null || echo "[]")
58+
59+
if [ "$runs" != "[]" ]; then
60+
echo "$runs" | jq -r '.[] | " \(.conclusion // .status) - \(.name) (\(.createdAt | split("T")[0]))"' | while read -r line; do
61+
if [[ "$line" == *"success"* ]] || [[ "$line" == *"completed"* ]]; then
62+
echo -e " ${GREEN}βœ“${NC} ${line/success/}"
63+
elif [[ "$line" == *"failure"* ]]; then
64+
echo -e " ${RED}βœ—${NC} ${line/failure/}"
65+
elif [[ "$line" == *"in_progress"* ]]; then
66+
echo -e " ${YELLOW}⟳${NC} ${line/in_progress/}"
67+
else
68+
echo " $line"
69+
fi
70+
done
71+
else
72+
echo " GitHub CLI not authenticated or no runs found"
73+
fi
74+
else
75+
echo " GitHub CLI not installed (install with: brew install gh)"
76+
fi
77+
echo ""
78+
}
79+
80+
# 1. Service Health
81+
echo -e "${YELLOW}πŸ₯ Service Health${NC}"
82+
check_status "$PRODUCTION_URL" "Main Application"
83+
check_status "$API_BASE/health" "Health Endpoint"
84+
check_status "$API_BASE/ready" "Readiness Check"
85+
check_status "$API_BASE/live" "Liveness Check"
86+
check_status "$API_BASE/cameras" "Camera API"
87+
echo ""
88+
89+
# 2. Performance Metrics
90+
echo -e "${YELLOW}⚑ Performance Metrics${NC}"
91+
echo -e " Response Times:"
92+
echo -e " Homepage: $(get_response_time "$PRODUCTION_URL")"
93+
echo -e " API Health: $(get_response_time "$API_BASE/health")"
94+
echo -e " Camera API: $(get_response_time "$API_BASE/cameras")"
95+
echo ""
96+
97+
# 3. SSL Certificate Status
98+
echo -e "${YELLOW}πŸ”’ SSL Certificate${NC}"
99+
if [ "$PRODUCTION_URL" == "https://"* ]; then
100+
domain=$(echo "$PRODUCTION_URL" | sed 's|https://||')
101+
cert_info=$(echo | openssl s_client -servername "$domain" -connect "$domain:443" 2>/dev/null | openssl x509 -noout -dates 2>/dev/null)
102+
103+
if [ -n "$cert_info" ]; then
104+
expiry=$(echo "$cert_info" | grep notAfter | cut -d= -f2)
105+
if [ -n "$expiry" ]; then
106+
expiry_epoch=$(date -d "$expiry" +%s 2>/dev/null || date -j -f "%b %d %H:%M:%S %Y %Z" "$expiry" +%s)
107+
current_epoch=$(date +%s)
108+
days_remaining=$(( (expiry_epoch - current_epoch) / 86400 ))
109+
110+
if [ $days_remaining -gt 30 ]; then
111+
echo -e " ${GREEN}βœ“${NC} Valid for $days_remaining days"
112+
elif [ $days_remaining -gt 7 ]; then
113+
echo -e " ${YELLOW}⚠${NC} Expires in $days_remaining days"
114+
else
115+
echo -e " ${RED}βœ—${NC} Expires in $days_remaining days!"
116+
fi
117+
echo -e " Expiry: $expiry"
118+
fi
119+
else
120+
echo -e " ${YELLOW}⚠${NC} Unable to check certificate"
121+
fi
122+
else
123+
echo -e " ${YELLOW}⚠${NC} Not using HTTPS"
124+
fi
125+
echo ""
126+
127+
# 4. GitHub Actions
128+
check_github_actions
129+
130+
# 5. Database Status (via API)
131+
echo -e "${YELLOW}πŸ—„οΈ Database Status${NC}"
132+
db_response=$(curl -s "$API_BASE/cameras" --max-time 5 2>/dev/null)
133+
if [ -n "$db_response" ]; then
134+
if [[ "$db_response" == *"["* ]]; then
135+
camera_count=$(echo "$db_response" | jq 'length' 2>/dev/null || echo "0")
136+
echo -e " ${GREEN}βœ“${NC} Connected (${camera_count} cameras configured)"
137+
else
138+
echo -e " ${GREEN}βœ“${NC} Connected"
139+
fi
140+
else
141+
echo -e " ${RED}βœ—${NC} Unable to verify database connection"
142+
fi
143+
echo ""
144+
145+
# 6. Deployment Information
146+
echo -e "${YELLOW}πŸ“¦ Deployment Information${NC}"
147+
echo -e " Production URL: $PRODUCTION_URL"
148+
echo -e " API Base: $API_BASE"
149+
echo -e " GitHub Repo: https://github.com/$GITHUB_REPO"
150+
echo -e " Actions: https://github.com/$GITHUB_REPO/actions"
151+
echo ""
152+
153+
# 7. Quick Actions
154+
echo -e "${YELLOW}πŸš€ Quick Actions${NC}"
155+
echo -e " Deploy: ${BLUE}git push origin main${NC}"
156+
echo -e " Monitor: ${BLUE}gh run watch -R $GITHUB_REPO${NC}"
157+
echo -e " Logs: ${BLUE}ssh deploy@derail.me 'pm2 logs chittypro-streamlink'${NC}"
158+
echo -e " Restart: ${BLUE}ssh deploy@derail.me 'pm2 restart chittypro-streamlink'${NC}"
159+
echo -e " Server Status: ${BLUE}ssh deploy@derail.me 'pm2 status'${NC}"
160+
echo ""
161+
162+
# 8. System Summary
163+
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
164+
all_healthy=true
165+
if ! check_status "$PRODUCTION_URL" "" &>/dev/null; then
166+
all_healthy=false
167+
fi
168+
169+
if [ "$all_healthy" = true ]; then
170+
echo -e "${GREEN} βœ… All Systems Operational ${NC}"
171+
else
172+
echo -e "${RED} ⚠️ Some Services Need Attention ${NC}"
173+
fi
174+
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
175+
echo ""
176+
echo "Last checked: $(date '+%Y-%m-%d %H:%M:%S %Z')"

0 commit comments

Comments
Β (0)