fix(pagination): Fix #95. Switch from eventlet to gevent

This commit is contained in:
Frederik Baerentsen
2025-09-23 16:36:22 +02:00
parent c71667cd41
commit 909655c10a
3 changed files with 42 additions and 1 deletions

View File

@@ -5,6 +5,9 @@ WORKDIR /app
# Bricktracker
COPY . .
# Fix line endings and set executable permissions for entrypoint script
RUN sed -i 's/\r$//' entrypoint.sh && chmod +x entrypoint.sh
# Python library requirements
RUN pip --no-cache-dir install -r requirements.txt

View File

@@ -13,4 +13,4 @@ then
fi
# Execute the WSGI server
gunicorn --bind "${BK_SERVER}:${BK_PORT}" "app:create_app()" --worker-class "eventlet" "$@"
gunicorn --bind "${BK_HOST}:${BK_PORT}" "wsgi:application" --worker-class "gevent" --workers 1 "$@"

38
wsgi.py Normal file
View File

@@ -0,0 +1,38 @@
#!/usr/bin/env python3
"""
WSGI entry point for BrickTracker - Production Docker deployment
This ensures proper gevent monkey patching for gunicorn
"""
# CRITICAL: This must be the very first import
import gevent.monkey
gevent.monkey.patch_all()
import logging
import sys
import os
# Add the current directory to Python path
sys.path.insert(0, os.path.dirname(__file__))
# Import Flask and BrickTracker modules directly
from flask import Flask
from bricktracker.app import setup_app
from bricktracker.socket import BrickSocket
logger = logging.getLogger(__name__)
# Create the Flask app directly (bypassing app.py to avoid double monkey patching)
app = Flask(__name__)
# Setup the app
setup_app(app)
# Create the socket
socket_instance = BrickSocket(
app,
threaded=not app.config['NO_THREADED_SOCKET'],
)
# Export the Flask app for gunicorn
application = app