From 1085af85d1ac3386313aa5859a604339d8fc6687 Mon Sep 17 00:00:00 2001 From: jhj0517 <97279763+jhj0517@users.noreply.github.com> Date: Sat, 30 Nov 2024 23:43:31 +0900 Subject: [PATCH 1/5] Add gunicorn --- backend/requirements-backend.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/requirements-backend.txt b/backend/requirements-backend.txt index cfa2248..089a29c 100644 --- a/backend/requirements-backend.txt +++ b/backend/requirements-backend.txt @@ -16,6 +16,7 @@ git+https://github.com/jhj0517/pyrubberband.git # Backend dependencies python-dotenv uvicorn +gunicorn SQLAlchemy sqlmodel pydantic From cc00c7e517d67b07fdf383c1c7203e8e21ad325c Mon Sep 17 00:00:00 2001 From: jhj0517 <97279763+jhj0517@users.noreply.github.com> Date: Mon, 2 Dec 2024 22:50:51 +0900 Subject: [PATCH 2/5] Add example nginx.conf --- backend/nginx/nginx.conf | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 backend/nginx/nginx.conf diff --git a/backend/nginx/nginx.conf b/backend/nginx/nginx.conf new file mode 100644 index 0000000..52aadf8 --- /dev/null +++ b/backend/nginx/nginx.conf @@ -0,0 +1,23 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + server { + listen 80; + client_max_body_size 4G; + + server_name your-own-domain-name.com; + + location / { + proxy_pass http://127.0.0.1:8000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + } +} + From c9cfb451464b204ad1e1df7ff564c90eab4d0433 Mon Sep 17 00:00:00 2001 From: jhj0517 <97279763+jhj0517@users.noreply.github.com> Date: Fri, 6 Dec 2024 19:48:22 +0900 Subject: [PATCH 3/5] Add placeholder --- backend/nginx/logs/logs_are_generated_here | 0 backend/nginx/temp/temps_are_generated_here | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 backend/nginx/logs/logs_are_generated_here create mode 100644 backend/nginx/temp/temps_are_generated_here diff --git a/backend/nginx/logs/logs_are_generated_here b/backend/nginx/logs/logs_are_generated_here new file mode 100644 index 0000000..e69de29 diff --git a/backend/nginx/temp/temps_are_generated_here b/backend/nginx/temp/temps_are_generated_here new file mode 100644 index 0000000..e69de29 From 25c6a3f98973a625418a7a1670ed435f2d30b133 Mon Sep 17 00:00:00 2001 From: jhj0517 <97279763+jhj0517@users.noreply.github.com> Date: Wed, 25 Dec 2024 16:02:37 +0900 Subject: [PATCH 4/5] Update README for nginx setup --- backend/README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/backend/README.md b/backend/README.md index 100224a..1d2b9ab 100644 --- a/backend/README.md +++ b/backend/README.md @@ -23,6 +23,36 @@ pip install -r backend/requirements-backend.txt uvicorn backend.main:app --host 0.0.0.0 --port 8000 ``` +### Deploy with your domain name +You can deploy the server with your domain name by setting up a reverse proxy with Nginx. + +1. Install Nginx if you don't already have it. +- Linux : https://nginx.org/en/docs/install.html +- Windows : https://nginx.org/en/docs/windows.html + +2. Edit [`nginx.conf`](https://github.com/jhj0517/Whisper-WebUI/blob/master/backend/nginx/nginx.conf) for your domain name. +https://github.com/jhj0517/Whisper-WebUI/blob/895cafe400944396ad8be5b1cc793b54fecc8bbe/backend/nginx/nginx.conf#L12 + +3. Add an A type record of your public IPv4 address in your domain provider. (you can get it by searching "What is my IP" in Google) + +4. Open a terminal and go to the location of [`nginx.conf`](https://github.com/jhj0517/Whisper-WebUI/blob/master/backend/nginx/nginx.conf), then start the nginx server, so that you can manage nginx-related logs there. +```shell +cd backend/nginx +nginx -c "/path/to/Whisper-WebUI/backend/nginx/nginx.conf" +``` + +5. Open another terminal in the root project location `/Whisper-WebUI`, and deploy the app with `uvicorn` or whatever. Now the app will be available at your domain. +```shell +uvicorn backend.main:app --host 0.0.0.0 --port 8000 +``` + +6. When you turn off nginx, you can use `nginx -s stop`. +```shell +cd backend/nginx +nginx -s stop -c "/path/to/Whisper-WebUI/backend/nginx/nginx.conf" +``` + + ## Configuration You can set some server configurations in [config.yaml](https://github.com/jhj0517/Whisper-WebUI/blob/master/backend/configs/config.yaml).
For example, initial model size for Whisper or the cleanup frequency and TTL for cached files. From 093ee9f00a57f0831757177d3f28b72be9071534 Mon Sep 17 00:00:00 2001 From: jhj0517 <97279763+jhj0517@users.noreply.github.com> Date: Wed, 25 Dec 2024 16:05:13 +0900 Subject: [PATCH 5/5] Remove gunicorn --- backend/requirements-backend.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/backend/requirements-backend.txt b/backend/requirements-backend.txt index 643be8c..b1afb2f 100644 --- a/backend/requirements-backend.txt +++ b/backend/requirements-backend.txt @@ -4,7 +4,6 @@ # Backend dependencies python-dotenv uvicorn -gunicorn SQLAlchemy sqlmodel pydantic