Open sharifm-informatica opened 1 week ago
Hey @sharifm-informatica sorry for the delay, do you have a docker compose file to reproduce this with the command line run ran to build the instance (maybe Dockerfile)?
Sure:
FROM caddy:2-builder AS builder
RUN xcaddy build --with github.com/caddyserver/cache-handler --with github.com/darkweak/storages/redis/caddy
FROM caddy:2
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
Also:
FROM caddy:2-builder AS builder
RUN xcaddy build --with github.com/darkweak/souin/plugins/caddy --with github.com/darkweak/storages/go-redis/caddy
FROM caddy:2
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
version: "3.8"
services:
caddy:
# image: caddy:alpine
build:
context: ./caddy-cache
# context: ./caddy-souin
dockerfile: Dockerfile
restart: unless-stopped
volumes:
- caddy_data:/data
- caddy_config:/config
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- ./html/public:/srv/public:ro
cap_add:
- NET_ADMIN
ports:
- "80:80"
- "443:443"
- "443:443/udp"
depends_on:
- phpfpm
- redis-caddy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://caddy/healthcheck"]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
networks:
default:
deploy:
resources:
limits:
cpus: "0.7"
memory: "100M"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
security_opt:
- no-new-privileges:true
read_only: true
tmpfs:
- /tmp
redis-caddy:
image: valkey/valkey:8.0-alpine
restart: unless-stopped
volumes:
- redis_caddy_data:/data
- ./redis-caddy.conf:/usr/local/etc/redis/redis.conf:ro
command: ["redis-server", "/usr/local/etc/redis/redis.conf"]
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 3
start_period: 5s
deploy:
resources:
limits:
cpus: "0.5"
memory: "100M"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
security_opt:
- no-new-privileges:true
read_only: true
volumes:
caddy_data:
external: true
caddy_config:
redis_caddy_data:
external: true
networks:
default:
driver: bridge
Not sure if it is a problem with Valkey specifically. But keys are stored empty in redis/Valkey. Here is the cache part of my Caddyfile for redis:
All requests from Souin are uri-miss although the key is inthe Valkey DB. There is an error returned in the header of each request UPSTREAM-ERROR-OR-EMPTY-RESPONSE. ?I can see the pings and queries in valkey so netowrking and communication is not an issue. I expect Valkey to be 100% compatible with redis. Not sure if it is the factor here.