Реализовать lab3 в общем Helm-релизе с Traefik, TLS и HPA

This commit is contained in:
Vladislav Agapov
2026-10-16 11:51:20 +03:00
parent a57cbcf329
commit 9494547300
88 changed files with 1922 additions and 255 deletions
+23 -1
View File
@@ -1,7 +1,12 @@
package main
import (
"context"
"fmt"
"time"
"gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/config"
"gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store/postgres"
"go.uber.org/fx"
)
@@ -12,8 +17,25 @@ func run(args []string) error {
fx.New(CreateApp()).Run()
return nil
}
if len(args) == 1 && args[0] == "migrate" {
return migrate()
}
if len(args) == 1 && args[0] == "healthcheck" {
return healthcheck()
}
return fmt.Errorf("usage: server [healthcheck]")
return fmt.Errorf("usage: server [healthcheck|migrate]")
}
// migrate applies versioned DDL once from an operator job, independently of the API.
func migrate() error {
cfg, err := config.NewPersistence()
if err != nil {
return err
}
database, err := postgres.New(postgres.Options{URL: cfg.DatabaseURL, MaxConnections: 1, Timeout: 30 * time.Second})
if err != nil {
return err
}
defer database.Close()
return database.Start(context.Background())
}