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

How to use warp proxy with viewtube ? And in generally how to use the proxy setting ? #2736

Closed
iwannet opened this issue Mar 31, 2024 · 7 comments

Comments

@iwannet
Copy link

iwannet commented Mar 31, 2024

I've been trying to use the cloudflare Warp proxy on port 1080 with ViewTube, but I've been encountering difficulties. Here's what I've tried so far:

  • I set the VIEWTUBE_PROXY_URL environment variable to point to the Warp proxy. I tried 127.0.0.1:1080 and 172.17.0.1:1080. Both as an ip, http and https
  • I tested the proxy server's accessibility from within a Docker container using wget and the server seems not to be reachable.
    I tried wget -e use_proxy=yes -e https_proxy=127.0.0.1:1080 -O output.txt https://api.ipify.org/ and it returned that the proxy wasnt reachable (Connecting to 127.0.0.1:1080... failed: Connection refused.) When running the same command outside the container, it returns my ip.

The container gives the same error [ViewTube] Error 3/31/2024, 1:04:07 PM [ExceptionsHandler] connect ECONNREFUSED 172.17.0.1:1080 - {"stack":["Error: connect ECONNREFUSED 172.17.0.1:1080\n at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)"]}

  • I verified that the proxy server is running and listening on port 1080.

Despite these steps, I'm still unable to use the Warp proxy with ViewTube. The application doesn't seem to be routing requests through the proxy.

I'm not sure if this is a configuration issue on my end or a problem with ViewTube's proxy handling. Any help or guidance would be greatly appreciated.

And in generally, is the viewtube proxy a socks5, http or https proxy ?

And can i use
environment: - http_proxy=http://127.0.0.1:1080 - https_proxy=https://127.0.0.1:1080
instead of using the VIEWTUBE_PROXY_URL variable ?

@iwannet
Copy link
Author

iwannet commented Mar 31, 2024

Okay, i looked at the code and found that you use the ProxyAgent class from the undici library. This class supports HTTP and HTTPS proxies but no SOCKS proxies.

@iwannet
Copy link
Author

iwannet commented Mar 31, 2024

Now when i try wget --no-check-certificate -e use_proxy=yes -e http_proxy=172.17.0.1:1080 -O output.txt https://api.ipify.org/ it returns my normal ip, not the ip of the proxy

While wget --no-check-certificate -e use_proxy=yes -e https_proxy=172.17.0.1:1080 -O output.txt https://api.ipify.org/
returns Connecting to 172.17.0.1:1080... failed: Connection refused.

@iwannet
Copy link
Author

iwannet commented Mar 31, 2024

Okay i fixed it by using cmj2002/warp-docker#7

I added this to my services:

warp-viewtube: image: caomingjun/warp container_name: warp-viewtube restart: always ports: - '1080:1080' environment: - WARP_SLEEP=2 - WARP_LICENSE_KEY=key cap_add: - NET_ADMIN sysctls: - net.ipv6.conf.all.disable_ipv6=0 - net.ipv4.conf.all.src_valid_mark=1 volumes: - ./warp-data/cloudflare-warp:/var/lib/cloudflare-warp networks: - viewtube

and then i changed the proxy url to http://warp-viewtube:1080

@iwannet
Copy link
Author

iwannet commented Mar 31, 2024

Not really a fix, but good enough for me

@iwannet iwannet closed this as completed Mar 31, 2024
@maaaaz
Copy link

maaaaz commented Jan 9, 2025

Hello @iwannet, could you share your whole docker-compose file (obviously, after removing secrets) ?

I struggle with the same issue you solved: #3001

Thanks !

@iwannet
Copy link
Author

iwannet commented Jan 10, 2025

Alr mate, here you go.

But viewtube still isnt working right ?

version: '3'

services:
  viewtube:
    restart: unless-stopped
    # Or use mauriceo/viewtube:dev for the development version
    image: mauriceo/viewtube:dev
    # ViewTube will not start until the database and redis are ready
    depends_on:
      - viewtube-mongodb
      - viewtube-redis
      - warp-viewtube
    # Make sure all services are in the same network
    networks:
      - viewtube
    volumes:
      # This will map ViewTube's data directory to the local folder ./data/viewtube/
      - ./data/viewtube:/data
    environment:
      - VIEWTUBE_DATABASE_HOST=viewtube-mongodb
      - VIEWTUBE_REDIS_HOST=viewtube-redis
      - VIEWTUBE_ADMIN_USER=youradminuserhere, must already exist
      - VIEWTUBE_PROXY_URL=http://warp-viewtube:1080
