Use nginx to cache responses.

This commit is contained in:
Kavin 2022-08-07 06:59:23 +05:30
parent 0a6f6c557b
commit 2480d0dffb
No known key found for this signature in database
GPG Key ID: 49451E4482CC5BCD
2 changed files with 4 additions and 15 deletions

View File

@ -22,19 +22,6 @@ services:
depends_on:
- postgres
container_name: piped-backend
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
nginx:
image: nginx:mainline-alpine
restart: unless-stopped
@ -50,7 +37,6 @@ services:
container_name: nginx
depends_on:
- piped
- varnish
- ytproxy
- pipedfrontend
postgres:

View File

@ -1,10 +1,13 @@
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://varnish:80";
set $backend "http://piped:8080";
location / {
proxy_cache pipedapi;
proxy_pass $backend;
proxy_http_version 1.1;
proxy_set_header Connection "keep-alive";