harbor
harbor copied to clipboard
bypass redis related settings when core is started with "migrate" mode
Hi, currently when core is running in migrate mode, it still needs to connect with redis at the beginning of process init, actually, redis is not needed for this mode, could add some check during the init. to bypass the redis related code? then the configuration for the pre-upgrade job will be simpler. thanks.
====== https://github.com/goharbor/harbor/blob/main/src/core/main.go
redisURL := os.Getenv("_REDIS_URL_CORE")
if len(redisURL) > 0 {
u, err := url.Parse(redisURL)
if err != nil {
panic("bad _REDIS_URL")
}
beego.BConfig.WebConfig.Session.SessionProvider = session.HarborProviderName
beego.BConfig.WebConfig.Session.SessionProviderConfig = redisURL
log.Info("initializing cache ...")
if err := cache.Initialize(u.Scheme, redisURL); err != nil {
log.Fatalf("failed to initialize cache: %v", err)
}
// when config/db init function is called, the cache is not ready,
// enable config cache explicitly when the cache is ready
dbCfg.EnableConfigCache()
}
.... if strings.EqualFold(*runMode, "migrate") { // Used by Harbor helm preinstall, preupgrade hook container if err = migration.Migrate(database); err != nil { log.Fatalf("failed to migrate the database, error: %v", err) } log.Info("the database migrate success") os.Exit(0) }
hi, any plan for this enhancement? thanks.
Yes, Init the redis works after the if else block of run mode
hi, which release will the enhancement be available ? thanks.
This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days.
This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days.
This issue was closed because it has been stalled for 30 days with no activity. If this issue is still relevant, please re-open a new issue.