TubeArchivist

TubeArchivist
Photo by Aditya Chinchure / Unsplash

I feel like starting a new project today, and this one has been on my list for a while. I struggle with the modern day YouTube. Videos are constantly disappearing from the platform for a number of different reasons. Which honestly sucks having a video you've enjoyed just disappear on you. The bigger issue I have is the advertisements. They're getting more frequent, longer, and fewer are skipp-able. Plus I am pretty positive that whole "Skip in 5 seconds" is actually more like seven or eight seconds now. My other beef with YouTube ads are the insanely inappropriate ads shown on videos that are clearly oriented and targeted to children. They don't need to see this stuff. Maybe I can use TubeArchivist to grab a copy of my little one's favorite videos so I can spare him from the adult advertisements.

Verify System Requirements

Looking at the documentation, the minimum is 2GB of memory and 2 cores, and the recommended is 4GB of memory and 4 cores. It also requires docker. It looks like all other requirements will be pulled in by the docker image.

Create Virtual Machine

Steps performed on HV-03 via Windows Admin Center

  • Navigate to Virtual Machines
  • Click on Add
    • Name: TUBEARCHIVIST-01
    • Generation: Generation 2 (Recommended)
    • CPUs: 2
    • Memory: 4GB
    • Virtual Disk: 50GB
    • Click Create
  • Select TUBEARCHIVIST-01
  • Click on Settings
  • Navigate to Disk
    • Click on Add
    • I select my Debian ISO
    • Click on Save disk settings
  • Navigate to Boot
    • Set first boot option to DVD
    • Set second boot option to Hard Drive
    • Click on Save boot settings
  • Navigate to Security
    • Enable Secure Boot: Yes
    • Certificate Template: Microsoft UEFI Certificate Authority
    • Click on Save security settings
  • Powered on TUBEARCHIVIST-01

Install Operating System

Steps performed on TUBEARCHIVIST-01

When I select Install from the Debian ISO menu the virtual machine freezes. That's strange. I try to turn off the VM without luck. The host HV-03 seems very unresponsive now. From Windows Admin Center and Hyper-V Manager.

Steps performed from Desktop via Windows Terminal

  • Get-VM

This command just locks up and goes nowhere.

  • Stop-VM -Name 'TUBEARCHIVIST-01' -Force

This command doesn't do anything either. In fact it completely locks up the PowerShell window. I open up a new Windows Terminal PowerShell window.

  • Get-Process

Nothing looks wrong with a quick glance, but no PowerShell commands are actually returning a result.

  • Get-Service vmms | Restart-Service

I'd expect this command to make Hyper-V Manager and Windows Admin Center responsive again. It's been trying to restart this service for over five minutes now and does not seem to have gotten anywhere. I swear I ran into this problem before and fixed it with a permission issue on the ISOs. I can't even really look into the permissions because the host HV-03 is so unresponsive.

I SSH'd into each of my virtual machines and shut them down. That leaves me with three VM worker processes left. I can force kill two of them, but the last one won't quit. This does make HV-03 a little more responsive.

  • Get-VM

Well the command now works but doesn't list the new virtual machine TUBEARCHIVIST-01 at all. That's interesting. Looking in Hyper-V Manager and Windows Admin Center both list TUBEARCHIVIST-01, still in the state of stopping.

I try to kill the vmwp process, but I get a permission issue. I ran this command from my administrator account on HV-03's console. How much more allowed can I be? I was finally able to kill the vmms process since it never restarted for me. Now the virtual machine TUBEARCHIVIST-01 shows a state of off in Hyper-V Manager but I am unable to access it's settings, it just doesn't open. I run another Get-VM but it still does not show TUBEARCHIVIST-01. Looks like I am going to have to just reboot the host which is not a big deal at this point since all the virtual machines have been turned off anyway.

I try to reboot the host HV-03 but it gets stuck on closing the Hyper-V Virtual Machine Management service. Not cool. I load up my iDRAQ and force the system to reboot. After the reboot from iDRAQ I was able to unmount the ISO from the virtual machine, but the virtual machine TUBEARCHIVIST-01 itself is still unresponsive. Holy cow!

A third reboot of the host HV-03. Afterwards I make certain that TUBEARCHIVIST-01 is not using dynamic memory. I also set the Automatic Start Action to do nothing when the physical machine starts just in case it locks things up again. I power on TUBEARCHVIST-01 and it instantly locks up.

A fourth reboot. I decide to disable secure boot all together. I power on the virtual machine and it again instantly freezes. This is so weird, there's no operating system installed, and I don't even have any media attached to even try to install an operating system.

A fifth reboot. I attach a different ISO of Debian this time. It again freezes up.

