Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ __pycache__/
.idea
.ipynb_checkpoints
*/.ipynb_checkpoints/*
go.mod
go.sum
go/src/ltfs-vof/go.mod
go/src/ltfs-vof/go.sum
25 changes: 25 additions & 0 deletions go/src/ltfs-vof/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io/ioutil"
. "ltfs-vof/tapehardware"
. "ltfs-vof/utils"
"net/http"
"strings"
)

Expand Down Expand Up @@ -47,8 +48,12 @@ func main() {
simPacks := flag.Bool("simpacks", false, "Put Pack List Into Database")
var simBuckets stringSlice
flag.Var(&simBuckets, "simbucket", "simbucket may be repeated to create multiple simulation buckets")
healthPort := flag.String("healthport", "8080", "Port for health check endpoint")
flag.Parse()

// Start health check server in background
go startHealthCheckServer(*healthPort)

// create the customer logger
logger := NewLogger(*logFile, *clean)

Expand Down Expand Up @@ -165,3 +170,23 @@ func (s *stringSlice) Set(value string) error {
func (s *stringSlice) Slice() []string {
return []string(*s)
}

// startHealthCheckServer starts an HTTP server for health checks
// This is used by MinIO Sidekick for load balancer health monitoring
func startHealthCheckServer(port string) {
http.HandleFunc("/health", healthCheckHandler)
http.HandleFunc("/healthz", healthCheckHandler)
http.HandleFunc("/", healthCheckHandler)

addr := ":" + port
fmt.Printf("Starting health check server on %s\n", addr)
if err := http.ListenAndServe(addr, nil); err != nil {
fmt.Printf("Health check server error: %v\n", err)
}
}

// healthCheckHandler responds with 200 OK for health checks
func healthCheckHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
_, _ = w.Write([]byte("OK"))
}