diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f733c4b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +config/ diff --git a/configure-instance.sh b/configure-instance.sh new file mode 100755 index 0000000..76d7899 --- /dev/null +++ b/configure-instance.sh @@ -0,0 +1,16 @@ +echo "Enter a hostname for the Frontend (eg: piped.kavin.rocks):" +read frontend + +echo "Enter a hostname for the Backend (eg: pipedapi.kavin.rocks):" +read backend + +echo "Enter a hostname for the Proxy (eg: pipedproxy.kavin.rocks):" +read proxy + +rm -rf config/ + +cp -r template/ config/ + +sed -i "s/FRONTEND_HOSTNAME/$frontend/g" config/* +sed -i "s/BACKEND_HOSTNAME/$backend/g" config/* +sed -i "s/PROXY_HOSTNAME/$proxy/g" config/* diff --git a/docker-compose.yml b/docker-compose.yml index 5462a9a..0fcd52c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,7 +9,7 @@ services: image: 1337kavin/ytproxy:latest restart: unless-stopped volumes: - - ./ytproxy:/app/socket + - ytproxy:/app/socket container_name: ytproxy piped: image: 1337kavin/piped:latest @@ -34,8 +34,9 @@ services: - "443:443" volumes: - ./config/Caddyfile:/etc/caddy/Caddyfile - - ./caddy/config:/config - - ./ytproxy:/var/run/ytproxy + - caddy_data:/data + - caddy_config:/config + - ytproxy:/var/run/ytproxy container_name: caddy postgres: image: postgres:13-alpine @@ -58,3 +59,7 @@ services: - WATCHTOWER_INCLUDE_RESTARTING=true container_name: watchtower command: piped-frontend piped-backend ytproxy varnish caddy postgres watchtower +volumes: + caddy_data: + caddy_config: + ytproxy: diff --git a/config/Caddyfile b/template/Caddyfile similarity index 81% rename from config/Caddyfile rename to template/Caddyfile index 6b29895..bc4d3af 100644 --- a/config/Caddyfile +++ b/template/Caddyfile @@ -1,19 +1,22 @@ -piped.domain.tld { +FRONTEND_HOSTNAME { reverse_proxy pipedfrontend:80 } -pipedapi.domain.tld { +BACKEND_HOSTNAME { reverse_proxy varnish:80 } -pipedproxy.domain.tld { +PROXY_HOSTNAME { + + header_upstream -CF-Connecting-IP + header_upstream -X-Forwarded-For @ytproxy path /videoplayback* /api/v4/* /api/manifest/* @optionscall { method OPTIONS - } + } header Access-Control-Allow-Origin * header Access-Control-Allow-Headers * @@ -22,7 +25,6 @@ pipedproxy.domain.tld { header @ytproxy { Cache-Control private always - CF-Connecting-IP "" } header / { @@ -38,4 +40,3 @@ pipedproxy.domain.tld { } } } - diff --git a/config/config.properties b/template/config.properties similarity index 88% rename from config/config.properties rename to template/config.properties index a2d26d0..2020201 100644 --- a/config/config.properties +++ b/template/config.properties @@ -5,7 +5,7 @@ PORT: 8080 HTTP_WORKERS: 2 # Proxy -PROXY_PART: https://pipedproxy.domain.tld +PROXY_PART: https://PROXY_HOSTNAME # Outgoing HTTP Proxy - eg: 127.0.0.1:8118 #HTTP_PROXY: 127.0.0.1:8118 @@ -15,7 +15,7 @@ CAPTCHA_BASE_URL: https://api.capmonster.cloud/ CAPTCHA_API_KEY: INSERT_HERE # Public API URL -API_URL: https://pipedapi.domain.tld +API_URL: https://BACKEND_HOSTNAME # Hibernate properties hibernate.connection.url: jdbc:postgresql://postgres:5432/piped diff --git a/config/default.vcl b/template/default.vcl similarity index 100% rename from config/default.vcl rename to template/default.vcl