Skip to content

Commit 060d8d8

Browse files
Add production requirements, deployment docs, and Docker improvements
Co-authored-by: xploitoverload <184857390+xploitoverload@users.noreply.github.com>
1 parent e9d185f commit 060d8d8

5 files changed

Lines changed: 177 additions & 9 deletions

File tree

Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ WORKDIR /app
1111
RUN apt-get update && apt-get install -y --no-install-recommends \
1212
gcc \
1313
g++ \
14-
cmake \
1514
libpq-dev \
1615
&& rm -rf /var/lib/apt/lists/*
1716

18-
# Copy requirements first for better caching
19-
COPY requirements.txt .
17+
# Copy production requirements first for better caching
18+
COPY requirements-prod.txt .
2019

2120
# Install Python dependencies
22-
RUN pip install --no-cache-dir --user -r requirements.txt
21+
RUN pip install --no-cache-dir --user -r requirements-prod.txt
2322

2423
# Stage 2: Runtime stage
2524
FROM python:3.11-slim
@@ -41,6 +40,7 @@ WORKDIR /app
4140
# Install runtime dependencies only
4241
RUN apt-get update && apt-get install -y --no-install-recommends \
4342
libpq5 \
43+
curl \
4444
&& rm -rf /var/lib/apt/lists/*
4545

4646
# Copy Python dependencies from builder
@@ -60,7 +60,7 @@ EXPOSE 8000
6060

6161
# Health check
6262
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
63-
CMD python -c "import requests; requests.get('http://localhost:8000/health', timeout=5)" || exit 1
63+
CMD curl -f http://localhost:8000/health || exit 1
6464

6565
# Run the application using gunicorn
6666
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "4", "--threads", "2", "--timeout", "120", "--access-logfile", "-", "--error-logfile", "-", "run:app"]

QUICK_DEPLOY.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# 🚀 Quick Deployment Guide
2+
3+
This project is now configured for easy deployment to multiple platforms!
4+
5+
## ✅ What's Been Added
6+
7+
### 1. Docker Support
8+
- **Dockerfile** - Multi-stage production-ready Docker image
9+
- **docker-compose.yml** - Complete stack with Redis
10+
- **.dockerignore** - Optimized build context
11+
- **requirements-prod.txt** - Streamlined production dependencies
12+
13+
### 2. Platform Configurations
14+
- **Procfile** - Heroku deployment configuration
15+
- **render.yaml** - Render.com Blueprint
16+
- **runtime.txt** - Python version specification
17+
18+
### 3. CI/CD Workflows
19+
- **.github/workflows/ci-cd.yml** - Automated testing, security scanning, and deployment
20+
- **.github/workflows/docker-publish.yml** - Docker image building and publishing
21+
22+
### 4. Documentation
23+
- **DEPLOYMENT.md** - Comprehensive deployment guide for all platforms
24+
- **CONTRIBUTING.md** - Guidelines for contributors
25+
- **Updated README.md** - Public project information and badges
26+
27+
## 🎯 Deployment Options
28+
29+
### Option 1: Render.com (Easiest - Free Tier)
30+
[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy)
31+
32+
1. Click the button above
33+
2. Connect your GitHub repository
34+
3. Render automatically uses `render.yaml`
35+
4. Your app will be live in ~5 minutes!
36+
37+
### Option 2: Heroku (Free Dyno Hours)
38+
```bash
39+
heroku create your-app-name
40+
git push heroku main
41+
```
42+
43+
### Option 3: Docker (Self-Hosted)
44+
```bash
45+
docker-compose up -d
46+
# Access at http://localhost:8000
47+
```
48+
49+
### Option 4: Railway.app
50+
```bash
51+
railway init
52+
railway up
53+
```
54+
55+
## 📝 Environment Variables Required
56+
57+
| Variable | Required | Default | Description |
58+
|----------|----------|---------|-------------|
59+
| `SECRET_KEY` | Yes | - | Generate with `python -c "import secrets; print(secrets.token_hex(32))"` |
60+
| `DATABASE_URL` | No | `sqlite:///instance/app.db` | Database connection string |
61+
| `FLASK_ENV` | No | `production` | Environment mode |
62+
| `REDIS_URL` | No | - | Redis connection (optional, for caching) |
63+
64+
## 🔒 Security Notes
65+
66+
1. **Always set a secure SECRET_KEY** in production
67+
2. Use HTTPS (automatic on Render, Heroku, Railway)
68+
3. Change default admin credentials on first login
69+
4. Enable Redis for rate limiting in production
70+
71+
## 📊 CI/CD Pipeline
72+
73+
The project includes automated workflows that:
74+
- ✅ Run tests on Python 3.9, 3.10, and 3.11
75+
- ✅ Perform security scans (Bandit, Safety)
76+
- ✅ Lint code with flake8
77+
- ✅ Build and test Docker images
78+
- ✅ Deploy automatically on merge to main
79+
80+
## 🌐 Making Your Deployment Public
81+
82+
Once deployed:
83+
1. The repository is public at: https://github.com/xploitoverload/project-management
84+
2. Anyone can fork and deploy their own instance
85+
3. Contributions are welcome via Pull Requests
86+
4. Issues can be reported on GitHub
87+
88+
## 🚀 Next Steps
89+
90+
1. **Deploy**: Choose a platform and deploy
91+
2. **Configure**: Set environment variables
92+
3. **Initialize**: Create admin account
93+
4. **Use**: Start managing projects!
94+
95+
## 🛠️ Troubleshooting
96+
97+
If deployment fails:
98+
1. Check environment variables are set correctly
99+
2. Review platform logs for specific errors
100+
3. Ensure all required dependencies are in requirements-prod.txt
101+
4. See DEPLOYMENT.md for detailed troubleshooting
102+
103+
## 📚 Learn More
104+
105+
- [Full Deployment Guide](DEPLOYMENT.md) - Detailed instructions for each platform
106+
- [Contributing Guide](CONTRIBUTING.md) - How to contribute to the project
107+
- [Project README](README.md) - Complete project documentation
108+
109+
---
110+
111+
**Ready to deploy?** Pick a platform above and get started! 🎉

docker-compose.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ services:
1313
environment:
1414
- FLASK_ENV=production
1515
- SECRET_KEY=${SECRET_KEY:-change-this-secret-key-in-production}
16-
- DATABASE_URL=${DATABASE_URL:-sqlite:///instance/app.db}
16+
- DATABASE_URL=${DATABASE_URL:-sqlite:////app/instance/app.db}
1717
- REDIS_URL=redis://redis:6379/0
1818
- PORT=8000
19+
- FLASK_APP=run.py
1920
volumes:
2021
- ./instance:/app/instance
2122
- ./uploads:/app/uploads
@@ -25,7 +26,7 @@ services:
2526
networks:
2627
- app-network
2728
healthcheck:
28-
test: ["CMD", "python", "-c", "import requests; requests.get('http://localhost:8000/health', timeout=5)"]
29+
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
2930
interval: 30s
3031
timeout: 10s
3132
retries: 3

requirements-prod.txt

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Production Requirements (Core Dependencies Only)
2+
# For full development dependencies, see requirements.txt
3+
4+
# Core Framework
5+
Flask==3.0.0
6+
Flask-SQLAlchemy==3.1.1
7+
Werkzeug==3.1.5
8+
SQLAlchemy==2.0.23
9+
10+
# Security
11+
cryptography==44.0.1
12+
bleach==6.1.0
13+
argon2-cffi==23.1.0
14+
Flask-WTF==1.2.1
15+
Flask-Talisman==1.1.0
16+
Flask-Login==0.6.3
17+
Flask-Limiter==3.5.0
18+
19+
# Performance & Utilities
20+
Flask-Compress==1.14
21+
python-dotenv==1.0.0
22+
psutil==5.9.8
23+
24+
# Two-Factor Authentication & QR Codes
25+
pyotp==2.9.0
26+
qrcode==8.2
27+
pillow==12.1.0
28+
29+
# Database Migrations
30+
Flask-Migrate==4.0.5
31+
alembic==1.13.1
32+
33+
# Caching
34+
Flask-Caching==2.3.0
35+
redis==5.0.1
36+
37+
# API Documentation
38+
Flask-CORS==4.0.0
39+
40+
# Email & Notifications
41+
Flask-Mail==0.9.1
42+
python-slugify==8.0.1
43+
44+
# Production Server
45+
gunicorn==22.0.0
46+
47+
# Monitoring & Logging
48+
python-json-logger==2.0.7
49+
50+
# API Request Validation
51+
marshmallow==3.20.1
52+
marshmallow-sqlalchemy==0.29.0
53+
54+
# Data Export
55+
openpyxl==3.1.2
56+
reportlab==4.0.7

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ qrcode==8.2
2424
pillow==12.1.0
2525

2626
# Facial Recognition (optional)
27-
face-recognition==1.3.5
27+
face-recognition==1.3.0
2828
numpy==1.26.3
2929
opencv-python==4.8.1.78
3030

@@ -46,7 +46,7 @@ flask-socketio==5.3.5
4646
python-socketio==5.9.0
4747
python-engineio==4.8.0
4848
graphene==3.3
49-
graphene-sqlalchemy==3.0.0
49+
graphene-sqlalchemy==3.0.0rc2
5050

5151
# Email & Notifications
5252
Flask-Mail==0.9.1

0 commit comments

Comments
 (0)