Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0ed5bbb
fix: Align hourKey format with REP
JiangJiaWei1103 Dec 17, 2025
c5ba659
fix: Remove redundant runtimeClassConfigPath
JiangJiaWei1103 Dec 17, 2025
fafae16
refactor: Define consts for retry and apply backoff algo
JiangJiaWei1103 Dec 17, 2025
cef9755
refactor: Extract constants to an independent file
JiangJiaWei1103 Dec 17, 2025
09697d5
fix: Change to the official global proxy
JiangJiaWei1103 Dec 17, 2025
7d267d9
fix: Remove unready history server bin
JiangJiaWei1103 Dec 17, 2025
06175f4
fix: Remove snippets related to history server bin
JiangJiaWei1103 Dec 17, 2025
2aa3eb1
refactor: Rename log collector local var to avoid confusion
JiangJiaWei1103 Dec 17, 2025
9b2ca52
refactor: Refer to constant ray node id path
JiangJiaWei1103 Dec 17, 2025
0337030
fix: Write HTTP resp to prevent clients from hanging
JiangJiaWei1103 Dec 17, 2025
1fbfae0
fix: Add warning for failed upload ops
JiangJiaWei1103 Dec 17, 2025
b87e424
fix: Fix typo
JiangJiaWei1103 Dec 17, 2025
f5fa3f3
refactor: Remove redundant validations
JiangJiaWei1103 Dec 17, 2025
495876b
fix: Fix typo
JiangJiaWei1103 Dec 17, 2025
fb9db1c
fix: Fix typo
JiangJiaWei1103 Dec 17, 2025
27533bb
fix: Fix typo
JiangJiaWei1103 Dec 17, 2025
55b9a92
refactor: Align var declaration format
JiangJiaWei1103 Dec 17, 2025
4e9b8bb
fix: Exit on err instead of panic
JiangJiaWei1103 Dec 17, 2025
aa5aa0e
refactor: Rename runtime class to storage provider for clarity
JiangJiaWei1103 Dec 17, 2025
8b2d34a
refactor: Make data and clusters params of NewMockReader func
JiangJiaWei1103 Dec 18, 2025
a81027f
refactor: Use clear naming for creation time
JiangJiaWei1103 Dec 18, 2025
1aea830
refactor: Remove event server code to focus on log collector
JiangJiaWei1103 Dec 18, 2025
014a6ff
fix: Retry failed log file processing to prevent log loss
JiangJiaWei1103 Dec 20, 2025
7a28442
fix: Apply aws-specific err handling for s3 obj creation
JiangJiaWei1103 Dec 20, 2025
586f6ac
refactor: Streamline image building and gnu make for collector
JiangJiaWei1103 Dec 20, 2025
c2918a1
docs: Add setup example yamls
JiangJiaWei1103 Dec 20, 2025
669f301
fix: Correct env var for ssl checks
JiangJiaWei1103 Dec 21, 2025
0a70a0e
docs: Add the log collector setup guide
JiangJiaWei1103 Dec 21, 2025
ea62447
docs: Add figs
JiangJiaWei1103 Dec 21, 2025
b772930
docs: Clarify setup details
JiangJiaWei1103 Dec 21, 2025
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
46 changes: 19 additions & 27 deletions historyserver/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,25 @@
ARG TARGETOS
ARG TARGETARCH

FROM --platform=$BUILDPLATFORM golang:1.25.1 as builder
ENV GOPROXY=https://goproxy.cn,direct
ARG BUILD_RAYSERVER_DASHBOARD

RUN if [ "$BUILD_RAYSERVER_DASHBOARD" = "yes" ] ; then \
curl -o install.sh https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh && chmod +x install.sh && ./install.sh && /bin/bash -c "source $HOME/.nvm/nvm.sh && nvm install 14 && nvm use 14" ;\
else \
echo "$BUILD_RAYSERVER_DASHBOARD not yes, no need install nvm"; \
fi
FROM --platform=$BUILDPLATFORM golang:1.25.1 AS builder

ENV GOPROXY=https://proxy.golang.org,direct
WORKDIR /historyserver
COPY . .

RUN if [ "$BUILD_RAYSERVER_DASHBOARD" = "yes" ] ; then \
/bin/bash -c "source $HOME/.nvm/nvm.sh && cd dashboard/v2.51.0/client && npm ci && npm run build" ;\
else \
mkdir -p dashboard/v2.51.0/client/build ;\
echo "do not npm run build"; \
fi

RUN make build GOOS=${TARGETOS} GOARCH=${TARGETARCH}
# Copy the go modules and manifests
COPY go.mod go.mod
COPY go.sum go.sum
# Cached dependencies to avoid re-downloading when only sources change
RUN go mod download

# Copy the go source
COPY cmd/collector/main.go cmd/collector/main.go
COPY pkg/collector/ pkg/collector/
COPY pkg/storage/ pkg/storage/
COPY pkg/utils/ pkg/utils/

# Build the collector binary
COPY Makefile Makefile
RUN make build

FROM ubuntu:22.04

RUN apt-get update && apt-get upgrade -y && rm -rf /var/cache/apt/ && apt-get install -y ca-certificates

