From e257ececf7bb7c1e7b78966bdc7730bbd0d798d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Diot?= Date: Tue, 19 Mar 2024 12:38:20 +0000 Subject: [PATCH] Change how we save the pid file of the web UI --- src/ui/gunicorn.conf.py | 1 - src/ui/main.py | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ui/gunicorn.conf.py b/src/ui/gunicorn.conf.py index 60ebcee8e..5526844cf 100644 --- a/src/ui/gunicorn.conf.py +++ b/src/ui/gunicorn.conf.py @@ -13,7 +13,6 @@ loglevel = "info" proc_name = "bunkerweb-ui" preload_app = True reuse_port = True -pidfile = join(sep, "var", "run", "bunkerweb", "ui.pid") worker_tmp_dir = join(sep, "dev", "shm") tmp_upload_dir = join(sep, "var", "tmp", "bunkerweb", "ui") worker_class = "gthread" diff --git a/src/ui/main.py b/src/ui/main.py index 10e183be5..2c395ed8d 100755 --- a/src/ui/main.py +++ b/src/ui/main.py @@ -2,7 +2,7 @@ from contextlib import suppress from math import floor -from os import _exit, getenv, listdir, sep, urandom +from os import _exit, getenv, getpid, listdir, sep, urandom from os.path import basename, dirname, join from secrets import choice from string import ascii_letters, digits @@ -180,6 +180,7 @@ elif getenv("ADMIN_USERNAME") and getenv("ADMIN_PASSWORD"): stop(1) app.logger.info("Database is ready") +Path(sep, "var", "run", "bunkerweb", "ui.pid").write_text(str(getpid()), encoding="utf-8") Path(sep, "var", "tmp", "bunkerweb", "ui.healthy").write_text("ok", encoding="utf-8") bw_version = Path(sep, "usr", "share", "bunkerweb", "VERSION").read_text(encoding="utf-8").strip() @@ -1038,11 +1039,9 @@ def global_config(): ), ).start() - try: + with suppress(BaseException): if config["PRO_LICENSE_KEY"]["value"] != variables["PRO_LICENSE_KEY"]: flash("Checking license key to upgrade.", "success") - except: - pass return redirect( url_for(