ViewTube / viewtube

▶️ ViewTube: The open source, privacy-conscious way to enjoy your favorite YouTube content. Docs: https://viewtube.wiki, Status: https://uptime.viewtube.io
https://viewtube.io
GNU Affero General Public License v3.0
1.31k stars 75 forks source link

Viewtube Docker container not working. #1509

Closed Seven0492 closed 1 year ago

Seven0492 commented 2 years ago

I feel ashamed of myself asking this, but I've done everything I knew to do this.

So a while ago I had found Piped, but found it slow, so I wanted to self-host, then I found a supposedly friendlier self-hosting alternative! Viewtube!

So I started with the method in README.md with docker-compose, but when I tried starting it with yarn serve:api and yarn serve:client. It gave me a bunch of errors I couldn't hope to understand the source of, so I tried with using docker directly.

So I setup Docker and everything, the necessary images (Except mongodb, I just installed the mongo image since the mongodb image seemingly doesn't exist or isn't docker pull-able even with docker login). And after I figured out how to declare environment variables in containers I was able to start it up.

And then I waited a bit, and opened http://localhost:8066/ like I asked it to be in the environment variable.

And then I tried again a bit later, didn't show anything.

I stopped and restarted the container multiple times with more env variables, didn't work.

After one or two minutes of it taking resources and gets out of 'starting' mode, it is declared 'unhealthy' by Docker.

And when I specified a docker volume, it didn't even use that and just made a new one!

So I think my problem here is that the Viewtube container doesn't read the env variables. It only quits when there is no VIEWTUBE_URL env variable.

Relevant info

OS: Fedora Linux 36 (Workstation Edition) x86_64 Latest Docker version. Latest version of images required for Viewtube.

moisout commented 2 years ago

Hi! I'll gladly help you with the setup. I am a bit busy right now, please give me a couple of days and I'll get back to you

Seven0492 commented 2 years ago

No problem! I've since switched to Arch linux and I'm loving it so far! I'm gonna try to install it again to see if it works!

Seven0492 commented 2 years ago

I'm having problems with a runtime/startup ENOTFOUND error with 'viewtube-redis' whether or not the 'viewtube-redis' and 'viewtube-mongodb' is up, so I think I still need help :P

Seven0492 commented 2 years ago

I'm gonna try Piped a bit to see if it works.

Seven0492 commented 2 years ago

Nope, piped doesn't work either... strange. Is it my machine after all?

Seven0492 commented 2 years ago

Okay, so it worked for a moment, GUI and everything, but only after renaming everything in my docker-compose file. But when I added a host name for it in /etc/hosts, that host name doesn't work, why?

Seven0492 commented 2 years ago

Apart from that, it works perfectly now! I will share here my docker-compose.yml file for anyone who wants to use it!

version: "3"

services:
  viewtube2:
    container_name: viewtube2
    restart: unless-stopped
    image: mauriceo/viewtube:latest
    depends_on:
      - viewtube2-mongodb
      - viewtube2-redis
    networks:
      - viewtube
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./data:/data
    environment:
      - VIEWTUBE_URL=http://localhost:8066/
      - VIEWTUBE_DATABASE_HOST=viewtube2-mongodb
      - VIEWTUBE_REDIS_HOST=viewtube2-redis
      - VIEWTUBE_DATA_DIRECTORY=/data
    ports:
      - 8066:8066

  viewtube2-mongodb:
    container_name: viewtube2-mongodb
    image: mongo:latest
    networks:
      - viewtube
    restart: unless-stopped
    volumes:
      - ./data/db:/data/db

  viewtube2-redis:
    container_name: viewtube2-redis
    image: redis:latest
    networks:
      - viewtube
    restart: unless-stopped
    volumes:
      - ./data/redis:/data

networks:
  viewtube:

PS: To use it, you have to use the docker-compose up command to start it, docker-compose down to stop it, all in the same directory has the one with docker-compose.yml.

Access it in https://localhost:8066!

Seven0492 commented 2 years ago

Modifying configurations was the worst thing I could do. I wondered why another laptop accessing the server didn't work, so I played and tweaked the VIEWTUBE_URL variable to see if it changed anything and could work. It doesn't, it even broke about everything. I've changed the name of everything this time in the config (Changed back VIEWTUBE_URL to what it was before) and it hasn't fixed it, here's the network error:

{
  "requestConfig": {
    "transitional": {
      "silentJSONParsing": true,
      "forcedJSONParsing": true,
      "clarifyTimeoutError": false
    },
    "transformRequest": [
      null
    ],
    "transformResponse": [
      null
    ],
    "timeout": 30000,
    "xsrfCookieName": "XSRF-TOKEN",
    "xsrfHeaderName": "X-XSRF-TOKEN",
    "maxContentLength": -1,
    "maxBodyLength": -1,
    "headers": {
      "Accept": "application/json, text/plain, */*"
    },
    "baseURL": "https://localhost:8066/api/",
    "withCredentials": true,
    "method": "get",
    "url": "videos/6K-tTaxLqJQ"
  },
  "responseData": null,
  "message": "Network Error"
}
Seven0492 commented 2 years ago

Nevermind, sorry for the false alert! When I changed back the VIEWTUBE_URL variable, I wrote it on https protocol.

Seven0492 commented 2 years ago

I'll just make this a place where I'll dump all my mistakes so people know what to do when they have them :P My own way of contributing.

moisout commented 1 year ago

There are now more extensive docs, where everything should be covered: https://viewtube.wiki. If anything is missing, please let me know by opening a new issue