Skip to content

Commit 0a6a2f1

Browse files
committed
Updated Docs
1 parent d5f281f commit 0a6a2f1

File tree

10 files changed

+3870
-769
lines changed

10 files changed

+3870
-769
lines changed

README.md

Lines changed: 166 additions & 513 deletions
Large diffs are not rendered by default.

docs/QUALITY_CHECKS.md

Lines changed: 495 additions & 0 deletions
Large diffs are not rendered by default.

docs/README.md

Lines changed: 122 additions & 256 deletions
Large diffs are not rendered by default.

docs/api/README.md

Lines changed: 523 additions & 0 deletions
Large diffs are not rendered by default.

docs/deployment/README.md

Lines changed: 387 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,387 @@
1+
# Deployment Guide
2+
3+
> **Complete guide for deploying FFprobe API in development, production, and enterprise environments**
4+
5+
## Overview
6+
7+
FFprobe API supports multiple deployment strategies to meet different scales and requirements:
8+
9+
- **Development**: Quick setup for testing and development
10+
- **Production**: Medium-scale deployment with monitoring
11+
- **Enterprise**: High-volume deployment with clustering and advanced monitoring
12+
13+
## Quick Start
14+
15+
### Prerequisites
16+
17+
- Docker and Docker Compose
18+
- 4GB+ RAM, 2+ CPU cores (minimum)
19+
- 10GB+ available disk space
20+
21+
### Basic Deployment
22+
23+
```bash
24+
# Clone repository
25+
git clone https://github.com/rendiffdev/ffprobe-api.git
26+
cd ffprobe-api
27+
28+
# Start all services
29+
docker compose up -d
30+
31+
# Verify deployment
32+
curl http://localhost:8080/health
33+
```
34+
35+
## Deployment Options
36+
37+
### 1. Development Setup
38+
39+
**Best for**: Local development, testing, small-scale usage
40+
41+
```bash
42+
# Basic services only
43+
docker compose up -d
44+
45+
# Verify services
46+
docker compose ps
47+
```
48+
49+
**Resources**: 4GB RAM, 2 CPU cores, 10GB storage
50+
51+
### 2. Production Setup
52+
53+
**Best for**: Medium-scale production deployments
54+
55+
```bash
56+
# Production configuration with monitoring
57+
docker compose -f compose.yml -f compose.production.yml up -d
58+
59+
# Scale API instances
60+
docker compose -f compose.yml -f compose.production.yml up -d --scale ffprobe-api=2
61+
```
62+
63+
**Resources**: 8GB RAM, 4 CPU cores, 50GB storage
64+
**Features**: Load balancing, monitoring, backup automation
65+
66+
### 3. Enterprise Setup
67+
68+
**Best for**: High-volume production with advanced monitoring
69+
70+
```bash
71+
# Enterprise deployment with full monitoring stack
72+
docker compose -f compose.yml -f compose.enterprise.yml up -d \
73+
--scale ffprobe-api=3 \
74+
--scale ffprobe-worker=5 \
75+
--scale llm-service=2
76+
```
77+
78+
**Resources**: 16GB+ RAM, 8+ CPU cores, 100GB+ storage
79+
**Features**: Clustering, advanced monitoring, alerting, backup automation
80+
81+
## Performance Scaling
82+
83+
### Resource Requirements
84+
85+
| Deployment | RAM | CPU | Storage | Concurrent Jobs | Throughput |
86+
|------------|-----|-----|---------|-----------------|------------|
87+
| Development | 4GB | 2 cores | 10GB | 2-5 | 10-50 req/min |
88+
| Production | 8GB | 4 cores | 50GB | 5-15 | 60-200 req/min |
89+
| Enterprise | 16GB+ | 8+ cores | 100GB+ | 15-50 | 200-1000 req/min |
90+
91+
### Scaling Configuration
92+
93+
```bash
94+
# Horizontal scaling
95+
docker compose up -d --scale ffprobe-api=3
96+
97+
# Resource limits (production)
98+
docker compose -f compose.yml -f compose.production.yml up -d
99+
100+
# Enterprise with monitoring
101+
docker compose -f compose.yml -f compose.enterprise.yml up -d
102+
```
103+
104+
## Environment Configuration
105+
106+
### Required Environment Variables
107+
108+
```bash
109+
# Server Configuration
110+
API_PORT=8080
111+
API_HOST=0.0.0.0
112+
BASE_URL=http://localhost:8080
113+
114+
# Database Configuration
115+
POSTGRES_HOST=postgres
116+
POSTGRES_PORT=5432
117+
POSTGRES_DB=ffprobe_api
118+
POSTGRES_USER=postgres
119+
POSTGRES_PASSWORD=your-secure-password
120+
121+
# Authentication
122+
API_KEY=your-32-char-api-key-here
123+
JWT_SECRET=your-32-char-jwt-secret-here
124+
```
125+
126+
### Optional Configuration
127+
128+
```bash
129+
# LLM Integration
130+
ENABLE_LOCAL_LLM=true
131+
OLLAMA_URL=http://ollama:11434
132+
OLLAMA_MODEL=mistral:7b
133+
OPENROUTER_API_KEY=your-openrouter-key
134+
135+
# Storage
136+
MAX_FILE_SIZE=53687091200 # 50GB
137+
UPLOAD_DIR=/app/uploads
138+
REPORTS_DIR=/app/reports
139+
140+
# Security
141+
ENABLE_RATE_LIMIT=true
142+
RATE_LIMIT_PER_MINUTE=60
143+
ALLOWED_ORIGINS=*
144+
```
145+
146+
## Cloud Deployment
147+
148+
### Docker Compose (Recommended)
149+
150+
```yaml
151+
version: '3.8'
152+
services:
153+
ffprobe-api:
154+
image: ffprobe-api:latest
155+
ports:
156+
- "8080:8080"
157+
environment:
158+
- POSTGRES_HOST=postgres
159+
- REDIS_HOST=redis
160+
depends_on:
161+
- postgres
162+
- redis
163+
164+
postgres:
165+
image: postgres:15
166+
environment:
167+
POSTGRES_DB: ffprobe_api
168+
POSTGRES_PASSWORD: secure-password
169+
volumes:
170+
- postgres_data:/var/lib/postgresql/data
171+
172+
redis:
173+
image: redis:7-alpine
174+
volumes:
175+
- redis_data:/data
176+
177+
volumes:
178+
postgres_data:
179+
redis_data:
180+
```
181+
182+
### Kubernetes Deployment
183+
184+
```yaml
185+
apiVersion: apps/v1
186+
kind: Deployment
187+
metadata:
188+
name: ffprobe-api
189+
spec:
190+
replicas: 3
191+
selector:
192+
matchLabels:
193+
app: ffprobe-api
194+
template:
195+
metadata:
196+
labels:
197+
app: ffprobe-api
198+
spec:
199+
containers:
200+
- name: ffprobe-api
201+
image: ffprobe-api:latest
202+
ports:
203+
- containerPort: 8080
204+
env:
205+
- name: POSTGRES_HOST
206+
value: "postgres-service"
207+
resources:
208+
requests:
209+
memory: "2Gi"
210+
cpu: "1000m"
211+
limits:
212+
memory: "4Gi"
213+
cpu: "2000m"
214+
```
215+
216+
## Cloud Provider Guides
217+
218+
### AWS Deployment
219+
220+
- **ECS**: Container orchestration with auto-scaling
221+
- **EKS**: Kubernetes-based deployment
222+
- **EC2**: Traditional server deployment
223+
- **RDS**: Managed PostgreSQL database
224+
- **ElastiCache**: Managed Redis
225+
226+
### Google Cloud Platform
227+
228+
- **Cloud Run**: Serverless container deployment
229+
- **GKE**: Kubernetes Engine deployment
230+
- **Compute Engine**: VM-based deployment
231+
- **Cloud SQL**: Managed PostgreSQL
232+
- **Memorystore**: Managed Redis
233+
234+
### Microsoft Azure
235+
236+
- **Container Instances**: Simple container deployment
237+
- **AKS**: Azure Kubernetes Service
238+
- **App Service**: Platform-as-a-Service deployment
239+
- **PostgreSQL**: Managed database service
240+
- **Redis Cache**: Managed Redis service
241+
242+
## Security Considerations
243+
244+
### Production Security Checklist
245+
246+
- [ ] Change default API keys and JWT secrets
247+
- [ ] Enable HTTPS with SSL/TLS certificates
248+
- [ ] Configure firewall rules and network security
249+
- [ ] Set up proper backup and disaster recovery
250+
- [ ] Enable monitoring and alerting
251+
- [ ] Configure log rotation and retention
252+
- [ ] Implement proper access controls
253+
- [ ] Regular security updates and patches
254+
255+
### Network Security
256+
257+
```bash
258+
# Firewall configuration
259+
ufw allow 22 # SSH
260+
ufw allow 80 # HTTP
261+
ufw allow 443 # HTTPS
262+
ufw deny 8080 # Block direct API access (use reverse proxy)
263+
```
264+
265+
### Reverse Proxy Configuration
266+
267+
```nginx
268+
# Nginx configuration
269+
server {
270+
listen 80;
271+
server_name your-domain.com;
272+
273+
location / {
274+
proxy_pass http://localhost:8080;
275+
proxy_set_header Host $host;
276+
proxy_set_header X-Real-IP $remote_addr;
277+
}
278+
}
279+
```
280+
281+
## Monitoring and Observability
282+
283+
### Health Checks
284+
285+
```bash
286+
# Basic health check
287+
curl http://localhost:8080/health
288+
289+
# Detailed system status
290+
curl http://localhost:8080/api/v1/system/status
291+
```
292+
293+
### Prometheus Metrics
294+
295+
Available at `http://localhost:8080/metrics`:
296+
297+
- Request rates and response times
298+
- Processing queue status
299+
- Database connection health
300+
- System resource utilization
301+
302+
### Logging
303+
304+
```bash
305+
# View application logs
306+
docker compose logs -f ffprobe-api
307+
308+
# Monitor specific service
309+
docker compose logs -f postgres
310+
```
311+
312+
## Backup and Recovery
313+
314+
### Database Backup
315+
316+
```bash
317+
# Create backup
318+
docker compose exec postgres pg_dump -U postgres ffprobe_api > backup.sql
319+
320+
# Restore backup
321+
docker compose exec -T postgres psql -U postgres ffprobe_api < backup.sql
322+
```
323+
324+
### Configuration Backup
325+
326+
```bash
327+
# Backup configuration
328+
cp .env .env.backup
329+
tar -czf config-backup.tar.gz docker/configs/
330+
```
331+
332+
## Troubleshooting
333+
334+
### Common Issues
335+
336+
1. **Port conflicts**: Ensure ports 8080, 5432, 6379 are available
337+
2. **Memory issues**: Increase Docker memory allocation
338+
3. **Permission errors**: Check file permissions and Docker user
339+
4. **Database connection**: Verify PostgreSQL service is running
340+
341+
### Performance Tuning
342+
343+
```bash
344+
# Monitor resource usage
345+
docker stats
346+
347+
# Check processing queue
348+
curl http://localhost:8080/api/v1/batch/status
349+
350+
# Database performance
351+
docker compose exec postgres psql -U postgres -c "SELECT * FROM pg_stat_activity;"
352+
```
353+
354+
## Migration and Updates
355+
356+
### Version Updates
357+
358+
```bash
359+
# Pull latest images
360+
docker compose pull
361+
362+
# Restart with new version
363+
docker compose up -d
364+
365+
# Verify update
366+
curl http://localhost:8080/health
367+
```
368+
369+
### Database Migrations
370+
371+
Database migrations run automatically on startup. For manual migration:
372+
373+
```bash
374+
# Run migrations manually
375+
docker compose exec ffprobe-api ./migrate -path ./migrations -database "postgres://..." up
376+
```
377+
378+
---
379+
380+
## Next Steps
381+
382+
- [Configuration Reference](configuration.md)
383+
- [Monitoring Setup](monitoring.md)
384+
- [Production Checklist](production-checklist.md)
385+
- [Troubleshooting Guide](../troubleshooting/README.md)
386+
387+
*For support, see [GitHub Issues](https://github.com/rendiffdev/ffprobe-api/issues)*

0 commit comments

Comments
 (0)