fix(cmd): provide temporary GUI/API server during database migration (#10279)

This adds a temporary GUI/API server during the database migration. It
responds with 200 OK and some log output for every request. This serves
two purposes:
- Primarily, for deployments that use the API as a health check, it
gives them something positive to accept during the migration, reducing
the risk of the migration getting killed halfway through and restarted,
thus never completing.
- Secondarily, it gives humans who happen to try to load the GUI some
sort of indication of what's going on.

Obviously, anything that expects a well-formed API response at this
stage is still going to fail. They were already failing though, as we
didn't even listen at this point before.
This commit is contained in:
Jakob Borg
2025-08-22 08:35:42 +02:00
committed by GitHub
parent 0416103f26
commit d776657b52
2 changed files with 34 additions and 2 deletions
+1 -1
View File
@@ -479,7 +479,7 @@ func (c *serveCmd) syncthingMain() {
})
}
if err := syncthing.TryMigrateDatabase(c.DBDeleteRetentionInterval); err != nil {
if err := syncthing.TryMigrateDatabase(ctx, c.DBDeleteRetentionInterval, cfgWrapper.GUI().Address()); err != nil {
slog.Error("Failed to migrate old-style database", slogutil.Error(err))
os.Exit(1)
}