feat: 将 Workbench 后端改造为 Temporal native 架构

This commit is contained in:
root
2026-07-17 08:02:32 +02:00
parent 91fbb78291
commit 2354fc8dd2
30 changed files with 1157 additions and 21 deletions
+71
View File
@@ -510,6 +510,8 @@ lanes:
- hwlab-tasktree-worker
- hwlab-harnessrl-api
- hwlab-harnessrl-worker
- hwlab-workbench-api
- hwlab-workbench-worker
- hwlab-cloud-web
- hwlab-gateway
- hwlab-edge-proxy
@@ -523,6 +525,8 @@ lanes:
hwlab-tasktree-worker: deploy/runtime/boot/hwlab-tasktree-worker.sh
hwlab-harnessrl-api: deploy/runtime/boot/hwlab-harnessrl-api.sh
hwlab-harnessrl-worker: deploy/runtime/boot/hwlab-harnessrl-worker.sh
hwlab-workbench-api: deploy/runtime/boot/hwlab-workbench-api.sh
hwlab-workbench-worker: deploy/runtime/boot/hwlab-workbench-worker.sh
hwlab-cloud-web: deploy/runtime/boot/hwlab-cloud-web.sh
hwlab-gateway: deploy/runtime/boot/hwlab-gateway.sh
hwlab-edge-proxy: deploy/runtime/boot/hwlab-edge-proxy.sh
@@ -702,6 +706,40 @@ lanes:
TZ: Asia/Shanghai
HWLAB_CASERUN_INTERNAL_API_URL: http://hwlab-cloud-api.hwlab-dev.svc.cluster.local:6667
observable: true
hwlab-workbench-api:
runtimeKind: bun-command
entrypoint: cmd/hwlab-workbench-api/main.ts
artifactKind: bun-command
healthPath: /health/ready
healthPort: 6677
componentPaths:
- cmd/hwlab-workbench-api/
- internal/workbench/
- internal/cloud/workbench-command-proxy.ts
- tools/src/workbench-cli.ts
- tools/hwlab-cli/bin/hwlab-cli.ts
- package.json
- package-lock.json
- deploy/runtime/boot/hwlab-workbench-api.sh
env:
TZ: Asia/Shanghai
observable: true
hwlab-workbench-worker:
runtimeKind: bun-command
entrypoint: cmd/hwlab-workbench-worker/main.ts
artifactKind: bun-command
healthPath: /health/ready
healthPort: 6678
componentPaths:
- cmd/hwlab-workbench-worker/
- internal/workbench/
- internal/cloud/code-agent-agentrun-adapter.ts
- package.json
- package-lock.json
- deploy/runtime/boot/hwlab-workbench-worker.sh
env:
TZ: Asia/Shanghai
observable: true
hwlab-cloud-web:
runtimeKind: cloud-web
entrypoint: web/hwlab-cloud-web/index.html
@@ -929,6 +967,8 @@ lanes:
HWLAB_BOOTSTRAP_ADMIN_API_KEY: secretRef:hwlab-v03-master-server-admin-api-key/api-key
HWLAB_USER_BILLING_URL: http://hwlab-user-billing.hwlab-v03.svc.cluster.local:6670
HWLAB_WORKBENCH_RUNTIME_URL: http://hwlab-workbench-runtime.hwlab-v03.svc.cluster.local:6671
HWLAB_WORKBENCH_API_URL: http://hwlab-workbench-api.hwlab-v03.svc.cluster.local:6677
WORKBENCH_CLOUD_API_AUTHORIZATION: secretRef:hwlab-v03-master-server-admin-api-key/api-key
HWLAB_PROJECT_MANAGEMENT_URL: http://hwlab-project-management.hwlab-v03.svc.cluster.local:6672
HWLAB_TASKTREE_URL: http://hwlab-tasktree-api.hwlab-v03.svc.cluster.local:6673
HARNESSRL_API_URL: http://hwlab-harnessrl-api.hwlab-v03.svc.cluster.local:6675
@@ -1087,6 +1127,37 @@ lanes:
HWLAB_CASERUN_INTERNAL_API_URL: http://hwlab-cloud-api.hwlab-v03.svc.cluster.local:6667
HWLAB_RUNTIME_INTERNAL_API_URL: http://hwlab-cloud-api.hwlab-v03.svc.cluster.local:6667
OTEL_SERVICE_NAME: hwlab-harnessrl-worker
- serviceId: hwlab-workbench-api
replicas: 1
env:
WORKBENCH_MODE: temporal
WORKBENCH_API_PORT: "6677"
WORKBENCH_CLOUD_API_URL: http://hwlab-cloud-api.hwlab-v03.svc.cluster.local:6667
WORKBENCH_CLOUD_API_AUTHORIZATION: secretRef:hwlab-v03-master-server-admin-api-key/api-key
WORKBENCH_API_AUTHORIZATION: secretRef:hwlab-v03-master-server-admin-api-key/api-key
WORKBENCH_TEMPORAL_ADDRESS: temporal-frontend.temporal.svc.cluster.local:7233
WORKBENCH_TEMPORAL_NAMESPACE: unidesk
WORKBENCH_TEMPORAL_TASK_QUEUE: hwlab-v03-workbench
WORKBENCH_ACTIVITY_START_TO_CLOSE_TIMEOUT_MS: "30000"
WORKBENCH_ACTIVITY_RETRY_INITIAL_INTERVAL_MS: "1000"
WORKBENCH_ACTIVITY_RETRY_MAXIMUM_INTERVAL_MS: "30000"
WORKBENCH_ACTIVITY_RETRY_MAXIMUM_ATTEMPTS: "5"
OTEL_SERVICE_NAME: hwlab-workbench-api
- serviceId: hwlab-workbench-worker
replicas: 1
env:
WORKBENCH_MODE: temporal
WORKBENCH_WORKER_HEALTH_PORT: "6678"
WORKBENCH_CLOUD_API_URL: http://hwlab-cloud-api.hwlab-v03.svc.cluster.local:6667
WORKBENCH_CLOUD_API_AUTHORIZATION: secretRef:hwlab-v03-master-server-admin-api-key/api-key
WORKBENCH_TEMPORAL_ADDRESS: temporal-frontend.temporal.svc.cluster.local:7233
WORKBENCH_TEMPORAL_NAMESPACE: unidesk
WORKBENCH_TEMPORAL_TASK_QUEUE: hwlab-v03-workbench
WORKBENCH_ACTIVITY_START_TO_CLOSE_TIMEOUT_MS: "30000"
WORKBENCH_ACTIVITY_RETRY_INITIAL_INTERVAL_MS: "1000"
WORKBENCH_ACTIVITY_RETRY_MAXIMUM_INTERVAL_MS: "30000"
WORKBENCH_ACTIVITY_RETRY_MAXIMUM_ATTEMPTS: "5"
OTEL_SERVICE_NAME: hwlab-workbench-worker
services:
- serviceId: hwlab-harnessrl-api
namespace: hwlab-dev
+14
View File
@@ -30,6 +30,20 @@
"ports": [{ "name": "http", "port": 6674, "targetPort": "http" }]
}
},
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "hwlab-workbench-api",
"namespace": "hwlab-dev",
"labels": { "app.kubernetes.io/name": "hwlab-workbench-api", "hwlab.pikastech.local/service-id": "hwlab-workbench-api" }
},
"spec": {
"type": "ClusterIP",
"selector": { "app.kubernetes.io/name": "hwlab-workbench-api" },
"ports": [{ "name": "http", "port": 6677, "targetPort": "http" }]
}
},
{
"apiVersion": "v1",
"kind": "Service",
+48
View File
@@ -50,6 +50,54 @@
}
}
},
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"name": "hwlab-workbench-api",
"namespace": "hwlab-dev",
"labels": { "app.kubernetes.io/name": "hwlab-workbench-api", "hwlab.pikastech.local/service-id": "hwlab-workbench-api" }
},
"spec": {
"replicas": 0,
"selector": { "matchLabels": { "app.kubernetes.io/name": "hwlab-workbench-api" } },
"template": {
"metadata": { "labels": { "app.kubernetes.io/name": "hwlab-workbench-api", "hwlab.pikastech.local/service-id": "hwlab-workbench-api" } },
"spec": { "containers": [{
"name": "hwlab-workbench-api",
"image": "127.0.0.1:5000/hwlab/hwlab-workbench-api:dev",
"ports": [{ "name": "http", "containerPort": 6677 }],
"env": [{ "name": "WORKBENCH_API_PORT", "value": "6677" }],
"readinessProbe": { "httpGet": { "path": "/health/ready", "port": "http" } },
"livenessProbe": { "httpGet": { "path": "/health/live", "port": "http" } }
}] }
}
}
},
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"name": "hwlab-workbench-worker",
"namespace": "hwlab-dev",
"labels": { "app.kubernetes.io/name": "hwlab-workbench-worker", "hwlab.pikastech.local/service-id": "hwlab-workbench-worker" }
},
"spec": {
"replicas": 0,
"selector": { "matchLabels": { "app.kubernetes.io/name": "hwlab-workbench-worker" } },
"template": {
"metadata": { "labels": { "app.kubernetes.io/name": "hwlab-workbench-worker", "hwlab.pikastech.local/service-id": "hwlab-workbench-worker" } },
"spec": { "containers": [{
"name": "hwlab-workbench-worker",
"image": "127.0.0.1:5000/hwlab/hwlab-workbench-worker:dev",
"ports": [{ "name": "health", "containerPort": 6678 }],
"env": [{ "name": "WORKBENCH_WORKER_HEALTH_PORT", "value": "6678" }],
"readinessProbe": { "httpGet": { "path": "/health/ready", "port": "health" } },
"livenessProbe": { "httpGet": { "path": "/health/live", "port": "health" } }
}] }
}
}
},
{
"apiVersion": "v1",
"kind": "PersistentVolumeClaim",
+9
View File
@@ -0,0 +1,9 @@
#!/bin/sh
set -eu
export HWLAB_SERVICE_ID=hwlab-workbench-api
export HWLAB_SERVICE_ENTRYPOINT=cmd/hwlab-workbench-api/main.ts
export WORKBENCH_API_PORT="${WORKBENCH_API_PORT:-6677}"
export PORT="$WORKBENCH_API_PORT"
exec "${HWLAB_BUN_COMMAND:-bun}" run cmd/hwlab-workbench-api/main.ts
+9
View File
@@ -0,0 +1,9 @@
#!/bin/sh
set -eu
export HWLAB_SERVICE_ID=hwlab-workbench-worker
export HWLAB_SERVICE_ENTRYPOINT=cmd/hwlab-workbench-worker/main.ts
export WORKBENCH_WORKER_HEALTH_PORT="${WORKBENCH_WORKER_HEALTH_PORT:-6678}"
export PORT="$WORKBENCH_WORKER_HEALTH_PORT"
exec "${HWLAB_BUN_COMMAND:-bun}" run cmd/hwlab-workbench-worker/main.ts