Skip to main content

Invidious

Create /srv/path/Files/Invidious/docker/

cd /srv/path/Files/Invidious/docker/

Create / download init-invidious-db.sh

#!/bin/bash
set -eou pipefail

psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/channels.sql
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/videos.sql
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/channel_videos.sql
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/users.sql
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/session_ids.sql
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/nonces.sql
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/annotations.sql
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/playlists.sql
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/playlist_videos.sql

Stack

version: "3"
services:

  invidious:
    image: quay.io/invidious/invidious:latest
    # image: quay.io/invidious/invidious:latest-arm64 # ARM64/AArch64 devices
    restart: unless-stopped
    ports:
      - "3000:3000"
    environment:
      # Please read the following file for a comprehensive list of all available
      # configuration options and their associated syntax:
      # https://github.com/iv-org/invidious/blob/master/config/config.example.yml
      INVIDIOUS_CONFIG: |
        db:
          dbname: invidious
          user: kemal
          password: yourpassword
          host: invidious-db
          port: 5432
        admins: ["yourusername"]
        check_tables: true
        external_port: 443
        domain: tube.steph.bond  # Don't put "https://"
        https_only: true
        statistics_enabled: true
    healthcheck:
      test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/comments/jNQXAC9IVRw || exit 1
      interval: 30s
      timeout: 5s
      retries: 2
    depends_on:
      - invidious-db

  invidious-db:
    image: docker.io/library/postgres:10
    restart: unless-stopped
    volumes:
      - /srv/path/Files/Invidious/postgresdata:/var/lib/postgresql/data
      - /srv/path/Files/Invidious/config/sql:/config/sql
      - /srv/path/Files/Invidious/docker/init-invidious-db.sh:/docker-entrypoint-initdb.d/init-invidious-db.sh
    environment:
      POSTGRES_DB: invidious
      POSTGRES_USER: kemal
      POSTGRES_PASSWORD: yourpassword
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]

volumes:
  postgresdata:

The environment variable POSTGRES_USER cannot be changed. The SQL config files that run the initial database migrations are hard-coded with the username kemal.

Same goes with environment variable port . Stick to 3000:3000 and change other service port if needed.

Detailed post-install configuration available in the configuration guide.

If you use a reverse proxy, you must configure invidious to properly serve request through it:

https_only: true : if your are serving your instance via https, set it to true
domain: domain.ext: if you are serving your instance via a domain name, set it here (no "https://")
external_port: 443: if your are serving your instance via https, set it to 443

Env variables must be put after INVIDIOUS_CONFIG: | in the compose file

 

 

OLD VERSION

version: "3.3"
services:
  postgres:
    image: postgres:10
    restart: unless-stopped
    networks:
      - invidious
    volumes:
      - /srv/path/Files/Invidious/postgresdata:/var/lib/postgresql/data
      - /srv/path/Files/Invidious/config/sql:/config/sql
      - /srv/path/Files/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"]
  invidious:
    image: quay.io/invidious/invidious:latest
    restart: unless-stopped
    networks:
      - invidious
    mem_limit: 1024M
    cpus: 0.5
    ports:
      - "3000:3000"
    environment:
      INVIDIOUS_CONFIG: |
        channel_threads: 1
        check_tables: true
        feed_threads: 1
        admins: [""]
        db:
          dbname: invidious
          user: kemal
          password: kemal
          host: postgres
          port: 5432
        full_refresh: false
        https_only: false
      # domain:
      # external_port:
    healthcheck:
      test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/comments/jNQXAC9IVRw || exit 1
      interval: 30s
      timeout: 5s
      retries: 2
    depends_on:
      - postgres
  autoheal:
    restart: unless-stopped
    image: willfarrell/autoheal
    environment:
      - AUTOHEAL_CONTAINER_LABEL=all
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

volumes:
  postgresdata:

networks:
  invidious:

The environment variable POSTGRES_USER cannot be changed. The SQL config files that run the initial database migrations are hard-coded with the username kemal.

Same goes with environment variable port . Stick to 3000:3000 and change other service port if needed.

Detailed post-install configuration available in the configuration guide.

Because of various issues Invidious must be restarted often, at least once a day, ideally every hours.

If you use a reverse proxy, you must configure invidious to properly serve request through it:

https_only: true : if your are serving your instance via https, set it to true
domain: domain.ext: if you are serving your instance via a domain name, set it here
external_port: 443: if your are serving your instance via https, set it to 443

Env variables must be put after INVIDIOUS_CONFIG: | in the compose file