Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

Add liveness\readiness probe for s3 api handler on /status path

Bl1tz23e6e57db53021
diff --git a/Makefile b/Makefile
index 9a62eb9fec..3c389e6e37 100644
--- a/Makefile
+++ b/Makefile
@@ -33,7 +33,7 @@ deps:
rm -rf /home/travis/gopath/src/github.com/coreos/etcd/vendor/golang.org/x/net/trace
rm -rf /home/travis/gopath/src/go.etcd.io/etcd/vendor/golang.org/x/net/trace
-build: deps
+build:
go build $(GO_FLAGS) -ldflags "$(LDFLAGS)" -o $(BINARY) $(SOURCE_DIR)
install: deps
diff --git a/weed/s3api/s3api_server.go b/weed/s3api/s3api_server.go
index 54df294924..efd4778d9d 100644
--- a/weed/s3api/s3api_server.go
+++ b/weed/s3api/s3api_server.go
@@ -2,12 +2,12 @@ package s3api
import (
"fmt"
- "github.com/chrislusf/seaweedfs/weed/filer"
- . "github.com/chrislusf/seaweedfs/weed/s3api/s3_constants"
"net/http"
"strings"
"time"
+ "github.com/chrislusf/seaweedfs/weed/filer"
+ . "github.com/chrislusf/seaweedfs/weed/s3api/s3_constants"
"github.com/gorilla/mux"
"google.golang.org/grpc"
)
@@ -44,6 +44,10 @@ func NewS3ApiServer(router *mux.Router, option *S3ApiServerOption) (s3ApiServer
func (s3a *S3ApiServer) registerRouter(router *mux.Router) {
// API Router
apiRouter := router.PathPrefix("/").Subrouter()
+
+ // Readiness Probe
+ apiRouter.Methods("GET").Path("/status").HandlerFunc(s3a.StatusHandler)
+
var routers []*mux.Router
if s3a.option.DomainName != "" {
domainNames := strings.Split(s3a.option.DomainName, ",")
diff --git a/weed/s3api/s3api_status_handlers.go b/weed/s3api/s3api_status_handlers.go
new file mode 100644
index 0000000000..914c27f40d
--- /dev/null
+++ b/weed/s3api/s3api_status_handlers.go
@@ -0,0 +1,8 @@
+package s3api
+
+import "net/http"
+
+func (s3a *S3ApiServer) StatusHandler(w http.ResponseWriter, r *http.Request) {
+ // write out the response code and content type header
+ writeSuccessResponseEmpty(w)
+}