Compare commits
3 Commits
cfe4d8b619
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| a76579785f | |||
| 64e22d34fb | |||
| 3cae5feee7 |
@@ -0,0 +1 @@
|
|||||||
|
387857
|
||||||
+20
-52
@@ -2,28 +2,25 @@ import multiprocessing
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
# Server socket
|
# Server socket
|
||||||
bind = "0.0.0.0:5042" # Same port as in your app.py
|
bind = "0.0.0.0:5042"
|
||||||
backlog = 2048
|
backlog = 2048
|
||||||
|
|
||||||
# Worker processes
|
# Worker processes
|
||||||
workers = multiprocessing.cpu_count() * 2 + 1 # Recommended formula for worker count
|
workers = 4
|
||||||
worker_class = "uvicorn.workers.UvicornWorker" # Required for FastAPI
|
worker_class = "uvicorn.workers.UvicornWorker"
|
||||||
worker_connections = 1000
|
worker_connections = 1000
|
||||||
timeout = 30
|
timeout = 120
|
||||||
keepalive = 2
|
keepalive = 2
|
||||||
|
|
||||||
|
# Process naming
|
||||||
|
proc_name = "firefighter"
|
||||||
|
pythonpath = "."
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
accesslog = "logs/access.log"
|
accesslog = "logs/access.log"
|
||||||
errorlog = "logs/error.log"
|
errorlog = "logs/error.log"
|
||||||
loglevel = "info"
|
loglevel = "info"
|
||||||
|
|
||||||
# Process naming
|
|
||||||
proc_name = "fire_fighter_api"
|
|
||||||
|
|
||||||
# SSL (uncomment and configure if using HTTPS)
|
|
||||||
# keyfile = "path/to/keyfile"
|
|
||||||
# certfile = "path/to/certfile"
|
|
||||||
|
|
||||||
# Server mechanics
|
# Server mechanics
|
||||||
daemon = False
|
daemon = False
|
||||||
pidfile = "gunicorn.pid"
|
pidfile = "gunicorn.pid"
|
||||||
@@ -32,46 +29,17 @@ user = None
|
|||||||
group = None
|
group = None
|
||||||
tmp_upload_dir = None
|
tmp_upload_dir = None
|
||||||
|
|
||||||
# Server hooks
|
# Worker lifecycle
|
||||||
def on_starting(server):
|
max_requests = 1000
|
||||||
"""
|
max_requests_jitter = 50
|
||||||
Server startup hook
|
graceful_timeout = 30
|
||||||
"""
|
preload_app = True
|
||||||
# Create logs directory if it doesn't exist
|
|
||||||
os.makedirs("logs", exist_ok=True)
|
|
||||||
|
|
||||||
def post_fork(server, worker):
|
# Debug
|
||||||
"""
|
reload = False
|
||||||
Worker initialization hook
|
reload_engine = "auto"
|
||||||
"""
|
spew = False
|
||||||
server.log.info("Worker spawned (pid: %s)", worker.pid)
|
|
||||||
|
|
||||||
def pre_fork(server, worker):
|
# Server mechanics
|
||||||
"""
|
check_config = False
|
||||||
Pre-fork hook
|
preload_app = True
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def pre_exec(server):
|
|
||||||
"""
|
|
||||||
Pre-exec hook
|
|
||||||
"""
|
|
||||||
server.log.info("Forked child, re-executing.")
|
|
||||||
|
|
||||||
def when_ready(server):
|
|
||||||
"""
|
|
||||||
Server ready hook
|
|
||||||
"""
|
|
||||||
server.log.info("Server is ready. Spawning workers")
|
|
||||||
|
|
||||||
def worker_int(worker):
|
|
||||||
"""
|
|
||||||
Worker interrupt hook
|
|
||||||
"""
|
|
||||||
worker.log.info("worker received INT or QUIT signal")
|
|
||||||
|
|
||||||
def worker_abort(worker):
|
|
||||||
"""
|
|
||||||
Worker abort hook
|
|
||||||
"""
|
|
||||||
worker.log.info("worker received SIGABRT signal")
|
|
||||||
|
|||||||
+2
-13
@@ -3,7 +3,7 @@
|
|||||||
# Configuration
|
# Configuration
|
||||||
REPO_URL="http://owusu:890eccfcea010beb94a0adba246aaf9258330b70@23.29.118.76:3000/owusu/ds-fire-fighter.git"
|
REPO_URL="http://owusu:890eccfcea010beb94a0adba246aaf9258330b70@23.29.118.76:3000/owusu/ds-fire-fighter.git"
|
||||||
APP_DIR="/home/ec2-user/ds-fire-fighter"
|
APP_DIR="/home/ec2-user/ds-fire-fighter"
|
||||||
BRANCH="dev"
|
BRANCH="main"
|
||||||
PYTHON_VERSION="3.11"
|
PYTHON_VERSION="3.11"
|
||||||
WORKERS=4
|
WORKERS=4
|
||||||
THREADS=2
|
THREADS=2
|
||||||
@@ -117,18 +117,7 @@ backlog = 2048
|
|||||||
|
|
||||||
# Worker processes
|
# Worker processes
|
||||||
workers = ${WORKERS}
|
workers = ${WORKERS}
|
||||||
worker_class = SEGMIND_API_KEY="SG_28b00087ea064e64"
|
worker_class = "uvicorn.workers.UvicornWorker"
|
||||||
IMAGEKIT_PRIVATE_KEY="private_BXnyXGjdhBpBs/sU7avdyLwPx1o="
|
|
||||||
IMAGEKIT_PUBLIC_KEY="public_hb1iwGN/UWT+aYg9mMkUQNeFh40="
|
|
||||||
IMAGEKIT_URL_ENDPOINT="6pxd8st0ugi"
|
|
||||||
DEEPAI_API_KEY = "67768bbb-b946-400d-8188-ca21b0506ed8"
|
|
||||||
HEDRA_API_KEY ="sk_hedra_0MeJTqGmZnyt_jAXboOvXUGACTeeGAFuqpjuDU7ZVy5WOkSsM6B9kDe_vI_Dhcnn"
|
|
||||||
API_KEY_ACCESS = "face_forge_sk_test_51NxYz8KJh2LmPqR3vW4tU5w6X7y8Z9A0B1C2D3E4F5G6H7I8J9K0L1M2N3O4P5Q6R7S8T9U0V1W2X3Y4Z"
|
|
||||||
PORT=5000
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
worker_connections = 1000
|
worker_connections = 1000
|
||||||
timeout = ${TIMEOUT}
|
timeout = ${TIMEOUT}
|
||||||
keepalive = 2
|
keepalive = 2
|
||||||
|
|||||||
Reference in New Issue
Block a user