Skip to content

Commit

Permalink
Add debug mode for gunicorn and update iso-prod files
Browse files Browse the repository at this point in the history
  • Loading branch information
TheophileDiot committed Apr 26, 2024
1 parent 27f9977 commit b26d072
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion misc/dev/docker-compose.autoconf.ui.misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ services:
build:
context: ../..
dockerfile: ./src/ui/Dockerfile
command: python3 -m gunicorn --config gunicorn.conf.py --user ui --group ui --bind 0.0.0.0:7000 --reload --log-level debug
depends_on:
- bw-docker
volumes:
Expand All @@ -105,6 +104,7 @@ services:
<<: *env
ADMIN_USERNAME: "admin"
ADMIN_PASSWORD: "P@ssw0rd"
DEBUG: "1"
networks:
bw-universe:
aliases:
Expand Down
2 changes: 1 addition & 1 deletion misc/dev/docker-compose.autoconf.ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ services:
build:
context: ../..
dockerfile: ./src/ui/Dockerfile
command: python3 -m gunicorn --config gunicorn.conf.py --user ui --group ui --bind 0.0.0.0:7000 --reload --log-level debug
depends_on:
- bw-docker
volumes:
Expand All @@ -102,6 +101,7 @@ services:
<<: *env
ADMIN_USERNAME: "admin"
ADMIN_PASSWORD: "P@ssw0rd"
DEBUG: "1"
networks:
bw-universe:
aliases:
Expand Down
2 changes: 1 addition & 1 deletion misc/dev/docker-compose.autoconf.wizard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ services:
build:
context: ../..
dockerfile: ./src/ui/Dockerfile
command: python3 -m gunicorn --config gunicorn.conf.py --user ui --group ui --bind 0.0.0.0:7000 --reload --log-level debug
depends_on:
- bw-docker
volumes:
Expand All @@ -100,6 +99,7 @@ services:
- ../../src/ui/utils.py:/usr/share/bunkerweb/ui/utils.py:ro
environment:
<<: *env
DEBUG: "1"
networks:
bw-universe:
aliases:
Expand Down
2 changes: 1 addition & 1 deletion misc/dev/docker-compose.ui.misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ services:
build:
context: ../..
dockerfile: ./src/ui/Dockerfile
command: python3 -m gunicorn --config gunicorn.conf.py --user ui --group ui --bind 0.0.0.0:7000 --reload --log-level debug
depends_on:
- bw-docker
volumes:
Expand All @@ -95,6 +94,7 @@ services:
<<: *env
ADMIN_USERNAME: "admin"
ADMIN_PASSWORD: "P@ssw0rd"
DEBUG: "1"
networks:
bw-universe:
aliases:
Expand Down
2 changes: 1 addition & 1 deletion misc/dev/docker-compose.ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ services:
build:
context: ../..
dockerfile: ./src/ui/Dockerfile
command: python3 -m gunicorn --config gunicorn.conf.py --user ui --group ui --bind 0.0.0.0:7000 --reload --log-level debug
depends_on:
- bw-docker
volumes:
Expand All @@ -91,6 +90,7 @@ services:
<<: *env
ADMIN_USERNAME: "admin"
ADMIN_PASSWORD: "P@ssw0rd"
DEBUG: "1"
networks:
bw-universe:
aliases:
Expand Down
2 changes: 1 addition & 1 deletion misc/dev/docker-compose.wizard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ services:
build:
context: ../..
dockerfile: ./src/ui/Dockerfile
command: python3 -m gunicorn --config gunicorn.conf.py --user ui --group ui --bind 0.0.0.0:7000 --reload --log-level debug main:app
depends_on:
- bw-docker
volumes:
Expand All @@ -84,6 +83,7 @@ services:
- ../../src/ui/utils.py:/usr/share/bunkerweb/ui/utils.py:ro
environment:
<<: *env
DEBUG: "1"
networks:
bw-universe:
aliases:
Expand Down
9 changes: 8 additions & 1 deletion src/ui/gunicorn.conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
accesslog = "/var/log/bunkerweb/ui-access.log"
access_log_format = '%({x-forwarded-for}i)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'
errorlog = "/var/log/bunkerweb/ui.log"
loglevel = LOG_LEVEL.lower()
reuse_port = True
worker_tmp_dir = join(sep, "dev", "shm")
tmp_upload_dir = join(sep, "var", "tmp", "bunkerweb", "ui")
Expand All @@ -39,6 +38,14 @@
max_requests_jitter = min(8, MAX_WORKERS)
graceful_timeout = 5

DEBUG = getenv("DEBUG", False)

loglevel = "debug" if DEBUG else LOG_LEVEL.lower()

if DEBUG:
reload = True
reload_extra_files = [file.as_posix() for file in Path(sep, "usr", "share", "bunkerweb", "ui", "templates").iterdir()]


def on_starting(server):
if not getenv("FLASK_SECRET") and not TMP_DIR.joinpath(".flask_secret").is_file():
Expand Down

0 comments on commit b26d072

Please sign in to comment.