Production deployment fixes and enhancements
- Added environment variable loading with python-dotenv - Fixed Docker session permissions by using /tmp directory - Updated .dockerignore to include .env file properly - Enhanced docker-compose.yml with env_file directive - Fixed Gunicorn configuration for Docker compatibility - Updated README.md with comprehensive deployment docs - Cleaned up debug logging from API routes - Added DOMAIN_SETUP.md for reverse proxy guidance - All production issues resolved and tested working - Application now accessible at qr.moto-adv.com
This commit is contained in:
113
DOMAIN_SETUP.md
Normal file
113
DOMAIN_SETUP.md
Normal file
@@ -0,0 +1,113 @@
|
||||
# QR Code Manager - Domain Setup Guide
|
||||
|
||||
## Option 1: Using Nginx Reverse Proxy (Recommended)
|
||||
|
||||
### 1. Install Nginx
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install nginx
|
||||
```
|
||||
|
||||
### 2. Create Nginx Configuration
|
||||
```bash
|
||||
sudo nano /etc/nginx/sites-available/qr.moto-adv.com
|
||||
```
|
||||
|
||||
Add this configuration:
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name qr.moto-adv.com;
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:8066;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# Handle WebSocket connections if needed
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Enable the Site
|
||||
```bash
|
||||
sudo ln -s /etc/nginx/sites-available/qr.moto-adv.com /etc/nginx/sites-enabled/
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
```
|
||||
|
||||
### 4. DNS Configuration
|
||||
Make sure your domain `qr.moto-adv.com` points to your server's IP address:
|
||||
- Add an A record: `qr.moto-adv.com -> YOUR_SERVER_IP`
|
||||
|
||||
## Option 2: Direct Docker Port Mapping
|
||||
|
||||
### Modify docker-compose.yml
|
||||
```yaml
|
||||
services:
|
||||
qr-manager:
|
||||
# ... other config
|
||||
ports:
|
||||
- "80:5000" # Map port 80 directly to container
|
||||
```
|
||||
|
||||
Then access via `http://qr.moto-adv.com` (without port number)
|
||||
|
||||
## Option 3: SSL/HTTPS Setup (Production)
|
||||
|
||||
### Using Certbot for Let's Encrypt SSL
|
||||
```bash
|
||||
sudo apt install certbot python3-certbot-nginx
|
||||
sudo certbot --nginx -d qr.moto-adv.com
|
||||
```
|
||||
|
||||
## Testing Your Setup
|
||||
|
||||
1. **Test locally first:**
|
||||
```bash
|
||||
curl http://localhost:8066
|
||||
# Should redirect to /login
|
||||
```
|
||||
|
||||
2. **Test domain (after DNS is configured):**
|
||||
```bash
|
||||
curl -H "Host: qr.moto-adv.com" http://localhost:8066
|
||||
```
|
||||
|
||||
3. **Access the dashboard:**
|
||||
- Open: http://qr.moto-adv.com (or http://localhost:8066)
|
||||
- Username: ske087
|
||||
- Password: Matei@123
|
||||
|
||||
## Current Working Credentials
|
||||
|
||||
✅ **Admin Login:**
|
||||
- **Username:** `ske087`
|
||||
- **Password:** `Matei@123`
|
||||
- **URL:** http://localhost:8066/login
|
||||
|
||||
## Health Check
|
||||
Your app includes a health endpoint: http://localhost:8066/health
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
1. **Check container status:**
|
||||
```bash
|
||||
docker compose ps
|
||||
docker compose logs qr-manager
|
||||
```
|
||||
|
||||
2. **Check port binding:**
|
||||
```bash
|
||||
netstat -tulpn | grep 8066
|
||||
```
|
||||
|
||||
3. **Test internal connectivity:**
|
||||
```bash
|
||||
docker exec -it qr-code-manager curl http://localhost:5000/health
|
||||
```
|
||||
Reference in New Issue
Block a user