Checklist and recommendations for deploying FARP in production.
- Change default database passwords
- Use strong, unique passwords
- Configure firewall rules
- Enable SSL/TLS for API
- Implement API authentication (OAuth2/JWT)
- Restrict CORS origins
- Review pgAdmin access
- Set
API_DEBUG=false - Configure production
LOG_LEVEL - Set appropriate
RISK_FREE_RATE - Review scheduler intervals
- Use managed PostgreSQL (AWS RDS, Cloud SQL)
- Enable connection pooling
- Configure backups
- Set up monitoring
Add OAuth2/JWT authentication:
# Example: Add to src/api/main.py
from fastapi.security import OAuth2PasswordBearer
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
@app.middleware("http")
async def authenticate(request, call_next):
# Implement authentication
passRestrict allowed origins:
app.add_middleware(
CORSMiddleware,
allow_origins=["https://your-domain.com"],
allow_credentials=True,
allow_methods=["GET", "POST", "DELETE"],
allow_headers=["Authorization", "Content-Type"],
)Use a reverse proxy (nginx, Traefik) for TLS termination.
# PostgreSQL tuning
shared_buffers = 256MB
work_mem = 16MB
maintenance_work_mem = 64MB
effective_cache_size = 768MBAdjust in connection.py:
engine = create_engine(
url,
pool_size=20,
max_overflow=30,
pool_pre_ping=True
)Consider Redis for:
- FX rate caching
- Price data caching
- Session management
curl https://your-api/health- API response times
- Database connections
- Scheduler job status
- Error rates
Configure structured logging:
LOG_LEVEL=WARNING
LOG_FORMAT=json# Daily backup
pg_dump -U farp farp_db | gzip > backup_$(date +%Y%m%d).sql.gz
# Point-in-time recovery
# Configure WAL archiving for PITR| Frequency | Type | Retention |
|---|---|---|
| Hourly | WAL | 24 hours |
| Daily | Full | 30 days |
| Weekly | Full | 1 year |
- Deploy multiple API instances
- Use load balancer
- Implement health checks
- Use managed HA database
- Configure read replicas
- Set up failover
# Database
POSTGRES_HOST=your-db-host.rds.amazonaws.com
POSTGRES_PASSWORD=<secure-password>
# API
API_DEBUG=false
API_HOST=0.0.0.0
# Logging
LOG_LEVEL=WARNING
LOG_FORMAT=json
# Scheduler
SCHEDULER_ENABLED=true- Infrastructure provisioned
- Database migrated
- Environment configured
- SSL certificates installed
- Authentication enabled
- Monitoring configured
- Backups scheduled
- Load testing completed
- Documentation updated
- Docker Deployment - Container setup
- Configuration - All settings