Skip to content

Commit 60bb1b6

Browse files
authored
fix(vermeer): add Web UI build pipeline (#348)
* add license * Add release metadata to Docker image and add Vermeer CI workflow
1 parent 40051fe commit 60bb1b6

22 files changed

Lines changed: 1315 additions & 22 deletions

‎.github/workflows/vermeer-ci.yml‎

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
name: "Vermeer CI"
18+
19+
on:
20+
push:
21+
branches:
22+
- master
23+
- /^release-.*$/
24+
paths:
25+
- vermeer/**
26+
- .github/workflows/vermeer-ci.yml
27+
pull_request:
28+
paths:
29+
- vermeer/**
30+
- .github/workflows/vermeer-ci.yml
31+
32+
defaults:
33+
run:
34+
working-directory: vermeer
35+
36+
concurrency:
37+
group: ${{ github.workflow }}-${{ github.ref }}
38+
cancel-in-progress: true
39+
40+
jobs:
41+
vermeer-build:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Checkout
45+
uses: actions/checkout@v4
46+
47+
- name: Set up Go
48+
uses: actions/setup-go@v5
49+
with:
50+
go-version: '1.23'
51+
52+
- name: Set up Node.js
53+
uses: actions/setup-node@v4
54+
with:
55+
node-version: '20'
56+
57+
- name: Cache Go modules
58+
uses: actions/cache@v4
59+
with:
60+
path: |
61+
~/go/pkg/mod
62+
~/.cache/go-build
63+
key: ${{ runner.os }}-go-${{ hashFiles('vermeer/go.sum') }}
64+
restore-keys: ${{ runner.os }}-go-
65+
66+
- name: Download Go modules
67+
run: go mod download
68+
69+
- name: Download UI assets
70+
run: ./scripts/download_ui_assets.sh
71+
72+
- name: Generate embedded assets
73+
run: cd asset && go generate
74+
75+
- name: Build
76+
run: CGO_ENABLED=0 go build -o vermeer
77+
78+
- name: Verify binary exists
79+
run: test -x vermeer
80+
81+
- name: Verify release metadata exists
82+
run: |
83+
test -f release-docs/LICENSE
84+
test -f release-docs/NOTICE
85+
test -d release-docs/licenses
86+
87+
vermeer-docker:
88+
runs-on: ubuntu-latest
89+
steps:
90+
- name: Checkout
91+
uses: actions/checkout@v4
92+
93+
- name: Set up Docker Buildx
94+
uses: docker/setup-buildx-action@v3
95+
96+
- name: Build Docker image (dry-run)
97+
uses: docker/build-push-action@v6
98+
with:
99+
context: vermeer
100+
push: false
101+
tags: vermeer:ci-check
102+
cache-from: type=gha
103+
cache-to: type=gha,mode=max
104+
105+
- name: Verify release metadata in image
106+
run: |
107+
docker run --rm --entrypoint test vermeer:ci-check -f /go/bin/release-docs/LICENSE
108+
docker run --rm --entrypoint test vermeer:ci-check -f /go/bin/release-docs/NOTICE
109+
docker run --rm --entrypoint test vermeer:ci-check -d /go/bin/release-docs/licenses

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ For quick start and single-machine deployments, we recommend **Vermeer**:
146146
# Pull the image
147147
docker pull hugegraph/vermeer:latest
148148

149-
# Change config path in docker-compose.yml
149+
# Change config path in docker-compose.yaml
150150
volumes:
151151
- ~/:/go/bin/config # Change here to your actual config path, e.g., vermeer/config
152152

‎vermeer/.dockerignore‎

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616
#
17-
*data*
18-
*test*
19-
*.git*
17+
.git/
18+
.gitignore
19+
.gitattributes
20+
test/
21+
vermeer_test.go
22+
vermeer_test.sh
23+
vermeer_data/
24+
asset/assets_vfsdata.go
25+
ui/node_modules/
26+
ui/package-lock.json
27+
ui/ui/lib/bootstrap-4.3.1-dist/
28+
ui/ui/lib/bootstrap4-glyphicons/
29+
ui/ui/lib/jquery-3.5.1.min.js
30+
ui/ui/lib/jquery-license
31+
_tmp_extractor/
32+
tools/supervisord/*/supervisord
33+
tools/protoc/*/protoc
34+
tools/protoc/*/bin/
35+
tools/protoc/*/include/

‎vermeer/.gitignore‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ tools/protoc/*/include/
9999
######################
100100
asset/assets_vfsdata.go
101101

102+
# UI dependencies (downloaded via scripts/download_ui_assets.sh) #
103+
######################
104+
ui/node_modules/
105+
ui/package-lock.json
106+
ui/ui/lib/*
107+
!ui/ui/lib/functions.js
108+
!ui/ui/lib/vermeer.css
109+
102110
# AI assistant specific files (we only maintain AGENTS.md) #
103111
######################
104112
CLAUDE.md

‎vermeer/Dockerfile‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,19 @@
1515
# limitations under the License.
1616
#
1717
FROM golang:1.23-alpine AS builder
18+
RUN apk add --no-cache npm bash curl
1819
COPY ./ /src/
1920
WORKDIR /src/
2021
ENV CGO_ENABLED="0"
22+
RUN ./scripts/download_ui_assets.sh
2123
RUN cd asset && go generate
2224
RUN go build -o /go/bin/app
2325

2426
FROM alpine
2527
EXPOSE 8080
2628
COPY --from=builder /go/bin/app /go/bin/app
2729
COPY --from=builder /src/config/ /go/bin/config/
30+
COPY --from=builder /src/release-docs/ /go/bin/release-docs/
2831
COPY --from=builder /usr/local/go/lib/time/zoneinfo.zip /
2932
ENV TZ=Asia/Shanghai
3033
ENV ZONEINFO=/zoneinfo.zip

‎vermeer/Makefile‎

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
# limitations under the License.
1616
#
1717

18-
.PHONY: all init download-binaries generate-assets build clean help
18+
.PHONY: all init download-binaries download-ui-assets generate-assets build clean help
1919

2020
# Default target
2121
all: generate-assets build
2222

2323
# Initialize project (first time setup)
24-
init: download-binaries
24+
init: download-binaries download-ui-assets
2525
@echo "Installing Go dependencies..."
2626
go mod download
2727
@echo "Project initialized successfully!"
@@ -31,8 +31,17 @@ download-binaries:
3131
@echo "Downloading binary dependencies..."
3232
@./scripts/download_binaries.sh || (echo "Failed to download binaries" && exit 1)
3333

34+
# Download UI assets (jQuery, Bootstrap, Glyphicons)
35+
download-ui-assets:
36+
@if [ ! -f "ui/ui/lib/.downloaded" ]; then \
37+
echo "Downloading UI assets..."; \
38+
./scripts/download_ui_assets.sh || (echo "Failed to download UI assets" && exit 1); \
39+
else \
40+
echo "UI assets already exist, skipping download."; \
41+
fi
42+
3443
# Generate assets (vfsdata.go for web UI)
35-
generate-assets:
44+
generate-assets: download-ui-assets
3645
@echo "Generating assets..."
3746
@cd asset && go generate || (echo "Failed to generate assets" && exit 1)
3847
@echo "Assets generated successfully!"
@@ -66,20 +75,26 @@ clean-all: clean
6675
@rm -rf tools/protoc/*/protoc
6776
@rm -rf tools/protoc/*/bin
6877
@rm -rf tools/protoc/*/include
78+
@echo "Cleaning downloaded UI assets..."
79+
@rm -rf ui/node_modules ui/package-lock.json
80+
@rm -f ui/ui/lib/.downloaded ui/ui/lib/jquery-license
81+
@rm -rf ui/ui/lib/bootstrap-*-dist ui/ui/lib/bootstrap4-glyphicons
82+
@rm -f ui/ui/lib/jquery-*.min.js
6983
@echo "All clean completed!"
7084

7185
# Help
7286
help:
7387
@echo "Vermeer Build System"
7488
@echo ""
7589
@echo "Usage:"
76-
@echo " make init - First time setup (download binaries + go mod download)"
90+
@echo " make init - First time setup (download binaries + UI assets + go mod download)"
7791
@echo " make download-binaries - Download supervisord and protoc binaries for your platform"
92+
@echo " make download-ui-assets - Download jQuery, Bootstrap, Glyphicons to ui/ui/lib/"
7893
@echo " make generate-assets - Generate assets_vfsdata.go from web UI (required before build)"
7994
@echo " make build - Build vermeer for current platform (default: local architecture)"
8095
@echo " make build-linux-amd64 - Build for Linux AMD64 (for deployment)"
8196
@echo " make build-linux-arm64 - Build for Linux ARM64 (for ARM servers)"
8297
@echo " make clean - Remove generated files and binaries (keep downloaded tools)"
83-
@echo " make clean-all - Remove everything including downloaded tools"
98+
@echo " make clean-all - Remove everything including downloaded tools and UI assets"
8499
@echo " make all - Generate assets and build (default target)"
85100
@echo " make help - Show this help message"

‎vermeer/README.md‎

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,12 @@ vermeer/
8989
│ ├── master.ini
9090
│ └── worker.ini
9191
├── tools/ # Binary dependencies (supervisord, protoc)
92-
└── ui/ # Web dashboard
92+
└── ui/ # Web dashboard source and dependencies
93+
├── package.json # Frontend dependencies (jQuery, Bootstrap)
94+
└── ui/
95+
├── master.html # Master dashboard page
96+
├── worker.html # Worker dashboard page
97+
└── lib/ # Downloaded at build time (git-ignored)
9398
```
9499

95100
## Quick Start
@@ -107,8 +112,8 @@ Create a dedicated config directory (e.g., `~/vermeer-config/`) with `master.ini
107112
Run with Docker:
108113

109114
```bash
110-
# Master node
111-
docker run -v ~/vermeer-config:/go/bin/config hugegraph/vermeer --env=master
115+
# Master node (with Web UI enabled)
116+
docker run -v ~/vermeer-config:/go/bin/config hugegraph/vermeer --env=master -auth token -auth_token_factor 1234
112117

113118
# Worker node
114119
docker run -v ~/vermeer-config:/go/bin/config hugegraph/vermeer --env=worker
@@ -158,6 +163,7 @@ Configure parameters in `vermeer.sh`, then:
158163
#### Prerequisites
159164

160165
- Go 1.23 or later
166+
- Node.js/npm (for downloading UI assets)
161167
- `curl` and `unzip` utilities (for downloading dependencies)
162168
- Internet connection (for first-time setup)
163169

@@ -226,10 +232,41 @@ task_strategy = 1
226232

227233
# Number of parallel tasks
228234
task_parallel_num = 1
235+
236+
# Authentication mode (none or token)
237+
# Set to "token" to enable Web UI and API authentication
238+
auth = none
239+
240+
# Token authentication factor (required when auth=token)
241+
auth_token_factor = 1234
229242
```
230243

231244
**Note**: HugeGraph connection details (`pd_peers`, `server`, `graph`) are provided in the graph load API request, not in the configuration file. See [HugeGraph Integration](#hugegraph-integration) section for details.
232245

246+
### Generating Auth Token
247+
248+
When `auth=token` is enabled, you need to generate a token for login. Use the built-in token generator:
249+
250+
```bash
251+
# Run with Go
252+
go run tools/token/token_generator.go -user admin -space default -factor 1234 -i
253+
254+
# Or run in Docker (no local Go required)
255+
docker run --rm -v $(pwd):/src -v $(pwd)/config:/src/config golang:1.23-alpine sh -c "cd /src && go run tools/token/token_generator.go -user admin -space default -factor 1234 -i"
256+
```
257+
258+
Parameters:
259+
- `-user` — Username (default: `foo`)
260+
- `-space` — Graph space name (default: `bar`)
261+
- `-factor` — Must match `auth_token_factor` in `master.ini`
262+
- `-client` — Client identifier (default: `hg`)
263+
- `-i` — Generate immortal token (never expires)
264+
265+
The generated token can be used in two ways:
266+
267+
1. **HTTP Header**: `Authorization: Bearer <token>`
268+
2. **Login API**: `POST /api/v1/login` with body `{"token": "<token>"}` (sets cookie)
269+
233270
### Worker Configuration (`worker.ini`)
234271

235272
```ini
@@ -278,6 +315,8 @@ worker_group = default
278315

279316
Vermeer exposes a REST API on port `6688` (configurable in `master.ini`).
280317

318+
> **Note**: The Web UI (`/ui/*`) is only available when `auth=token` is configured. Set `auth_token_factor` in `master.ini` or pass `-auth token -auth_token_factor <value>` via command line.
319+
281320
### Key Endpoints
282321

283322
| Endpoint | Method | Description |
@@ -502,7 +541,9 @@ vermeer/tools/protoc/linux64/protoc vermeer/apps/protos/*.proto --go-grpc_out=ve
502541

503542
## Monitoring
504543

505-
Access the Web UI dashboard at `http://master-ip:6688/ui/` for:
544+
Access the Web UI dashboard at `http://master-ip:6688/ui/master.html` for:
545+
546+
> **Note**: The Web UI requires `auth=token` in `master.ini` (or `-auth token` via command line). Without token authentication, the UI routes are not registered.
506547
507548
- Worker status and resource usage
508549
- Active and completed tasks

‎vermeer/asset/asset.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ import (
2525
)
2626

2727
// Assets contains the project's assets.
28-
var Assets http.FileSystem = http.Dir("../ui")
28+
var Assets http.FileSystem = http.Dir("../ui/ui")

‎vermeer/asset/asset_dev_ui.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ import (
2727

2828
func init() {
2929
// for ui development
30-
Assets = http.Dir(common.AppRootPath() + "/ui/")
30+
Assets = http.Dir(common.AppRootPath() + "/ui/ui/")
3131
}

‎vermeer/build.sh‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,21 @@ go mod download
3333
echo "Checking binary dependencies..."
3434
./scripts/download_binaries.sh
3535

36-
# Generate assets if not exist
37-
if [ ! -f "asset/assets_vfsdata.go" ]; then
38-
echo "Generating assets..."
39-
cd asset && go generate && cd ..
36+
# Download UI assets if stamp file is missing
37+
echo "Checking UI assets..."
38+
if [ ! -f "ui/ui/lib/.downloaded" ]; then
39+
./scripts/download_ui_assets.sh
4040
fi
41+
42+
# Always regenerate embedded assets so UI source changes are picked up
43+
echo "Generating assets..."
44+
cd asset && go generate && cd ..
4145
ARCH=$1
4246
CGO_ENABLED=0 GOOS=linux GOARCH="$ARCH" go build
4347

4448
VERSION=$(cat ./apps/version/version.go | grep 'Version' | awk -F '"' '{print $2}')
4549
cp tools/supervisord/linux_"$ARCH"/supervisord supervisord
46-
tar --exclude=config/afs_client.conf -zcvf vermeer-"$VERSION"-"$ARCH".tar.gz vermeer config/ supervisord vermeer.sh mem_supervisor.sh
50+
tar --exclude=config/afs_client.conf -zcvf vermeer-"$VERSION"-"$ARCH".tar.gz vermeer config/ supervisord vermeer.sh mem_supervisor.sh release-docs/LICENSE release-docs/NOTICE release-docs/licenses/
4751

4852
mkdir "$BUILD_REPO_WS"/output
4953
mv vermeer-"$VERSION"-"$ARCH".tar.gz "$BUILD_REPO_WS"/output/

0 commit comments

Comments
 (0)