diff --git a/_snippets/common-links.md b/_snippets/common-links.md index fc9386b..b342e2d 100644 --- a/_snippets/common-links.md +++ b/_snippets/common-links.md @@ -24,6 +24,7 @@ [headphones]: /recipes/autopirate/headphones/ [homeassistant]: /recipes/homeassistant/ [immich]: /recipes/immich/ +[invidious]: /recipes/invidious/ [jackett]: /recipes/autopirate/jackett/ [jellyfin]: /recipes/jellyfin/ [k8s/mastodon]: /recipes/kubernetes/mastodon/ diff --git a/docs/blog/posts/changelog/new-recipe-invidious-swarm.md b/docs/blog/posts/changelog/new-recipe-invidious-swarm.md new file mode 100644 index 0000000..2dd704e --- /dev/null +++ b/docs/blog/posts/changelog/new-recipe-invidious-swarm.md @@ -0,0 +1,26 @@ +--- +date: 2023-02-14 +categories: + - CHANGELOG +tags: + - invidious +links: + - Invidious recipe: recipes/invidious.md +description: New Recipe Added - Invidious - self-hosted audiobook / podcast server with native mobile apps +title: Added recipe for Invidious on Docker Swarm +image: /images/invidious.png +--- + +# Added recipe for Invidious (swarm) + +Are you tired of second-guessing the YouTube links your friends send you, afraid that you'll forever see weird videos recommended to you as a result? I found myself avoiding unknown links for this reason, and so deployed an instance of Invidious to act as a private, non-tracking frontend to YouTube.. + + + +![Screenshot of application]({{ page.meta.image }}){ loading=lazy } + +[Invidious](https://invidious.io/) is an open source alternative front-end to YouTube. + +See the [recipe][invidious] for more! + +--8<-- "common-links.md" diff --git a/docs/blog/posts/changelog/updated-recipe-metallb-v4.md b/docs/blog/posts/changelog/updated-recipe-metallb-v4.md index 2b62f2a..48aaf00 100644 --- a/docs/blog/posts/changelog/updated-recipe-metallb-v4.md +++ b/docs/blog/posts/changelog/updated-recipe-metallb-v4.md @@ -5,7 +5,7 @@ categories: tags: - metallb links: - - MetalLB recipe: /kubernetes/loadbalancer/metallb.md + - MetalLB recipe: /kubernetes/loadbalancer/metallb/ title: Updated MetalLB recipe for CRDs with v0.13 description: Prior to v0.13, MetalLB was configured using a ConfigMap. This has all changed now, and CRDs are required to perform configuration (which improves syntax checking, abong other things) --- diff --git a/docs/images/invidious.png b/docs/images/invidious.png new file mode 100644 index 0000000..87f374d Binary files /dev/null and b/docs/images/invidious.png differ diff --git a/docs/recipes/immich.md b/docs/recipes/immich.md index 7d79c4c..6ef494e 100644 --- a/docs/recipes/immich.md +++ b/docs/recipes/immich.md @@ -1,7 +1,6 @@ --- title: Run Immich in Docker Swarm description: How to install your own immich instance using Docker Swarm -status: new --- # Immich in Docker Swarm diff --git a/docs/recipes/invidious.md b/docs/recipes/invidious.md new file mode 100644 index 0000000..c795692 --- /dev/null +++ b/docs/recipes/invidious.md @@ -0,0 +1,169 @@ +--- +title: Invidious, youy Youtube frontend instance in Docker Swarm +description: How to create your own private Youtube frontend using Invidious in Docker Swarm +status: new +--- + +# Invidious: Private Youtube frontend instance in Docker Swarm + +YouTube is ubiquitious now. Almost every video I'm sent, takes me to YouTube. Worse, every YouTube video I watch feeds Google's profile about me, so shortly after enjoying the latest Marvel movie trailers, I find myself seeing related adverts on **unrelated** websites. + +Creepy :bug:! + +As the connection between the videos I watch and the adverts I see has become move obvious, I've become more discerning re which videos I choose to watch, since I don't necessarily **want** algorithmically-related videos popping up next time I load the YouTube app on my TV, or Marvel merchandise advertised to me on every second news site I visit. + +This is a PITA since it means I have to "self-censor" which links I'll even click on, knowing that once I _do_ click the video link, it's forever associated with my Google account :facepalm: + +After playing around with [some of the available public instances](https://docs.invidious.io/instances/) for a while, today I finally deployed my own instance of [Invidious](https://invidious.io/) - an open source alternative front-end to YouTube. + +![Invidious Screenshot](/images/invidious.png){ loading=lazy } + +## Invidious requirements + +!!! summary "Ingredients" + Already deployed: + + * [X] [Docker swarm cluster](/docker-swarm/design/) with [persistent shared storage](/docker-swarm/shared-storage-ceph/) + * [X] [Traefik](/docker-swarm/traefik/) configured per design + + New: + + * [ ] DNS entry for your Invidious instance, pointed to your [keepalived](/docker-swarm/keepalived/) IP + +### Setup data locations + +First, we create a directory to hold the invidious docker-compose configuration: + +```bash +mkdir /var/data/config/invidious +``` + +Then we setup directories to hold all the various data: + +```bash +mkdir -p /var/data/invidious/database-dump +mkdir -p /var/data/runtime/invidious/database +``` + +### Setup Invidious environment + +Create `/var/data/config/invidious/invidious.env` something like the example below.. + +```yaml title="/var/data/config/invidious/invidious.env" +POSTGRES_DB=invidious +POSTGRES_USER=invidious +POSTGRES_PASSWORD=youtubesucks +``` + +Then create `/var/data/config/invidious/invidious-db-backup.env`, like this: + +```yaml title="/var/data/config/invidious/invidious-db-backup.env" +# For pg_dump running in postgres container (used for db-backup) +PGHOST=db +PGUSER=invidious +PGPASSWORD=youtubesucks +BACKUP_NUM_KEEP=7 +BACKUP_FREQUENCY=1d +``` + +### Invidious Docker Swarm config + +Create a docker swarm config file in docker-compose syntax (v3), something like this example[^1]: + +--8<-- "premix-cta.md" + +```yaml title="/var/data/config/invidious/invidious.yml" +version: "3.2" + +services: + invidious: + image: quay.io/invidious/invidious:latest + environment: + INVIDIOUS_CONFIG: | + db: # make sure these values align with the indivious.env file you created + dbname: invidious + user: invidious + password: youtubesucks + host: db + port: 5432 + check_tables: true + external_port: 443 + domain: invidious.example.com # update this for your own domain + https_only: true # because we use Traefik, all access is HTTPS + # statistics_enabled: false + default_user_preferences: + quality: dash # auto-adapts or lets you choose > 720P + env_file: /var/data/config/invidious/invidious.env + deploy: + replicas: 1 + labels: + - "traefik.enable=true" + - "traefik.docker.network=traefik_public" + - "traefik.http.routers.invidious.rule=Host(`invidious.example.com`)" + - "traefik.http.routers.invidious.entrypoints=https" + - "traefik.http.services.invidious.loadbalancer.server.port=3000" + networks: + - internal + - traefik_public + + db: + image: postgres:14 + env_file: /var/data/config/invidious/invidious.env + volumes: + - /var/data/runtime/invidious/database:/var/lib/postgresql/data + networks: + - internal + + db-backup: + image: postgres:14 + env_file: /var/data/config/invidious/invidious-db-backup.env + volumes: + - /var/data/invidious/database-dump:/dump + entrypoint: | + bash -c 'bash -s < /dump/dump_\`date +%d-%m-%Y"_"%H_%M_%S\`.psql + ls -tr /dump/dump_*.psql | head -n -"$$BACKUP_NUM_KEEP" | xargs -r rm + sleep $$BACKUP_FREQUENCY + done + EOF' + networks: + - internal + +networks: + traefik_public: + external: true + internal: + driver: overlay + ipam: + config: + - subnet: 172.16.21.0/24 +``` + +--8<-- "reference-networks.md" + +## Launch Invidious! + +Launch the Invidious stack by running + +```bash +docker stack deploy invidious -c /var/data/config/invidious/invidious.yml +``` + +Now hit the URL you defined in your config, you'll see the basic search screen. Enter a search phrase (*"marvel movie trailer"*) to see the YouTube video results, or paste in a YouTube URL such as `https://www.youtube.com/watch?v=bxqLsrlakK8`, change the domain name from `www.youtube.com` to your instance's FQDN, and watch the fun [^2]! + +## Summary + +What have we achieved? We have an HTTPS-protected private YouTube frontend - we can now watch whatever videos we please, without feeding Google's profile on us. We can also subscribe to channels without requiring a Google account, and we can share individual videos directly via our instance (*by generating links*). + +!!! summary "Summary" + Created: + + * [X] We are free of the creepy tracking attached to YouTube videos! + +--8<-- "recipe-footer.md" + +[^1]: Check out the [official config docs](https://github.com/iv-org/invidious/blob/master/config/config.example.yml) for comprehensive details on how to configure / tweak your instance! +[^2]: Gotcha! diff --git a/docs/reference/networks.md b/docs/reference/networks.md index 15d1067..f193803 100644 --- a/docs/reference/networks.md +++ b/docs/reference/networks.md @@ -31,6 +31,7 @@ In order to avoid IP addressing conflicts as we bring swarm networks up/down, we | [Calibre-Web](/recipes/calibre-web/) | 172.16.18.0/24 | | [Wallabag](/recipes/wallabag/) | 172.16.19.0/24 | | [InstaPy](/recipes/instapy/) | 172.16.20.0/24 | +| [Invidious](/recipes/invidious/) | 172.16.21.0/24 | | [MiniFlux](/recipes/miniflux/) | 172.16.22.0/24 | | [Gitlab Runner](/recipes/gitlab-runner/) | 172.16.23.0/24 | | [Bookstack](/recipes/bookstack/) | 172.16.33.0/24 | diff --git a/mkdocs.yml b/mkdocs.yml index 33ac0d1..5a81b40 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -124,6 +124,7 @@ nav: - Gollum: recipes/gollum.md - Immich: recipes/immich.md - InstaPy: recipes/instapy.md + - Invidious: recipes/invidious.md - Jellyfin: recipes/jellyfin.md - Keycloak: - recipes/keycloak/index.md