#      - VIEWTUBE_YOUTUBE_COOKIE=''
      - VIEWTUBE_SUBSCRIPTION_INTERVAL_TIME=30
      - VIEWTUBE_LOCATION= country here
      - VIEWTUBE_CLUSTERED=True
      - VIEWTUBE_SECURE=True
    ports:
      - 8066:8066
    dns: 9.9.9.9 


  viewtube-mongodb:
    restart: unless-stopped
    image: mongo:7
    networks:
      - viewtube
    volumes:
      - ./data/db:/data/db
    dns: 9.9.9.9
  viewtube-redis:
    restart: unless-stopped
    image: redis:7
    networks:
      - viewtube
    volumes:
      - ./data/redis:/data
      - ./config/redis.conf:/redis.conf
    command: ["redis-server", "/redis.conf"] # Start Redis with the custom configuration
    dns: 9.9.9.9

  warp-viewtube:
    image: caomingjun/warp
    container_name: warp-viewtube
    restart: always
    ports:
      - '1080:1080'
    environment:
      - WARP_SLEEP=2
      - WARP_LICENSE_KEY=optional, your license key here
    cap_add:
      - NET_ADMIN
    sysctls:
      - net.ipv6.conf.all.disable_ipv6=0
      - net.ipv4.conf.all.src_valid_mark=1
    volumes:
      - ./warp-data/cloudflare-warp:/var/lib/cloudflare-warp
    networks:
      - viewtube

networks:
  viewtube:

@maaaaz
Copy link

maaaaz commented Jan 10, 2025

Thanks.

Unfortunately some stuff does not work:

  • I have no answer when I route traffic to the caomingjun/warp image

  • An application error in viewtube:dev

[ViewTube] 14     - 1/10/2025, 6:05:05 PM   ERROR [ExceptionsHandler] Package subpath './dist/protos/generated/misc/params' is not defined by "exports" in /home/app/server/node_modules/youtubei.js/package.json - {"stack":["Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './dist/protos/generated/misc/params' is not defined by \"exports\" in /home/app/server/node_modules/youtubei.js/package.json\n    at exportsNotFound (node:internal/modules/esm/resolve:304:10)\n    at packageExportsResolve (node:internal/modules/esm/resolve:651:9)\n    at resolveExports (node:internal/modules/cjs/loader:634:36)\n    at Module._findPath (node:internal/modules/cjs/loader:724:31)\n    at Module._resolveFilename (node:internal/modules/cjs/loader:1211:27)\n    at Module._load (node:internal/modules/cjs/loader:1051:27)\n    at Module.require (node:internal/modules/cjs/loader:1311:19)\n    at require (node:internal/modules/helpers:179:18)\n    at /home/app/server/dist/core/search/search.service.js:80:229\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"]}
  • the same PIPELINE_LOAD_ERROR: An HTTP status code indicating failure was received: 403 error when using this configuration
version: '3'

services:
  viewtube:
    restart: unless-stopped
    # Or use mauriceo/viewtube:dev for the development version
    image: mauriceo/viewtube:latest
    # ViewTube will not start until the database and redis are ready
    depends_on:
      - viewtube-mongodb
      - viewtube-redis
      - warp-viewtube
    # Make sure all services are in the same network
    networks:
      - viewtube
    volumes:
      # This will map ViewTube's data directory to the local folder ./data/viewtube/
      - ./data/viewtube:/data
    environment:
      - VIEWTUBE_DATABASE_HOST=viewtube-mongodb
      - VIEWTUBE_REDIS_HOST=viewtube-redis
      - VIEWTUBE_ADMIN_USER=admin
      - VIEWTUBE_PROXY_URL=http://warp-viewtube:9091
#      - VIEWTUBE_YOUTUBE_COOKIE=''
    ports:
      - 8066:8066
    dns: 9.9.9.9


  viewtube-mongodb:
    restart: unless-stopped
    image: mongo:7
    networks:
      - viewtube
    volumes:
      - ./data/db:/data/db
    dns: 9.9.9.9
  viewtube-redis:
    restart: unless-stopped
    image: redis:7
    networks:
      - viewtube
    volumes:
      - ./data/redis:/data
      - ./config/redis.conf:/redis.conf
    command: ["redis-server", "/redis.conf"] # Start Redis with the custom configuration
    dns: 9.9.9.9

  warp-viewtube:
   image:  monius/docker-warp-socks:latest
   restart: unless-stopped
   container_name: warp-viewtube
   networks:
    - viewtube

networks:
  viewtube:

Too bad, ViewTube was a cool project when it worked.

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