I had two major problems configuring and using Materialious with NGINX Proxy Manager;
Can't login - Materialious/Materialious#29
No thumbnails - Materialious/Materialious#24
Invidious is single-threaded, therefore I choose to use a slightly different setup for a much better performance (multi-threaded).
Edit:
domain: invidious.example.com
hmac_key: "CHANGE_ME!!"
VITE_DEFAULT_INVIDIOUS_INSTANCE: "https://invidious.example"
version: "3"
services:
invidious:
image: quay.io/invidious/invidious:latest
deploy:
replicas: 6
restart: unless-stopped
environment:
INVIDIOUS_CONFIG: |
channel_threads: 0
feed_threads: 0
db:
dbname: invidious
user: kemal
password: kemal
host: invidious-db
port: 5432
check_tables: true
external_port: 443
domain: invidious.example.com
https_only: true
statistics_enabled: true
hmac_key: "CHANGE_ME!!"
healthcheck:
test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/trending || exit 1
interval: 30s
timeout: 5s
retries: 2
logging:
options:
max-size: "1G"
max-file: "4"
depends_on:
- invidious-db
invidious-refresh:
image: quay.io/invidious/invidious:latest
restart: unless-stopped
environment:
INVIDIOUS_CONFIG: |
db:
dbname: invidious
user: kemal
password: kemal
host: invidious-db
port: 5432
check_tables: true
check_tables: true
external_port: 443
domain: invidious.example.com
https_only: true
statistics_enabled: true
hmac_key: "CHANGE_ME!!"
healthcheck:
test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/trending || exit 1
interval: 30s
timeout: 5s
retries: 2
logging:
options:
max-size: "1G"
max-file: "4"
depends_on:
- invidious-db
nginx:
image: nginx:latest
restart: unless-stopped
volumes:
- /opt/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- invidious
ports:
- "3000:3000"
invidious-db:
image: docker.io/library/postgres:14
restart: unless-stopped
volumes:
- postgresdata:/var/lib/postgresql/data
- ./config/sql:/config/sql
- ./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"]
materialious:
image: wardpearce/materialious:latest
restart: unless-stopped
ports:
- 3001:80
environment:
VITE_DEFAULT_INVIDIOUS_INSTANCE: "https://invidious.example"
VITE_DEFAULT_RETURNYTDISLIKES_INSTANCE: "https://returnyoutubedislikeapi.com"
VITE_DEFAULT_SPONSERBLOCK_INSTANCE: "https://sponsor.ajay.app"
VITE_DEFAULT_DEARROW_INSTANCE: "https://sponsor.ajay.app"
VITE_DEFAULT_DEARROW_THUMBNAIL_INSTANCE: "https://dearrow-thumb.ajay.app"
VITE_DEFAULT_SETTINGS: '{"themeColor": "#2596be"}'
volumes:
postgresdata:
Update your cronjobs to restart Invidious automatically.
crontab -e
0 */1 * * * docker restart invidious-invidious-1
1 */1 * * * docker restart invidious-invidious-2
2 */1 * * * docker restart invidious-invidious-3
3 */1 * * * docker restart invidious-invidious-4
4 */1 * * * docker restart invidious-invidious-5
5 */1 * * * docker restart invidious-invidious-6
Create 2 new Proxy Hosts.
Tab: Details - Create a new proxy host with SSL on (Let's Encrypt or your own certificate) and click SAVE.
- Tab: Details - Create a new proxy host with SSL on (Let's Encrypt or your own certificate).
- Tab: Custom locations, fill in IP and port. Click gear icon to add some security headers.
Add:
if ($request_method = OPTIONS) {
return 204;
}
proxy_hide_header Access-Control-Allow-Origin;
add_header Access-Control-Allow-Credentials true;
add_header Access-Control-Allow-Origin "https://materialious.example.com" always;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS, HEAD, PATCH, PUT, DELETE" always;
add_header Access-Control-Allow-Headers "User-Agent, Authorization, Content-Type" always;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;
Edit:
add_header Access-Control-Allow-Origin "https://materialious.example.com" always;
- Click SAVE.