resumebuilder / gunicorn_config.py
sakthi07's picture
modified Dockerfile readme.md and app.py
b3d3e31
import multiprocessing
import os
from app import create_tables_if_needed
# Server socket
bind = "0.0.0.0:7860"
# Worker processes
workers = 1
worker_class = "sync"
worker_connections = 1000
# Timeout
timeout = 120
keepalive = 2
# Max requests
max_requests = 1000
max_requests_jitter = 50
# Logging
accesslog = "-"
errorlog = "-"
loglevel = "info"
# Process name
proc_name = "resumebuilder"
# Preload app - this ensures database initialization happens once
preload_app = True
# Hook function to run after app is loaded
def on_starting(server):
"""Called when gunicorn starts"""
pass
def when_ready(server):
"""Called when gunicorn is ready"""
# Initialize database tables when ready
try:
print("Initializing database tables...")
create_tables_if_needed()
print("Database initialization completed")
except Exception as e:
print(f"Database initialization error: {e}")
def on_reload(server):
"""Called when gunicorn reloads"""
pass
# Environment variables
raw_env = [
"PORT=7860",
"PYTHONUNBUFFERED=1",
]
# Security
limit_request_line = 4096
limit_request_fields = 100
limit_request_field_size = 8190