quantumtaskai-caprover/start-dokploy.sh
thecyberlearn 5b4bc80b03 Fix Dokploy bad gateway issue
- Fix ALLOWED_HOSTS configuration in dokploy.json (set to *)
- Update production_settings.py to respect SECURE_SSL_REDIRECT environment variable
- Change startup script to use netcop_hub.production_settings instead of production_https_settings
- Add proper environment variable handling for SSL and CSRF settings
- Resolve SSL redirect conflicts between Dokploy proxy and Django settings
2025-09-05 10:10:02 +05:30

37 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Dokploy startup script
set -e # Exit on any error
echo "🚀 Starting Quantum Tasks AI on Dokploy"
echo "======================================="
# Run database migrations
echo "📄 Running database migrations..."
DJANGO_SETTINGS_MODULE=netcop_hub.production_settings python manage.py migrate --noinput
# Create cache table if needed
echo "🗄️ Ensuring cache table exists..."
DJANGO_SETTINGS_MODULE=netcop_hub.production_settings python manage.py createcachetable || true
# Check if we can access the database
echo "🔍 Testing database connection..."
DJANGO_SETTINGS_MODULE=netcop_hub.production_settings python manage.py check --database default
# Start the application
echo "🌐 Starting gunicorn server on port 3000..."
echo "Health check endpoint: /health/"
echo "🔒 SSL redirect: $SECURE_SSL_REDIRECT"
echo "🌐 Allowed hosts: $ALLOWED_HOSTS"
echo "======================================="
DJANGO_SETTINGS_MODULE=netcop_hub.production_settings exec gunicorn netcop_hub.wsgi:application
--bind 0.0.0.0:3000 \
--workers 2 \
--timeout 120 \
--max-requests 1000 \
--preload \
--log-level info \
--access-logfile - \
--error-logfile -