#!/bin/bash # Root-requiring installation steps for youtube-automate. # # susan has no passwordless sudo, so these are collected here for the operator # to run in one go: # # sudo /opt/youtube-automate/deploy/deploy.sh # # Everything that does NOT need root (the venv, the database, the POT provider # container, subscriptions) is already handled by the application itself. set -euo pipefail REPO=/opt/youtube-automate VENV=/var/lib/youtube-automate/venv HOSTNAME_=tube.jihakuz.xyz if [[ $EUID -ne 0 ]]; then echo "This script needs root. Run: sudo $0" >&2 exit 1 fi say() { printf '\n\033[1m==> %s\033[0m\n' "$1"; } say "Installing the /usr/local/bin shim" cat > /usr/local/bin/youtube-automate </dev/null | grep -qv "$HOSTNAME_\$"; then echo " $HOSTNAME_ is already served by an existing vhost." echo " Skipping the standalone file — run deploy/fix-nginx-tube.sh instead." else install -m 0644 "$REPO/deploy/nginx-tube.jihakuz.xyz.conf" \ "/etc/nginx/sites-available/$HOSTNAME_" ln -sfn "/etc/nginx/sites-available/$HOSTNAME_" \ "/etc/nginx/sites-enabled/$HOSTNAME_" nginx -t systemctl reload nginx fi cat < Done. Remaining manual steps, in order: 1. Issue the certificate (needs port 80 reachable from the internet): sudo certbot --nginx -d $HOSTNAME_ 2. Set the admin password (prompts; never pass it as an argument): youtube-automate set-password 3. Add the two cron entries as susan (NOT root): crontab -e # then paste $REPO/deploy/crontab.fragment 4. Confirm everything is healthy: youtube-automate doctor Note: the bgutil POT provider container starts itself on boot via --restart unless-stopped, so it needs nothing here. If it is ever missing: docker run --name bgutil-provider -d --restart unless-stopped --init \\ -p 127.0.0.1:4416:4416 brainicism/bgutil-ytdlp-pot-provider:1.3.1-deno EOF