diff --git a/configure-instance.sh b/configure-instance.sh index 04b4adc..ffbbeee 100644 --- a/configure-instance.sh +++ b/configure-instance.sh @@ -1,18 +1,4 @@ -# Check if Docker-Compose is not installed -if [ -z "$(which docker-compose)" ]; then - echo "Docker-Compose is not installed. Please install it first from https://docs.docker.com/compose/install/#install-compose." - exit 1 -fi - -# Docker-Compose version check, to prevent "Unsupported configuration option" -COMPOSE_VERSION=$(docker-compose version --short) -REQUIRED_COMPOSE_VERSION="1.28.0" -if [[ $(printf '%s\n' "$REQUIRED_COMPOSE_VERSION" "$COMPOSE_VERSION" | sort -V | head -n1) != $REQUIRED_COMPOSE_VERSION ]]; then - echo "Your docker-compose version of $COMPOSE_VERSION is too old. Please upgrade to $REQUIRED_COMPOSE_VERSION or higher." - echo "See https://docs.docker.com/compose/install/#install-compose for installation instructions." - exit 1 -fi - +#!/usr/bin/env bash echo "Enter a hostname for the Frontend (eg: piped.kavin.rocks):" && read -r frontend echo "Enter a hostname for the Backend (eg: pipedapi.kavin.rocks):" && read -r backend echo "Enter a hostname for the Proxy (eg: pipedproxy.kavin.rocks):" && read -r proxy diff --git a/template/Caddyfile b/template/Caddyfile index 79bad50..6d80991 100644 --- a/template/Caddyfile +++ b/template/Caddyfile @@ -1,61 +1,32 @@ -{ - servers :443 { - protocol { - experimental_http3 - } +(global) { + header { + # disable FLoC tracking + Permissions-Policy interest-cohort=() + + # enable HSTS + Strict-Transport-Security max-age=31536000; + + # keep referrer data off + Referrer-Policy no-referrer + + # prevent for appearing in search engine for private instances (option) + #X-Robots-Tag noindex } } FRONTEND_HOSTNAME { reverse_proxy pipedfrontend:80 - header { - # disable FLoC tracking - Permissions-Policy interest-cohort=() - - # enable HSTS - Strict-Transport-Security max-age=31536000; - - # keep referrer data off - Referrer-Policy no-referrer - - # prevent for appearing in search engine for private instances (option) - #X-Robots-Tag noindex - } + import global } BACKEND_HOSTNAME { reverse_proxy varnish:80 - header { - # disable FLoC tracking - Permissions-Policy interest-cohort=() - - # enable HSTS - Strict-Transport-Security max-age=31536000; - - # keep referrer data off - Referrer-Policy no-referrer - - # prevent for appearing in search engine for private instances (option) - #X-Robots-Tag noindex - } + import global } PROXY_HOSTNAME { @ytproxy path /videoplayback* /api/v4/* /api/manifest/* - - header { - # disable FLoC tracking - Permissions-Policy interest-cohort=() - - # enable HSTS - Strict-Transport-Security max-age=31536000; - - # keep referrer data off - Referrer-Policy no-referrer - - # prevent for appearing in search engine for private instances (option) - #X-Robots-Tag noindex - } + import global route { header @ytproxy { diff --git a/template/config.properties b/template/config.properties index fc1050a..ef1686f 100644 --- a/template/config.properties +++ b/template/config.properties @@ -20,9 +20,18 @@ API_URL: https://BACKEND_HOSTNAME # Public Frontend URL FRONTEND_URL: https://FRONTEND_HOSTNAME +# Enable haveibeenpwned compromised password API +COMPROMISED_PASSWORD_CHECK: true + +# Disable Registration +DISABLE_REGISTRATION: false + +# Feed Retention Time in Days +FEED_RETENTION: 30 + # Hibernate properties hibernate.connection.url: jdbc:postgresql://postgres:5432/piped hibernate.connection.driver_class: org.postgresql.Driver -hibernate.dialect: org.hibernate.dialect.PostgreSQL10Dialect +hibernate.dialect: org.hibernate.dialect.PostgreSQLDialect hibernate.connection.username: piped hibernate.connection.password: changeme diff --git a/template/default.vcl b/template/default.vcl index 2cb3b70..89f0fb7 100644 --- a/template/default.vcl +++ b/template/default.vcl @@ -1,5 +1,5 @@ vcl 4.0; backend default { - .host = "piped:8080"; + .host = "piped-backend:8080"; } diff --git a/template/docker-compose.caddy.yml b/template/docker-compose.caddy.yml index c754974..d76cc90 100644 --- a/template/docker-compose.caddy.yml +++ b/template/docker-compose.caddy.yml @@ -1,3 +1,5 @@ +version: "3" + services: pipedfrontend: image: 1337kavin/piped-frontend:latest diff --git a/template/docker-compose.nginx.yml b/template/docker-compose.nginx.yml index cdce90d..4a42069 100644 --- a/template/docker-compose.nginx.yml +++ b/template/docker-compose.nginx.yml @@ -1,3 +1,5 @@ +version: "3" + services: pipedfrontend: image: 1337kavin/piped-frontend:latest @@ -26,21 +28,6 @@ services: container_name: piped-backend labels: com.centurylinklabs.watchtower.scope: piped - varnish: - image: varnish:7.0-alpine - restart: unless-stopped - volumes: - - ./config/default.vcl:/etc/varnish/default.vcl:ro - container_name: varnish - depends_on: - - piped - healthcheck: - test: ash -c "wget --no-verbose --tries=1 --spider 127.0.0.1:80/feed || (varnishreload && exit 1)" - interval: 10s - timeout: 10s - retries: 1 - labels: - com.centurylinklabs.watchtower.scope: piped nginx: image: nginx:mainline-alpine restart: unless-stopped @@ -56,7 +43,6 @@ services: container_name: nginx depends_on: - piped - - varnish - ytproxy - pipedfrontend labels: diff --git a/template/nginx.conf b/template/nginx.conf index 28d54bf..a4cfa4f 100644 --- a/template/nginx.conf +++ b/template/nginx.conf @@ -25,7 +25,7 @@ http { keepalive_timeout 65; - gzip on; + resolver 127.0.0.11 ipv6=off valid=10s; include /etc/nginx/conf.d/*.conf; } diff --git a/template/pipedapi.conf b/template/pipedapi.conf index e039caf..69db81f 100644 --- a/template/pipedapi.conf +++ b/template/pipedapi.conf @@ -1,9 +1,14 @@ +proxy_cache_path /tmp/pipedapi_cache levels=1:2 keys_zone=pipedapi:4m max_size=2g inactive=60m use_temp_path=off; + server { listen 80; server_name BACKEND_HOSTNAME; + set $backend "http://piped:8080"; + location / { - proxy_pass http://varnish:80; + proxy_cache pipedapi; + proxy_pass $backend; proxy_http_version 1.1; proxy_set_header Connection "keep-alive"; } diff --git a/template/pipedfrontend.conf b/template/pipedfrontend.conf index 8e3d442..50c7da2 100644 --- a/template/pipedfrontend.conf +++ b/template/pipedfrontend.conf @@ -2,8 +2,10 @@ server { listen 80; server_name FRONTEND_HOSTNAME; + set $backend "http://pipedfrontend:80"; + location / { - proxy_pass http://pipedfrontend:80; + proxy_pass $backend; proxy_http_version 1.1; proxy_set_header Connection "keep-alive"; }