From 9f6bcc83d58fdcc6723ee2ea179644b34e08c638 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Sat, 22 Oct 2022 11:43:03 -0800 Subject: [PATCH] fix: apply API_PORT in containers (#1754) --- frontend/Caddyfile | 2 +- gunicorn_conf.py | 4 ++-- mealie/run.sh | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/frontend/Caddyfile b/frontend/Caddyfile index 2ee7a4af..4cecca23 100644 --- a/frontend/Caddyfile +++ b/frontend/Caddyfile @@ -36,7 +36,7 @@ handle @apidocs { uri strip_suffix / - reverse_proxy http://mealie-api:9000 + reverse_proxy {$API_URL} } handle { diff --git a/gunicorn_conf.py b/gunicorn_conf.py index 9005b589..f9b43197 100644 --- a/gunicorn_conf.py +++ b/gunicorn_conf.py @@ -12,7 +12,7 @@ class GunicornConfig: # Env Variables self.host = os.getenv("HOST", "127.0.0.1") - self.port = os.getenv("PORT", "9000") + self.port = os.getenv("API_PORT", "9000") self.log_level: str = os.getenv("LOG_LEVEL", "info") self.bind: str = os.getenv("BIND", None) self.errorlog: str = os.getenv("ERROR_LOG", "-") or None @@ -72,4 +72,4 @@ log_data = { "port": gunicorn_conf.port, } -print("---- Gunicorn Configuration ----", json.dumps(log_data, indent=4)) +print("---- Gunicorn Configuration ----", json.dumps(log_data, indent=4)) # noqa: T001 diff --git a/mealie/run.sh b/mealie/run.sh index eb9bad46..c2c0217f 100755 --- a/mealie/run.sh +++ b/mealie/run.sh @@ -43,8 +43,8 @@ init() { # Migrations # TODO - # Migrations - # Set Port from ENV Variable +# Migrations +# Set Port from ENV Variable if [ "$ARG1" == "reload" ]; then echo "Hot Reload!" @@ -60,7 +60,9 @@ else init + GUNICORN_PORT=${API_PORT:-9000} + # Start API # uvicorn mealie.app:app --host 0.0.0.0 --port 9000 - gunicorn mealie.app:app -b 0.0.0.0:9000 -k uvicorn.workers.UvicornWorker -c /app/gunicorn_conf.py --preload + gunicorn mealie.app:app -b 0.0.0.0:$GUNICORN_PORT -k uvicorn.workers.UvicornWorker -c /app/gunicorn_conf.py --preload fi