feat(valkey): migrate redis to valkey and fix updater custom prefix selection

Replace redis:7-alpine with valkey:8.0-alpine and configure MaintNotificationsConfig ModeDisabled to suppress handshake warnings on Valkey. Resolve updater bug by dynamically matching custom repository asset name prefixes like PixezSync.
This commit is contained in:
ryan
2026-06-12 15:39:28 +08:00
parent 3228574a8c
commit 50d21b431b
7 changed files with 52 additions and 21 deletions
+14 -14
View File
@@ -47,20 +47,6 @@ database:
# - host: "replica2.db.internal"
# port: 5432
# ─── ClickHouse (optional) ──────────────────────────────────────────────────────
clickhouse:
enabled: false
hosts:
- "127.0.0.1:9000"
username: "default"
password: ""
database: "wavelet"
max_idle_conn: 10
max_open_conn: 100
conn_max_lifetime: 3600
dial_timeout: 5
block_buffer_size: 10
# ─── Redis ──────────────────────────────────────────────────────────────────────
# Supports Standalone, Sentinel (HA), and Cluster modes.
redis:
@@ -125,3 +111,17 @@ s3:
local_cache:
enabled: false
cache_dir: "./s3_cache"
# ─── ClickHouse (optional) ──────────────────────────────────────────────────────
clickhouse:
enabled: false
hosts:
- "127.0.0.1:9000"
username: "default"
password: ""
database: "wavelet"
max_idle_conn: 10
max_open_conn: 100
conn_max_lifetime: 3600
dial_timeout: 5
block_buffer_size: 10
+4 -4
View File
@@ -41,15 +41,15 @@ services:
start_period: 10s
redis:
image: redis:7-alpine
image: valkey/valkey:8.0-alpine
restart: unless-stopped
command: ["redis-server", "--appendonly", "yes"]
command: ["valkey-server", "--appendonly", "yes"]
ports:
- "${REDIS_PORT:-6379}:6379"
volumes:
- ./data/redis_data:/data
- ./data/valkey:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
test: ["CMD", "valkey-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
+2 -2
View File
@@ -79,9 +79,9 @@ services:
restart: always
redis:
image: redis:7-alpine
image: valkey/valkey:8.0-alpine
container_name: refreshing-redis
command: redis-server --requirepass YOUR_REDIS_PASSWORD
command: valkey-server --requirepass YOUR_REDIS_PASSWORD
ports:
- "6379:6379"
volumes:
+14
View File
@@ -13,6 +13,7 @@ import (
"github.com/alicebob/miniredis/v2"
"github.com/glebarez/sqlite"
"github.com/redis/go-redis/v9"
"github.com/redis/go-redis/v9/maintnotifications"
"gorm.io/gorm"
)
@@ -26,12 +27,25 @@ func TestMigrateInitializesSQLiteDatabase(t *testing.T) {
t.Fatalf("gorm.Open(sqlite) error = %v", err)
}
mr, err := miniredis.Run()
if err != nil {
t.Fatalf("miniredis.Run() error = %v", err)
}
redisClient := redis.NewClient(&redis.Options{
Addr: mr.Addr(),
MaintNotificationsConfig: &maintnotifications.Config{
Mode: maintnotifications.ModeDisabled,
},
})
previousDBEnabled := config.Config.Database.Enabled
config.Config.Database.Enabled = false
db.SetDB(sqliteDB)
t.Cleanup(func() {
config.Config.Database.Enabled = previousDBEnabled
db.SetDB(nil)
_ = redisClient.Close()
mr.Close()
})
Migrate()
+7
View File
@@ -15,6 +15,7 @@ import (
"github.com/Rain-kl/Wavelet/internal/config"
"github.com/redis/go-redis/extra/redisotel/v9"
"github.com/redis/go-redis/v9"
"github.com/redis/go-redis/v9/maintnotifications"
"go.opentelemetry.io/otel/attribute"
)
@@ -45,6 +46,9 @@ func init() {
MaxRetries: cfg.MaxRetries,
PoolTimeout: time.Duration(cfg.PoolTimeout) * time.Second,
ConnMaxIdleTime: time.Duration(cfg.ConnMaxIdleTime) * time.Second,
MaintNotificationsConfig: &maintnotifications.Config{
Mode: maintnotifications.ModeDisabled,
},
})
log.Println("[Redis] initialized in Cluster mode")
} else {
@@ -63,6 +67,9 @@ func init() {
MaxRetries: cfg.MaxRetries,
PoolTimeout: time.Duration(cfg.PoolTimeout) * time.Second,
ConnMaxIdleTime: time.Duration(cfg.ConnMaxIdleTime) * time.Second,
MaintNotificationsConfig: &maintnotifications.Config{
Mode: maintnotifications.ModeDisabled,
},
})
if cfg.MasterName != "" {
log.Println("[Redis] initialized in Sentinel mode")
+7 -1
View File
@@ -14,6 +14,7 @@ import (
"github.com/alicebob/miniredis/v2"
"github.com/glebarez/sqlite"
"github.com/redis/go-redis/v9"
"github.com/redis/go-redis/v9/maintnotifications"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
@@ -30,7 +31,12 @@ func setupTaskExecutionTestEnvironment(t *testing.T) func() {
miniRedis, err := miniredis.Run()
require.NoError(t, err)
redisClient := redis.NewClient(&redis.Options{Addr: miniRedis.Addr()})
redisClient := redis.NewClient(&redis.Options{
Addr: miniRedis.Addr(),
MaintNotificationsConfig: &maintnotifications.Config{
Mode: maintnotifications.ModeDisabled,
},
})
db.SetDB(sqliteDB)
db.Redis = redisClient
+4
View File
@@ -14,6 +14,7 @@ import (
"github.com/alicebob/miniredis/v2"
"github.com/glebarez/sqlite"
"github.com/redis/go-redis/v9"
"github.com/redis/go-redis/v9/maintnotifications"
"gorm.io/gorm"
)
@@ -62,6 +63,9 @@ func SetupTestEnvironment(t *testing.T) (*gorm.DB, *miniredis.Miniredis, func())
// Hook up Redis Client to miniredis
redisClient := redis.NewClient(&redis.Options{
Addr: mr.Addr(),
MaintNotificationsConfig: &maintnotifications.Config{
Mode: maintnotifications.ModeDisabled,
},
})
db.Redis = redisClient