Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Nginx reverse proxy #76

Open
Saphar opened this issue Jan 8, 2024 · 1 comment
Open

[BUG] Nginx reverse proxy #76

Saphar opened this issue Jan 8, 2024 · 1 comment

Comments

@Saphar
Copy link

Saphar commented Jan 8, 2024

Description

Using a reverse nginx proxy on the same network as the transcribe VM.

To Reproduce

  1. Install Whishper according to the script.
  2. Change the .env to be accessible on the network.
  3. Add reverse proxy for Nginx.

Expected behavior

Load page normally.

Environment

  • OS: Debian 12
  • Browser: Firefox 121.0 (64-bit)
  • Hosting: Nginx reverse proxy

Logs and Configuration

Nginx configuration

upstream whishper {
	server 192.168.1.15:8082;
}

server {
        listen 80;
        listen [::]:80;
        server_name transcribe.domain.org;
        return 301 https://transcribe.domain.org;
}

# The HTTPS part.
server {
        # We're using HTTP/2
        listen 443 ssl;
        listen [::]:443 ssl;

        server_name transcribe.domain.org;

        ssl_certificate /etc/letsencrypt/live/transcribe.domain.org/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/transcribe.domain.org/privkey.pem;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;  # drop SSLv3 (POODLE vulnerability)
        ssl_session_cache shared:SSL:10m;
        ssl_session_timeout 10m;
        ssl_prefer_server_ciphers on;
        ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK';

        # Settings for the upstream server.
        location / {
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_pass http://whishper;
                proxy_buffering off;
                client_max_body_size 0;
                proxy_connect_timeout  3600s;
                proxy_read_timeout  3600s;
                proxy_send_timeout  3600s;
                send_timeout  3600s;
        }
}

Error received in the browser:

Blocked loading mixed active content “http://192.168.1.15:8082/api/transcriptions”
TypeError: NetworkError when attempting to fetch resource.

Docker Compose Logs

Run the following command in the project folder, force the error, and paste the logs below: docker compose logs -f --tail 50

opt-mongo-1             | {"t":{"$date":"2024-01-08T18:45:59.644Z"},"s":"I",  "c":"CONTROL",  "id":20697,   "ctx":"main","msg":"Renamed existing log file","attr":{"oldLogPath":"/var/log/mongodb/mongod.log","newLogPath":"/var/log/mongodb/mongod.log.2024-01-08T18-45-59"}}
whisper-libretranslate  | Updating language models
whisper-libretranslate  | Found 86 models
whisper-libretranslate  | Keep 2 models
whisper-libretranslate  | Downloading English → Spanish (1.0) ...
whisper-libretranslate  | Downloading Spanish → English (1.0) ...
whisper-libretranslate  | Loaded support for 2 languages (2 models total)!
whisper-libretranslate  | Running on http://0.0.0.0:5000
whishper                | 2024-01-08 18:46:00,304 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.
whishper                | 2024-01-08 18:46:00,306 INFO supervisord started with pid 1
whishper                | 2024-01-08 18:46:01,308 INFO spawned: 'backend' with pid 7
whishper                | 2024-01-08 18:46:01,310 INFO spawned: 'frontend' with pid 8
whishper                | 2024-01-08 18:46:01,311 INFO spawned: 'nginx' with pid 9
whishper                | 2024-01-08 18:46:01,313 INFO spawned: 'transcription' with pid 10
whishper                | 2024-01-08 18:46:02,410 INFO success: backend entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
whishper                | 2024-01-08 18:46:02,410 INFO success: frontend entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
whishper                | 2024-01-08 18:46:02,410 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
whishper                | 2024-01-08 18:46:02,410 INFO success: transcription entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

Docker Compose File

version: "3.9"

services:
  mongo:
    image: mongo
    env_file:
      - .env
    restart: unless-stopped
    volumes:
      - ./whishper_data/db_data:/data/db
      - ./whishper_data/db_data/logs/:/var/log/mongodb/
    environment:
      MONGO_INITDB_ROOT_USERNAME: ${DB_USER:-whishper}
      MONGO_INITDB_ROOT_PASSWORD: ${DB_PASS:-whishper}
    expose:
      - 27017
    command: ['--logpath', '/var/log/mongodb/mongod.log']

  translate:
    container_name: whisper-libretranslate
    image: libretranslate/libretranslate:latest-cuda
    restart: unless-stopped
    volumes:
      - ./whishper_data/libretranslate/data:/home/libretranslate/.local/share
      - ./whishper_data/libretranslate/cache:/home/libretranslate/.local/cache
    env_file:
      - .env
    user: root
    tty: true
    environment:
      LT_DISABLE_WEB_UI: True
      LT_LOAD_ONLY: ${LT_LOAD_ONLY:-en,fr,es}
      LT_UPDATE_MODELS: True
    expose:
      - 5000
    networks:
      default:
        aliases:
          - translate
    deploy:
      resources:
        reservations:
          devices:
          - driver: nvidia
            count: all
            capabilities: [gpu]

  whishper:
    pull_policy: always
    image: pluja/whishper:${WHISHPER_VERSION:-latest-gpu}
    env_file:
      - .env
    volumes:
      - ./whishper_data/uploads:/app/uploads
      - ./whishper_data/logs:/var/log/whishper
    container_name: whishper
    restart: unless-stopped
    networks:
      default:
        aliases:
          - whishper
    ports:
      - 8082:80
    depends_on:
      - mongo
      - translate
    environment:
      PUBLIC_INTERNAL_API_HOST: "http://127.0.0.1:80"
      PUBLIC_TRANSLATION_API_HOST: ""
      PUBLIC_API_HOST: ${WHISHPER_HOST:-}
      PUBLIC_WHISHPER_PROFILE: gpu
      WHISPER_MODELS_DIR: /app/models
      UPLOAD_DIR: /app/uploads
    deploy:
      resources:
        reservations:
          devices:
          - driver: nvidia
            count: all
            capabilities: [gpu]

.env file

# Libretranslate Configuration
## Check out https://github.com/LibreTranslate/LibreTranslate#configuration-parameters for more libretranslate configuration options
LT_LOAD_ONLY=en,es

# Whisper Configuration
WHISPER_MODELS=tiny,small,large-v3
WHISHPER_HOST=http://192.168.1.15:8082

# Database Configuration
DB_USER=whishper
DB_PASS=whishper
@Saphar Saphar changed the title Nginx reverse proxy [BUG] Nginx reverse proxy Jan 8, 2024
@c0rv1nu5
Copy link

As it mentioned in issue #65 you need to change .env file.

Replace WHISHPER_HOST=http://192.168.1.15:8082 to WHISHPER_HOST=https://transcribe.domain.org. It helped me to run behind nginx reverse-proxy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants