diff --git a/piped/.env b/piped/.env new file mode 100644 index 0000000..20b5068 --- /dev/null +++ b/piped/.env @@ -0,0 +1,18 @@ +#GLOBAL SETTINGS +COMPOSE_HTTP_TIMEOUT=120 +COMPOSE_IGNORE_ORPHANS=1 +DOCKER_CONFIGS=./appdata +DOCKERGID=999 +DOCKERHOSTNAME=DockerServer +DOCKERLOGGING_MAXFILE=10 +DOCKERLOGGING_MAXSIZE=200k +SERVERIP=192.168.1.33 +PGID=1000 +PUID=1000 +UMASK=000 +TZ=America/Chicago +ADMIN_USERNAME=akanealw +ADMIN_PASSWORD=8ung1e1! +BACKUP_DIR=/mnt/truenas-backups +MEDIA_DIR=/mnt/truenas-media +STORAGE_DIR=/mnt/truenas-storage diff --git a/piped/config.properties b/piped/config.properties new file mode 100644 index 0000000..13e9419 --- /dev/null +++ b/piped/config.properties @@ -0,0 +1,37 @@ +# The port to Listen on. +PORT: 8080 + +# The number of workers to use for the server +HTTP_WORKERS: 2 + +# Proxy +PROXY_PART: https://pipedproxy.akanealw.com + +# Outgoing HTTP Proxy - eg: 127.0.0.1:8118 +#HTTP_PROXY: 127.0.0.1:8118 + +# Captcha Parameters +CAPTCHA_BASE_URL: https://api.capmonster.cloud/ +CAPTCHA_API_KEY: INSERT_HERE + +# Public API URL +API_URL: https://pipedapi.akanealw.com + +# Public Frontend URL +FRONTEND_URL: https://piped.akanealw.com + +# 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://piped-postgres:5432/piped +hibernate.connection.driver_class: org.postgresql.Driver +hibernate.dialect: org.hibernate.dialect.PostgreSQLDialect +hibernate.connection.username: piped +hibernate.connection.password: Vee0caiv8ieceeDae1aepheirophai diff --git a/piped/docker-compose.yml b/piped/docker-compose.yml new file mode 100644 index 0000000..c4f8632 --- /dev/null +++ b/piped/docker-compose.yml @@ -0,0 +1,56 @@ +version: '3' + +services: + piped-frontend: + image: 1337kavin/piped-frontend:latest + restart: unless-stopped + depends_on: + - piped + container_name: piped-frontend + entrypoint: ash -c 'sed -i s/pipedapi.kavin.rocks/pipedapi.akanealw.com/g /usr/share/nginx/html/assets/* && /docker-entrypoint.sh && nginx -g "daemon off;"' + piped-proxy: + image: 1337kavin/piped-proxy:latest + restart: unless-stopped + environment: + - UDS=1 + volumes: + - ${DOCKER_CONFIGS}/piped/piped-proxy:/app/socket + container_name: piped-proxy + piped: + image: 1337kavin/piped:latest + restart: unless-stopped + volumes: + - ${DOCKER_CONFIGS}/piped/config/config.properties:/app/config.properties:ro + depends_on: + - piped-postgres + container_name: piped-backend + piped-nginx: + image: nginx:mainline-alpine + restart: unless-stopped + ports: + - "8080:80" + volumes: + - ${DOCKER_CONFIGS}/piped/config/nginx.conf:/etc/nginx/nginx.conf:ro + - ${DOCKER_CONFIGS}/piped/config/pipedapi.conf:/etc/nginx/conf.d/pipedapi.conf:ro + - ${DOCKER_CONFIGS}/piped/config/pipedproxy.conf:/etc/nginx/conf.d/pipedproxy.conf:ro + - ${DOCKER_CONFIGS}/piped/config/pipedfrontend.conf:/etc/nginx/conf.d/pipedfrontend.conf:ro + - ${DOCKER_CONFIGS}/piped/config/ytproxy.conf:/etc/nginx/snippets/ytproxy.conf:ro + - ${DOCKER_CONFIGS}/piped/piped-proxy:/var/run/ytproxy + container_name: piped-nginx + depends_on: + - piped + - piped-proxy + - piped-frontend + piped-postgres: + image: postgres:15 + restart: unless-stopped + volumes: + - ${DOCKER_CONFIGS}/piped/data/db:/var/lib/postgresql/data + environment: + - POSTGRES_DB=piped + - POSTGRES_USER=piped + - POSTGRES_PASSWORD=Vee0caiv8ieceeDae1aepheirophai + container_name: piped-postgres + +networks: + piped: diff --git a/piped/nginx.conf b/piped/nginx.conf new file mode 100644 index 0000000..2ba7091 --- /dev/null +++ b/piped/nginx.conf @@ -0,0 +1,33 @@ +user root; +worker_processes auto; + +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + server_names_hash_bucket_size 128; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + tcp_nodelay on; + + keepalive_timeout 65; + + resolver 127.0.0.11 ipv6=off valid=10s; + + include /etc/nginx/conf.d/*.conf; +} diff --git a/piped/pipedapi.conf b/piped/pipedapi.conf new file mode 100644 index 0000000..c8e136c --- /dev/null +++ b/piped/pipedapi.conf @@ -0,0 +1,15 @@ +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 pipedapi.akanealw.com; + + set $backend "http://piped:8080"; + + location / { + proxy_cache pipedapi; + proxy_pass $backend; + proxy_http_version 1.1; + proxy_set_header Connection "keep-alive"; + } +} diff --git a/piped/pipedfrontend.conf b/piped/pipedfrontend.conf new file mode 100644 index 0000000..e9d8de2 --- /dev/null +++ b/piped/pipedfrontend.conf @@ -0,0 +1,12 @@ +server { + listen 80; + server_name piped.akanealw.com; + + set $backend "http://piped-frontend:80"; + + location / { + proxy_pass $backend; + proxy_http_version 1.1; + proxy_set_header Connection "keep-alive"; + } +} diff --git a/piped/pipedproxy.conf b/piped/pipedproxy.conf new file mode 100644 index 0000000..3dbdb3d --- /dev/null +++ b/piped/pipedproxy.conf @@ -0,0 +1,14 @@ +server { + listen 80; + server_name pipedproxy.akanealw.com; + + location ~ (/videoplayback|/api/v4/|/api/manifest/) { + include snippets/ytproxy.conf; + add_header Cache-Control private always; + } + + location / { + include snippets/ytproxy.conf; + add_header Cache-Control "public, max-age=604800"; + } +} diff --git a/piped/ytproxy.conf b/piped/ytproxy.conf new file mode 100644 index 0000000..4fd36f1 --- /dev/null +++ b/piped/ytproxy.conf @@ -0,0 +1,18 @@ +proxy_buffering on; +proxy_buffers 1024 16k; +proxy_set_header X-Forwarded-For ""; +proxy_set_header CF-Connecting-IP ""; +proxy_hide_header "alt-svc"; +sendfile on; +sendfile_max_chunk 512k; +tcp_nopush on; +aio threads=default; +aio_write on; +directio 16m; +proxy_hide_header Cache-Control; +proxy_hide_header etag; +proxy_http_version 1.1; +proxy_set_header Connection keep-alive; +proxy_max_temp_file_size 32m; +access_log off; +proxy_pass http://unix:/var/run/ytproxy/actix.sock;