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
|
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-Adresse schon per Docker-Netzwerk korrekt:
|
||||||
REDIS_ADDR: redis:6379
|
REDIS_ADDR: redis:6379
|
||||||
|
ROLE: worker
|
||||||
TTL_HOURS: "720"
|
TTL_HOURS: "720"
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080" # <host>:<container>
|
- "8080:8080" # <host>:<container>
|
||||||
@@ -21,21 +22,14 @@ services:
|
|||||||
redis:
|
redis:
|
||||||
image: redis:7-alpine
|
image: redis:7-alpine
|
||||||
container_name: ipblock-redis
|
container_name: ipblock-redis
|
||||||
|
ports:
|
||||||
|
- "6379:6379"
|
||||||
networks:
|
networks:
|
||||||
- flod_nw
|
- flod_nw
|
||||||
command:
|
command: ["redis-server", "/usr/local/etc/redis/redis.conf"]
|
||||||
- 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"
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- redis-data:/data # falls du doch Persistence willst
|
- redis-data:/data # falls du doch Persistence willst
|
||||||
|
- /home/groot/flod/redis.conf:/usr/local/etc/redis/redis.conf:ro
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
newt:
|
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:*")
|
pubsub := rdb.PSubscribe(ctx, "__keyspace@0__:bl:*", "__keyspace@0__:wl:*")
|
||||||
go func() {
|
go func() {
|
||||||
for msg := range pubsub.Channel() {
|
for msg := range pubsub.Channel() {
|
||||||
|
fmt.Println(msg)
|
||||||
key := strings.TrimPrefix(msg.Channel, "__keyspace@0__:")
|
key := strings.TrimPrefix(msg.Channel, "__keyspace@0__:")
|
||||||
payload := msg.Payload
|
payload := msg.Payload
|
||||||
if strings.HasPrefix(key, "wl:") {
|
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