From e7a5c4295177c3f9ee943ef793dba22b9f85eb78 Mon Sep 17 00:00:00 2001 From: Minecon724 Date: Sat, 29 Mar 2025 15:51:31 +0100 Subject: [PATCH] Initial commit --- .gitmodules | 3 ++ config-refresh.yaml | 43 ++++++++++++++++++++++++++++ config.yaml | 43 ++++++++++++++++++++++++++++ docker-compose.yml | 68 +++++++++++++++++++++++++++++++++++++++++++++ invidious | 1 + nginx.conf | 18 ++++++++++++ reset.sh | 6 ++++ 7 files changed, 182 insertions(+) create mode 100644 .gitmodules create mode 100644 config-refresh.yaml create mode 100644 config.yaml create mode 100644 docker-compose.yml create mode 160000 invidious create mode 100644 nginx.conf create mode 100644 reset.sh diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f29da5c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "invidious"] + path = invidious + url = https://github.com/iv-org/invidious diff --git a/config-refresh.yaml b/config-refresh.yaml new file mode 100644 index 0000000..1f049ed --- /dev/null +++ b/config-refresh.yaml @@ -0,0 +1,43 @@ +db: + user: kemal + password: kemal + host: invidious-db + port: 5432 + dbname: invidious + +dmca_content: [] + +check_tables: true +hmac_key: REPLACE ME + +external_port: 443 +domain: id.example.com +https_only: true + +statistics_enabled: true +use_pubsub_feeds: true +use_innertube_for_captions: true + +invidious_companion_key: REPLACE ME +invidious_companion: + - private_url: "https://1.c.id.example.com" + public_url: "https://1.c.id.example.com" + - private_url: "https://2.c.id.example.com" + public_url: "https://2.c.id.example.com" + # ...and so on + +default_user_preferences: + player_style: youtube + quality: dash + autoplay: true + save_player_pos: true + local: true + +#http_proxy: +# user: '' +# password: '' +# host: 192.0.2.39 +# port: 8080 + +banner: 'Instance info here. Please read.    Having problems? Here are some solutions.' + diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..1f049ed --- /dev/null +++ b/config.yaml @@ -0,0 +1,43 @@ +db: + user: kemal + password: kemal + host: invidious-db + port: 5432 + dbname: invidious + +dmca_content: [] + +check_tables: true +hmac_key: REPLACE ME + +external_port: 443 +domain: id.example.com +https_only: true + +statistics_enabled: true +use_pubsub_feeds: true +use_innertube_for_captions: true + +invidious_companion_key: REPLACE ME +invidious_companion: + - private_url: "https://1.c.id.example.com" + public_url: "https://1.c.id.example.com" + - private_url: "https://2.c.id.example.com" + public_url: "https://2.c.id.example.com" + # ...and so on + +default_user_preferences: + player_style: youtube + quality: dash + autoplay: true + save_player_pos: true + local: true + +#http_proxy: +# user: '' +# password: '' +# host: 192.0.2.39 +# port: 8080 + +banner: 'Instance info here. Please read.    Having problems? Here are some solutions.' + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1987613 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,68 @@ +services: + invidious-refresh: + image: quay.io/invidious/invidious:master + restart: unless-stopped + volumes: + - /opt/invidious/config-refresh.yaml:/config/config.yaml:ro + environment: + - INVIDIOUS_CONFIG_FILE=/config/config.yaml + healthcheck: + test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/trending || exit 1 + interval: 30s + timeout: 5s + retries: 2 + depends_on: + - invidious-db + + invidious: + image: quay.io/invidious/invidious:master + restart: unless-stopped + volumes: + - /opt/invidious/config.yaml:/config/config.yaml:ro + environment: + - INVIDIOUS_CONFIG_FILE=/config/config.yaml + healthcheck: + test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/trending || exit 1 + interval: 30s + timeout: 5s + retries: 2 + deploy: + replicas: 6 + depends_on: + - invidious-db + + invidious-db: + image: docker.io/library/postgres:14 + restart: unless-stopped + volumes: + - postgresdata:/var/lib/postgresql/data + - /opt/invidious/invidious/config/sql:/config/sql + - /opt/invidious/invidious/docker/init-invidious-db.sh:/docker-entrypoint-initdb.d/init-invidious-db.sh + environment: + POSTGRES_DB: invidious + POSTGRES_USER: kemal + POSTGRES_PASSWORD: kemal + healthcheck: + test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"] + + nginx: + image: nginx:alpine-slim + restart: unless-stopped + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf:ro + depends_on: + - invidious + ports: + - "192.168.81.2:3000:3000" + +volumes: + postgresdata: + companioncache: + +#networks: +# default: +# enable_ipv6: true +# ipam: +# config: +# - subnet: 2001:0DB9::/112 +# gateway: 2001:0DB9::1 diff --git a/invidious b/invidious new file mode 160000 index 0000000..23ff613 --- /dev/null +++ b/invidious @@ -0,0 +1 @@ +Subproject commit 23ff6135bb4304c6b5e9de6fc06e67bfadc9651a diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..c93f816 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,18 @@ +user nginx; +events { + worker_connections 1000; +} +http { + server { + listen 3000; + listen [::]:3000; + access_log off; + location / { + resolver 127.0.0.11; + set $backend "invidious"; + proxy_pass http://$backend:3000; + proxy_http_version 1.1; # to keep alive + proxy_set_header Connection ""; # to keep alive + } + } +} diff --git a/reset.sh b/reset.sh new file mode 100644 index 0000000..0583371 --- /dev/null +++ b/reset.sh @@ -0,0 +1,6 @@ +#!/bin/bash +cd /opt/invidious + +echo "Restarting..." +docker compose restart invidious-refresh +docker compose restart invidious