diff --git a/compose.yml b/compose.yml index 13bea24..ef9a4e8 100644 --- a/compose.yml +++ b/compose.yml @@ -13,6 +13,7 @@ services: spam:https://ipv64.net/blocklists/ipv64_blocklist_firehole_l1.txt|https://rules.emergingthreats.net/blocklist/compromised-ips.txt # Redis-Adresse schon per Docker-Netzwerk korrekt: REDIS_ADDR: redis:6379 + ROLE: worker TTL_HOURS: "720" ports: - "8080:8080" # : @@ -21,21 +22,14 @@ services: redis: image: redis:7-alpine container_name: ipblock-redis + ports: + - "6379:6379" networks: - flod_nw - command: - - redis-server - - --bind - - 0.0.0.0 - - --protected-mode - - "no" # nur nötig, wenn Port 6379 veröffentlicht wird - - --save # leere save-Liste = kein RDB-Snapshot - - "/data/dump.rdb" # ^^^ - - --appendonly - - "no" - + command: ["redis-server", "/usr/local/etc/redis/redis.conf"] volumes: - redis-data:/data # falls du doch Persistence willst + - /home/groot/flod/redis.conf:/usr/local/etc/redis/redis.conf:ro restart: unless-stopped newt: diff --git a/main.go b/main.go index 1cb2913..d2709f8 100644 --- a/main.go +++ b/main.go @@ -314,6 +314,7 @@ func subscribeKeyspace(ctx context.Context, rdb *redis.Client, ranger *Ranger) { pubsub := rdb.PSubscribe(ctx, "__keyspace@0__:bl:*", "__keyspace@0__:wl:*") go func() { for msg := range pubsub.Channel() { + fmt.Println(msg) key := strings.TrimPrefix(msg.Channel, "__keyspace@0__:") payload := msg.Payload if strings.HasPrefix(key, "wl:") { diff --git a/redis.conf b/redis.conf new file mode 100644 index 0000000..3419daf --- /dev/null +++ b/redis.conf @@ -0,0 +1,36 @@ +####################################### +# Netzwerk +####################################### +bind 0.0.0.0 +protected-mode no +port 6379 + +####################################### +# Laufzeit (Container-freundlich) +####################################### +daemonize no +pidfile /var/run/redis.pid +logfile "" + +####################################### +# Speicherort für alle persistenten Dateien +####################################### +dir /data + +####################################### +# AOF-Persistenz (empfohlen für moderne Redis-Setups) +####################################### +appendonly yes +appendfilename "appendonly.aof" +# automatische AOF-Rewrite-Grenzen (Defaults sind OK, hier explizit) +auto-aof-rewrite-percentage 100 +auto-aof-rewrite-min-size 64mb + +####################################### +# RDB-Snapshots (optional, ergänzen Defaults) +####################################### +save 900 1 +save 300 10 +save 60 10000 +dbfilename dump.rdb +notify-keyspace-events K$ \ No newline at end of file