A sixth reboot. I attach an Ubuntu ISO and reproduce the problem. It is again locked up.

A seventh reboot. Am I out of space? No. Is there a permission issue? Not that I can see. Is this brand new virtual machine just bad? That's all I can really think of at this point. So I delete the virtual machine TUBEARCHIVIST-01 and it's virtual disk. I then recreate the virtual machine TUBEARCHIVIST-01.

This time when I power on the virtual machine it does not freeze and I'm able to install the operating system. Man, I have not seen a corrupted virtual machine like that in years. Crazy!

Configure Operating System

Configure SSH Key

Steps performed on desktop via Windows Terminal

  • ssh-keygen -t ed25519
  • Move-Item -Path c:\Users\david\filename* -Destination c:\Users\david\.ssh -Force
  • I open the Windows Terminal Settings
  • I open the JSON file and add the following:
            {
                "colorScheme": "Ubuntu-ColorScheme",
                "commandline": "ssh -i \"~/.ssh/tubearchivist-01\" [email protected]",
                "experimental.retroTerminalEffect": false,
                "font": 
                {
                    "face": "Cascadia Code"
                },
                "guid": "{0caa0dad-35be-5f56-a8ff-XXXXXXXXXXXX}",
                "hidden": false,
                "name": "TUBEARCHIVIST-01",
                "tabTitle": "TUBEARCHIVIST-01"
            },
  • I confirm the GUID is unique and save the file

Configure SSH

Steps performed on TUBEARCHIVIST-01

  • mkdir /home/david/.ssh
  • nano /home/david/.ssh/authorized_keys
  • I paste in the public key and save the file
  • chmod 600 /home/david/.ssh/authorized_keys
  • sudo nano /etc/ssh/sshd_config
    • PermitRootLogin no
    • PubkeyAuthentication yes
    • PubkeyAcceptedKeyTypes ssh-ed25519
    • PasswordAuthentication no
    • AuthorizedKeysFile /home/david/.ssh/authorized_keys
  • I save the sshd_config file
  • sudo sshd -t
  • sudo systemctl restart ssh

Install Software Dependencies

Steps performed on TUBEARCHIVIST-01

  • sudo apt install docker
  • sudo apt install docker-compose

Install TubeArchivist

Steps performed on TUBEARCHIVIST-01

  • wget https://github.com/tubearchivist/tubearchivist/blob/master/docker-compose.yml
  • mkdir /home/david/tubearchivist
  • mv docker-compose.yml /home/david/tubearchivist/docker-compose.yml
  • nano /home/david/tubearchivist/docker-compose.yml
version: '3.3'

services:
  tubearchivist:
    container_name: tubearchivist
    restart: unless-stopped
    image: bbilly1/tubearchivist
    ports:
      - 8000:8000
    volumes:
      - media:/home/david/tubearchivist/youtube        #/youtube
      - cache:/home/david/tubearchivist/cache          #/cache
    environment:
      - ES_URL=http://archivist-es:9200     # needs protocol e.g. http and port
      - REDIS_HOST=archivist-redis          # don't add protocol
      - HOST_UID=1000
      - HOST_GID=1000
      - TA_HOST=10.10.10.XXX               # set your host name
      - TA_USERNAME=david               # your initial TA credentials
      - TA_PASSWORD=password          # your initial TA credentials
      - ELASTIC_PASSWORD=password     # set password for Elasticsearch
      - TZ=America/New_York                 # set your time zone
    depends_on:
      - archivist-es
      - archivist-redis
  archivist-redis:
      image: redis/redis-stack-server
    container_name: archivist-redis
    restart: unless-stopped
    expose:
      - "6379"
    volumes:
      - redis:/data
    depends_on:
      - archivist-es
  archivist-es:
    image: bbilly1/tubearchivist-es         # only for amd64, or use official es 8.6.2
    container_name: archivist-es
    restart: unless-stopped
    environment:
      - "ELASTIC_PASSWORD=password"       # matching Elasticsearch password
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - "xpack.security.enabled=true"
      - "discovery.type=single-node"
      - "path.repo=/usr/share/elasticsearch/data/snapshot"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - es:/usr/share/elasticsearch/data    # check for permission error when using bind mount, see r>    
    expose:
      - "9200"

volumes:
  media:
  cache:
  redis:
  es:
  • I save the docker-compose.yml file
  • sudo docker-compose up -d

Well when I try to navigate to http://tube.domain.local:8000 I get a failure. Then I remember I used the IP address in the configuration instead of the hostname so I try http://10.10.10.XXX:8000 and I am able to load TubeArchivist. Wow! This software is super freaking cool!