COPY --from=builder /historyserver/output/bin/historyserver /usr/local/bin/historyserver
COPY --from=builder /historyserver/output/bin/collector /usr/local/bin/collector
COPY --from=builder /historyserver/dashboard/v2.51.0/client/build /dashboard/v2.51.0/client/build
COPY --from=builder /historyserver/dashboard/homepage /dashboard/homepage

ENTRYPOINT ["/usr/local/bin/collector"]
75 changes: 12 additions & 63 deletions historyserver/Makefile
Original file line number Diff line number Diff line change
@@ -1,82 +1,52 @@
# Image URL to use all building/pushing image targets
# Docker image reference for building and pushing
IMG ?= collector:v0.1.0

GOLANGCILINT_VERSION ?= v1.59.0
GOBIN := $(shell go env GOPATH)/bin
GOBIN_GOLANGCILINT := $(GOBIN)/golangci-lint

DOCKERBUILDER_INSTANCE=historyserver
DOCKERBUILDER_INSTANCE=collector
OUT_DIR=output
BIN_DIR=$(OUT_DIR)/bin
BINARY_NAME=historyserver
BINARY_NAME_COLLECTOR=collector
BIN_NAME=collector
GO_LDFLAGS := -extldflags "-static"
GO_BUILD_FLAGS := -ldflags '$(GO_LDFLAGS)'

# Setting SHELL to bash allows bash commands to be executed by recipes.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
SHELL = /usr/bin/env bash -o pipefail
BUILD_TIMESTAMP = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
COMMIT_SHORT ?= $(shell git rev-parse --short HEAD)
BRANCH ?= $(shell git branch --show-current)
VERSION ?= $(shell git describe --tags --long|awk -F '-' '{print $$1"."$$2"-"$$3""}')

PACKAGE = gitlab.alibaba-inc.com/eml/historyserver

GO_LDFLAGS := -extldflags "-static"
# GO_LDFLAGS += -w -s # Drop debugging symbols.
GO_LDFLAGS += -X $(PACKAGE)/pkg.Version=$(VERSION) \
-X $(PACKAGE)/pkg.CommitID=$(COMMIT_SHORT) \
-X $(PACKAGE)/pkg.BuildDate=$(BUILD_TIMESTAMP) \
-X $(PACKAGE)/pkg.Branch=$(BRANCH)
GO_BUILD_FLAGS := -ldflags '$(GO_LDFLAGS)'

GOOS ?= darwin
GOARCH ?= amd64

.PHONY: all

all: build

.PHONY: clean
clean:
rm -rf $(OUT_DIR)

.PHONY: build
build: buildcollector buildhistoryserver
build: buildcollector ## Build the collector binary.

.PHONY: buildcollector
#build: mod alllint test
buildcollector: mod
@echo ""
@echo "go build ..."
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -v $(GO_BUILD_FLAGS) -o $(BIN_DIR)/$(BINARY_NAME_COLLECTOR) ./cmd/collector/main.go

.PHONY: buildhistoryserver
#build: mod alllint test
buildhistoryserver: mod
@echo ""
@echo "go build ..."
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -v $(GO_BUILD_FLAGS) -o $(BIN_DIR)/$(BINARY_NAME) ./cmd/historyserver/main.go

.PHONY: simplebuild
simplebuild:
@echo ""
@echo "go build ..."
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -v $(GO_BUILD_FLAGS) -o $(BIN_DIR)/$(BINARY_NAME)
go build -v $(GO_BUILD_FLAGS) -o $(BIN_DIR)/$(BIN_NAME) ./cmd/collector/main.go

.PHONY: mod
mod:
go mod tidy

.PHONY: localimage
localimage: dockerbuilder_instance
docker buildx build -t historyserver:laster --platform linux/amd64 . --load
docker buildx build -t $(IMG) --platform linux/arm64 . --load

.PHONY: dockerbuilder_instance
dockerbuilder_instance:
@docker buildx use $(DOCKERBUILDER_INSTANCE) || docker buildx create --name $(DOCKERBUILDER_INSTANCE)
docker buildx use $(DOCKERBUILDER_INSTANCE)

# Run tests
.PHONY: test
test:
test: ## Run tests.
go test -v ./pkg/... ./cmd/...

.PHONY: alllint
Expand All @@ -95,7 +65,7 @@ todolist: install-golint ## Run go lint against code.
$(GOBIN_GOLANGCILINT) run --print-resources-usage -c .golangci.info.yaml --enable-only godox
@echo ""

install-golint: ## check golint if not exist install golint tools
install-golint: ## Check golint if not exist install golint tools.
ifneq ("$(wildcard $(GOBIN_GOLANGCILINT))","")
ifeq ($(shell $(GOBIN_GOLANGCILINT) version --format short), $(GOLANGCILINT_VERSION))
@echo "golangci-lint version match"
Expand All @@ -117,24 +87,3 @@ else
echo 'Successfully installed' ;\
}
endif



# Generate manifests e.g. CRD, RBAC etc.
#manifests: controller-gen
# $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases

# Generate code
#generate: controller-gen
# $(CONTROLLER_GEN) object:headerFile=./hack/boilerplate.go.txt paths=./api/...


# find or download controller-gen
# download controller-gen if necessary
#controller-gen:
#ifeq (, $(shell which controller-gen))
# go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.0-beta.2
#CONTROLLER_GEN=$(shell go env GOPATH)/bin/controller-gen
#else
#CONTROLLER_GEN=$(shell which controller-gen)
#endif
Loading