From db5355164c930fae10e57ecfede63ee9000178c7 Mon Sep 17 00:00:00 2001 From: Maximilian Friedersdorff Date: Fri, 28 Jun 2024 19:35:29 +0100 Subject: [PATCH] Run with gunicorn instead --- requirements/production.in | 1 + requirements/production.txt | 4 ++++ run_bjoern.py | 44 ------------------------------------- 3 files changed, 5 insertions(+), 44 deletions(-) delete mode 100755 run_bjoern.py diff --git a/requirements/production.in b/requirements/production.in index 296ca87..6f9c09a 100644 --- a/requirements/production.in +++ b/requirements/production.in @@ -1 +1,2 @@ psycopg +gunicorn diff --git a/requirements/production.txt b/requirements/production.txt index c74f391..def9b94 100644 --- a/requirements/production.txt +++ b/requirements/production.txt @@ -1,5 +1,9 @@ # This file was autogenerated by uv via the following command: # uv pip compile requirements/production.in +gunicorn==22.0.0 + # via -r requirements/production.in +packaging==24.1 + # via gunicorn psycopg==3.1.19 # via -r requirements/production.in typing-extensions==4.12.2 diff --git a/run_bjoern.py b/run_bjoern.py deleted file mode 100755 index 48cb71e..0000000 --- a/run_bjoern.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python3 - -import bjoern -import os -import socket -import traceback - -from django.core.wsgi import get_wsgi_application - -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production") -app = get_wsgi_application() - -NUM_WORKERS = 1 -worker_pids = [] - -socket_path = "/var/run/reinheit/reinheit.sock" - -try: - os.unlink(socket_path) -except OSError: - if os.path.exists(socket_path): - os.remove(socket_path) - -sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) -sock.bind(socket_path) -sock.listen() - -print("Setting access mode to 777") -os.chmod(socket_path, 0o777) - - -try: - print(f"Serving reinheit via {socket_path}") - bjoern.server_run(sock, app) -except Exception: - traceback.print_exc() - try: - sock.close() - except Exception: - traceback.print_exc() - try: - os.remove(socket_path) - except Exception: - traceback.print_exc()