Skip to content
This repository was archived by the owner on May 27, 2025. It is now read-only.

Commit 5f206eb

Browse files
authored
Merge pull request #44 from humpback/develop-0.0.1
Develop 0.0.1
2 parents 3fbd453 + 1394000 commit 5f206eb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+264
-671
lines changed

.github/workflows/build-develop.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ jobs:
4949
uses: docker/metadata-action@v5
5050
with:
5151
images: humpbacks/humpback-server
52+
tags: |
53+
type=raw,value=develop
5254
5355
- name: Build and push
5456
uses: docker/build-push-action@v6

.github/workflows/build-main.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Build and Deploy
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
branches:
8+
- main
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: '20.x'
22+
23+
- name: Install dependencies and build front
24+
working-directory: ./front
25+
run: |
26+
npm install -g pnpm
27+
pnpm install
28+
pnpm run build
29+
30+
- name: Set up Go
31+
uses: actions/setup-go@v5
32+
with:
33+
go-version: '1.24'
34+
35+
- name: Install dependencies and build backend
36+
working-directory: ./backend
37+
run: |
38+
go mod download
39+
CGO_ENABLED=0 go build -o humpback
40+
41+
- name: Login Docker Hub
42+
uses: docker/login-action@v3
43+
with:
44+
username: ${{ secrets.DOCKER_USERNAME }}
45+
password: ${{ secrets.DOCKER_PASSWORD }}
46+
47+
- name: Docker meta
48+
id: meta
49+
uses: docker/metadata-action@v5
50+
with:
51+
images: humpbacks/humpback-server
52+
tags: |
53+
type=ref,event=tag
54+
type=raw,value=latest
55+
56+
- name: Build and push
57+
uses: docker/build-push-action@v6
58+
with:
59+
context: .
60+
file: ./Dockerfile
61+
push: true
62+
tags: ${{ steps.meta.outputs.tags }}
63+
labels: ${{ steps.meta.outputs.labels }}

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,63 @@
11
# humpback-server
2+
3+
[![PkgGoDev](https://pkg.go.dev/badge/github.com/docker/docker)](https://golang.org/)
4+
[![Vue 3](https://img.shields.io/badge/vue-3.x-brightgreen.svg)](https://v3.vuejs.org/)
5+
[![Docker](https://img.shields.io/badge/docker-pull-blue?logo=docker)](https://hub.docker.com/r/humpbacks/humpback-server)
6+
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/humpbacks/humpback-server?sort=semver)](https://github.com/humpbacks/humpback-server/releases/latest)
7+
8+
![Humpback logo](/assets/logo.png)
9+
10+
Lightweight container service management platform site.
11+
12+
## Language
13+
14+
- [English](README.md)
15+
- [中文](README.zh.md)
16+
17+
## Feature
18+
19+
- Multiple Deployment Strategies: Flexible deployment strategies to meet your various business scenarios.
20+
- Supporting Multiple Cluster:One-stop operation and management of multiple clusters.
21+
- Centralized Access Control: Granular permission control (team and individual levels).
22+
- Friendly Web UI: An intuitive web interface that hides the complexity of container operations.
23+
24+
## Getting Started
25+
26+
* [Humpback Guides](https://humpback.github.io/humpback)
27+
28+
## Installing
29+
30+
First, create the volume that Humpback Server will use to store its database:
31+
32+
```bash
33+
docker volume create humpback_data
34+
```
35+
36+
Then, install the Humpback Server container:
37+
38+
```bash
39+
docker run -d \
40+
--name humpback-server \
41+
-p 8100:8100 \
42+
-p 8101:8101 \
43+
--restart=always \
44+
-v humpback_data:/workspace/data \
45+
-e LOCATION=prd \
46+
humpbacks/humpback-server
47+
```
48+
49+
By default, Humpback Server will expose the UI over port `8100` and expose a API server over port `8101` for receiving
50+
agent report.
51+
52+
Humpback Server has now been installed. you can log into your Humpback Server instance by opening a web browser and
53+
going to:
54+
55+
```
56+
http://localhost:8100
57+
```
58+
59+
The initial super administrator account and password are **humpback**
60+
61+
## License
62+
63+
Humpback Server is licensed under the [Apache Licence 2.0](http://www.apache.org/licenses/LICENSE-2.0.html).

README.zh.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# humpback-server
2+
3+
[![PkgGoDev](https://pkg.go.dev/badge/github.com/docker/docker)](https://golang.org/)
4+
[![Vue 3](https://img.shields.io/badge/vue-3.x-brightgreen.svg)](https://v3.vuejs.org/)
5+
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/humpbacks/humpback-server?sort=semver)](https://github.com/humpbacks/humpback-server/releases/latest)
6+
7+
![Humpback logo](/assets/logo.png)
8+
9+
轻量级容器服务管理平台Web。
10+
11+
## 语言
12+
13+
- [English](README.md)
14+
- [中文](README.zh.md)
15+
16+
## 特征
17+
18+
- 多种部署策略: 灵活多样的部署策略满足你的各种业务场景需求。
19+
- 支持多集群:一站式运维多个集群。
20+
- 集中式访问控制: 不同粒度的权限控制(团队和个人)。
21+
- 简洁易用的界面: 简洁易用但功能强大的用户界面让你不需要面对容器的复杂性。
22+
23+
## 快速开始
24+
25+
* [Humpback文档](https://humpback.github.io/humpback)
26+
27+
## 安装
28+
29+
首先,创建一个volume用于存储Humpback Server的数据库:
30+
31+
```bash
32+
docker volume create humpback_data
33+
```
34+
35+
接下,使用下面的命令创建Humpback Server容器:
36+
37+
```bash
38+
docker run -d \
39+
--name humpback-server \
40+
-p 8100:8100 \
41+
-p 8101:8101 \
42+
--restart=always \
43+
-v humpback_data:/workspace/data \
44+
-e LOCATION=prd \
45+
humpbacks/humpback-server
46+
```
47+
48+
Humpback Server默认会监听两个端口,`8100`端口是web站点,`8101`是API服务器,主要接受agent汇报的数据。
49+
50+
命令运行成功后,你可以通过打开下面的站点检查Humpback Server是否启动成功。
51+
52+
```
53+
http://localhost:8100
54+
```
55+
56+
初始化的超级管理员账号密码均为 **humpback**
57+
58+
## 许可证
59+
60+
Humpback Server 根据 [Apache Licence 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) 获得许可。

assets/logo.png

49.2 KB
Loading

backend/api/api.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ type Router struct {
2222

2323
func InitRouter(nodeCh chan types.NodeSimpleInfo, serviceCh chan types.ServiceChangeInfo) *Router {
2424
gin.SetMode(gin.ReleaseMode)
25-
gin.Default()
2625
r := &Router{engine: gin.New()}
2726
r.setMiddleware(nodeCh, serviceCh)
2827
r.setRoute()
@@ -48,7 +47,7 @@ func (api *Router) Close(c context.Context) error {
4847
}
4948

5049
func (api *Router) setMiddleware(nodeCh chan types.NodeSimpleInfo, serviceCh chan types.ServiceChangeInfo) {
51-
api.engine.Use(middleware.Log(), middleware.CorsCheck(), middleware.HandleError(), middleware.SetEventChannel(nodeCh, serviceCh))
50+
api.engine.Use(gin.Recovery(), middleware.Log(), middleware.CorsCheck(), middleware.HandleError(), middleware.SetEventChannel(nodeCh, serviceCh))
5251
}
5352

5453
func (api *Router) setRoute() {

backend/api/handle/models/activity.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,16 @@ func (s *ActivityAllQueryReqInfo) Check() error {
108108
return nil
109109
}
110110

111-
func (s *ActivityAllQueryReqInfo) IsValid(timestampStr string) (bool, error) {
111+
func (s *ActivityAllQueryReqInfo) IsValid(timestampStr, userId string) (bool, error) {
112112
timestamp, err := strconv.ParseInt(timestampStr, 10, 64)
113113
if err != nil {
114114
return false, err
115115
}
116-
return timestamp > s.StartAt, nil
116+
if timestamp < s.StartAt {
117+
return false, nil
118+
}
119+
if types.IsUser(s.UserInfo.Role) && userId != s.UserInfo.UserId {
120+
return false, nil
121+
}
122+
return true, nil
117123
}

backend/internal/controller/controller_activity.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,9 +1030,9 @@ func ActivityAllQuery(info *models.ActivityAllQueryReqInfo) (map[string][]*types
10301030
for key, bucket := range buckets {
10311031
go func(name string, bucket string) {
10321032
defer wg.Done()
1033-
list, err := db.ActivityAllQuery(info, bucket)
1033+
list, err := db.ActivityQueryByStartAtAndUser(info, bucket)
10341034
if err != nil {
1035-
slog.Error("[ActivityAllQuery] List activities failed.", "Bucket", bucket, "Error", err.Error())
1035+
slog.Error("[ActivityQueryByStartAtAndUser] List activities failed.", "Bucket", bucket, "Error", err.Error())
10361036
return
10371037
}
10381038
l.Lock()

backend/internal/db/activity.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func ActivityQuery(info *models.ActivityQueryReqInfo, bucket string) (*response.
8181
return results, nil
8282
}
8383

84-
func ActivityAllQuery(info *models.ActivityAllQueryReqInfo, bucket string) ([]*types.ActivityInfo, error) {
84+
func ActivityQueryByStartAtAndUser(info *models.ActivityAllQueryReqInfo, bucket string) ([]*types.ActivityInfo, error) {
8585
var (
8686
results = make([]*types.ActivityInfo, 0)
8787
)
@@ -101,7 +101,7 @@ func ActivityAllQuery(info *models.ActivityAllQueryReqInfo, bucket string) ([]*t
101101
break
102102
}
103103
keys := strings.Split(string(k), "-")
104-
valid, err := info.IsValid(keys[0])
104+
valid, err := info.IsValid(keys[0], keys[1])
105105
if err != nil {
106106
return err
107107
}

front/projects/web/.eslintrc-auto-import.json

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"globals": {
3+
"ActivityInfo": true,
34
"BaseInfo": true,
45
"BytesToGB": true,
56
"Component": true,
@@ -8,11 +9,12 @@
89
"ConfigInfo": true,
910
"ConfigType": true,
1011
"ContainerNetworkStats": true,
11-
"ContainerPerformance": true,
1212
"ContainerStats": true,
1313
"ContainerStatus": true,
14+
"ContainersPerformance": true,
1415
"CopyToClipboard": true,
1516
"CreateCancelRequest": true,
17+
"DashboardResourceStatisticsInfo": true,
1618
"Debounce": true,
1719
"DirectiveBinding": true,
1820
"EffectScope": true,
@@ -34,6 +36,7 @@
3436
"MaybeRefOrGetter": true,
3537
"NewBaseEmptyInfo": true,
3638
"NewConfigEmptyInfo": true,
39+
"NewDashboardResourceStatisticsInfo": true,
3740
"NewGroupEmptyInfo": true,
3841
"NewNodeEmptyInfo": true,
3942
"NewPageInfo": true,
@@ -62,6 +65,7 @@
6265
"RSAPublicKey": true,
6366
"Ref": true,
6467
"RegistryInfo": true,
68+
"ResourceExceptionServiceInfo": true,
6569
"ResponseQuery": true,
6670
"ResponseSuccess": true,
6771
"RuleCannotBeEmpty": true,
@@ -103,6 +107,7 @@
103107
"ShowWarningMsg": true,
104108
"SortInfo": true,
105109
"SortType": true,
110+
"StatisticsCountInfo": true,
106111
"StorageEventType": true,
107112
"TableHeight": true,
108113
"TeamInfo": true,
@@ -112,6 +117,7 @@
112117
"VNode": true,
113118
"WritableComputedRef": true,
114119
"acceptHMRUpdate": true,
120+
"activityService": true,
115121
"asyncComputed": true,
116122
"autoResetRef": true,
117123
"commonService": true,
@@ -135,6 +141,7 @@
135141
"createTemplatePromise": true,
136142
"createUnrefFn": true,
137143
"customRef": true,
144+
"dashboardService": true,
138145
"debouncedRef": true,
139146
"debouncedWatch": true,
140147
"defineAsyncComponent": true,
@@ -220,6 +227,7 @@
220227
"shallowReactive": true,
221228
"shallowReadonly": true,
222229
"shallowRef": true,
230+
"statisticsCountService": true,
223231
"storageEventBus": true,
224232
"storeToRefs": true,
225233
"stores": true,
@@ -452,17 +460,6 @@
452460
"IconMdiPlay": true,
453461
"IconMdiRestart": true,
454462
"IconMdiSquare": true,
455-
"IconMdiStopCircleOutline": true,
456-
"ContainersPerformance": true,
457-
"activityService": true,
458-
"ActivityInfo": true,
459-
"dashboardService": true,
460-
"DashboardResourceStatisticsInfo": true,
461-
"ResouceExceptionServcieInfo": true,
462-
"ResourceExceptionServcieInfo": true,
463-
"ResourceExceptionServiceInfo": true,
464-
"NewDashboardResourceStatisticsInfo": true,
465-
"StatisticsCountInfo": true,
466-
"statisticsCountService": true
463+
"IconMdiStopCircleOutline": true
467464
}
468465
}

0 commit comments

Comments
 (0)