This commit is contained in:
16
compose.yml
16
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" # <host>:<container>
|
||||
@@ -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:
|
||||
|
1
main.go
1
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:") {
|
||||
|
36
redis.conf
Normal file
36
redis.conf
Normal file
@@ -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$
|
Reference in New Issue
Block a user