Files
qr-code_manager/DOMAIN_SETUP.md
ske087 264a81652a 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
2025-07-16 17:49:10 -04:00

2.5 KiB

QR Code Manager - Domain Setup Guide

1. Install Nginx

sudo apt update
sudo apt install nginx

2. Create Nginx Configuration

sudo nano /etc/nginx/sites-available/qr.moto-adv.com

Add this configuration:

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

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

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

sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d qr.moto-adv.com

Testing Your Setup

  1. Test locally first:

    curl http://localhost:8066
    # Should redirect to /login
    
  2. Test domain (after DNS is configured):

    curl -H "Host: qr.moto-adv.com" http://localhost:8066
    
  3. Access the dashboard:

Current Working Credentials

Admin Login:

Health Check

Your app includes a health endpoint: http://localhost:8066/health

Troubleshooting

  1. Check container status:

    docker compose ps
    docker compose logs qr-manager
    
  2. Check port binding:

    netstat -tulpn | grep 8066
    
  3. Test internal connectivity:

    docker exec -it qr-code-manager curl http://localhost:5000/health