Deployment Options
The Furniture Store Backend is a Flask application that can be deployed using various methods depending on your infrastructure requirements.Traditional Server Deployment
Deploy directly on a Linux server using a WSGI server (Gunicorn or uWSGI) behind a reverse proxy like Nginx. This approach provides:- Full control over the server environment
- Direct access to system resources
- Custom security configurations
- Cost-effective for dedicated infrastructure
Docker Containerization
Package the application in a Docker container for consistent deployment across environments:Cloud Platform Deployment
AWS Elastic Beanstalk- Automated capacity provisioning
- Load balancing and auto-scaling
- Integrated with RDS for database
- Simple deployment with
eb deploy
- Serverless container deployment
- Automatic scaling to zero
- Pay-per-use pricing model
- Built-in HTTPS and custom domains
- Git-based deployment workflow
- Built-in MySQL add-ons
- Easy environment variable management
- Automatic HTTPS
Environment Considerations
Development Environment
- Uses Flask development server (
flask runorpython run.py) - Debug mode enabled for detailed error messages
- SQLite or local MySQL database
- Default SECRET_KEY allowed (see config.py:27)
Staging Environment
- Mirrors production configuration
- Uses production-grade WSGI server
- Separate database instance
- Real SECRET_KEY required
- Testing ground for deployment procedures
Production Environment
- Never use Flask development server
- Production WSGI server (Gunicorn/uWSGI) required
- Secure SECRET_KEY mandatory (see config.py:22-27)
- Production database with backups
- HTTPS enforced
- Environment variables secured
- Logging and monitoring enabled
Database Deployment
Database Configuration
The application uses SQLAlchemy with MySQL/PyMySQL (see config.py:15-16):Production Database Setup
Provision Database
Create a MySQL database instance:
- Cloud providers: AWS RDS, Google Cloud SQL, Azure Database
- Self-hosted: MySQL 8.0+ on dedicated server
- Minimum 2GB RAM recommended for production
Configure Security
- Create dedicated database user with limited privileges
- Enable SSL/TLS connections
- Restrict network access to application servers only
- Set strong password (minimum 16 characters)
Database Connection Pool
For production, configure SQLAlchemy connection pooling in config.py:Migration Strategy
- Development: Run migrations manually with
flask db upgrade - Production: Include migration step in deployment pipeline
- Rollback plan: Test
flask db downgradeprocedures - Backup first: Always backup database before migrations
Security Checklist
Before deploying to production, verify these security requirements:Environment Variables
Environment Variables
SECRET_KEY set to cryptographically random value
Database credentials stored in environment variables
.env file excluded from version control
No hardcoded secrets in code
Application Security
Application Security
FLASK_ENV set to production (config.py:25)
Debug mode disabled
CSRF protection enabled (uses flask_wtf.csrf - see app/init.py:27)
HTTPS enforced for all traffic
Secure session cookies configured
Database Security
Database Security
Database user has minimum required privileges
SSL/TLS enabled for database connections
Database not publicly accessible
Regular automated backups configured
Server Security
Server Security
Firewall configured (only necessary ports open)
SSH key-based authentication only
Regular security updates applied
Fail2ban or similar intrusion prevention
Monitoring
Monitoring
Application logging configured
Error tracking system integrated
Performance monitoring enabled
Uptime monitoring configured
Deployment Workflow
Recommended deployment workflow:- Code commit: Push changes to version control
- Run tests: Automated testing pipeline
- Build: Create deployment package or container
- Staging deployment: Deploy to staging environment
- Integration tests: Verify functionality in staging
- Production deployment: Deploy to production servers
- Health check: Verify application is running
- Monitor: Continuous monitoring for issues
Next Steps
Production Setup
Detailed production deployment guide with WSGI and Nginx configuration
Environment Setup
Configure environment variables and application settings