Skip to content

Commit 612b69c

Browse files
authored
fix: add --public-url parameter for docker deployment (iflytek#216)
* docs: add VitePress bilingual documentation site - Add VitePress-based documentation with Chinese (root) and English (/en/) locales - Include 6 feature guides: skill-publish, skill-discovery, namespace, review, scanner, social - Add quickstart, introduction, and FAQ pages - Include AI-generated diagrams and screenshots - Add GitHub Pages deployment workflow - Add Makefile targets: docs-dev, docs-build, docs-preview * docs: rename docs/claude to docs/skillhub - Rename documentation directory from docs/claude to docs/skillhub - Update Makefile paths for docs-dev, docs-build, docs-preview - Update GitHub workflow paths for deploy-docs.yml * fix: add enablement parameter to auto-enable GitHub Pages * Revert "fix: add enablement parameter to auto-enable GitHub Pages" This reverts commit 11096b1. * docs: add documentation link to README Add link to GitHub Pages documentation (https://iflytek.github.io/skillhub/) under Quick Start section in both English and Chinese README files. * fix: add --public-url parameter for docker deployment - Add --public-url parameter to runtime.sh for configuring public access URL - Create skill.md.template for dynamic URL substitution at container startup - Update getBaseUrl() to fallback to window.location.host when appBaseUrl is localhost - Update landing-quick-start.tsx to dynamically generate agent command URL - Add commandTemplate to i18n files for URL placeholder support - Update README.md and README_zh.md with deployment parameter documentation Fixes: Docker deployment shows localhost in install commands and skill.md
1 parent cbc1ef2 commit 612b69c

File tree

13 files changed

+289
-14
lines changed

13 files changed

+289
-14
lines changed

README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ firewall, with the same polish you'd expect from a public registry.
6565

6666
## Quick Start
6767

68+
📖 **[User Documentation →](https://iflytek.github.io/skillhub/)**
69+
6870
Start the full local stack with one of the following commands:
6971

7072
Official images:
@@ -76,10 +78,22 @@ curl -fsSL https://imageless.oss-cn-beijing.aliyuncs.com/runtime-github.sh | sh
7678
The default command pulls the `latest` stable release images. Use
7779
`--version edge` if you want the newest build from `main`.
7880

81+
**Configure public URL (recommended for production):**
82+
83+
```bash
84+
curl -fsSL https://imageless.oss-cn-beijing.aliyuncs.com/runtime-github.sh | sh -s -- up --public-url https://skillhub.your-company.com
85+
```
86+
87+
The `--public-url` parameter sets the public access URL for your SkillHub instance.
88+
This ensures:
89+
- CLI install commands show the correct registry URL
90+
- Agent setup instructions display the correct skill.md URL
91+
- OAuth callbacks and device auth links work properly
92+
7993
Aliyun mirror shortcut:
8094
```bash
8195
rm -rf /tmp/skillhub-aliyun
82-
curl -fsSL https://imageless.oss-cn-beijing.aliyuncs.com/runtime.sh | sh -s -- up --home /tmp/skillhub-aliyun --aliyun --version latest
96+
curl -fsSL https://imageless.oss-cn-beijing.aliyuncs.com/runtime.sh | sh -s -- up --home /tmp/skillhub-aliyun --aliyun --version latest --public-url https://skillhub.your-company.com
8397
```
8498

8599
If deployment runs into problems, clear the existing runtime home and retry.
@@ -170,6 +184,30 @@ This is the supported path for anyone who wants a ready-to-use local
170184
environment without building the backend or frontend on their machine.
171185
Published images target both `linux/amd64` and `linux/arm64`.
172186

187+
**Quick deployment with curl:**
188+
189+
```bash
190+
# Official images
191+
curl -fsSL https://imageless.oss-cn-beijing.aliyuncs.com/runtime-github.sh | sh -s -- up --public-url https://skillhub.your-company.com
192+
193+
# Aliyun mirror (recommended for users in China)
194+
curl -fsSL https://imageless.oss-cn-beijing.aliyuncs.com/runtime.sh | sh -s -- up --aliyun --public-url https://skillhub.your-company.com
195+
```
196+
197+
**Deployment parameters:**
198+
199+
| Parameter | Description | Example |
200+
|-----------|-------------|---------|
201+
| `--public-url <url>` | Public access URL (recommended) | `--public-url https://skill.example.com` |
202+
| `--version <tag>` | Specific image tag | `--version v0.2.0` |
203+
| `--aliyun` | Use Aliyun mirror (China) | `--aliyun` |
204+
| `--home <dir>` | Runtime directory | `--home /opt/skillhub` |
205+
| `--no-scanner` | Disable security scanner | `--no-scanner` |
206+
207+
> **Important**: Configure `--public-url` for production deployments to ensure CLI install commands and Agent setup instructions display the correct URLs.
208+
209+
**Manual deployment:**
210+
173211
1. Copy the runtime environment template.
174212
2. Pick an image tag.
175213
3. Start the stack with Docker Compose.

README_zh.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ SkillHub 是一个自托管平台,为团队提供私有的、受治理的智
3737

3838
## 快速开始
3939

40+
📖 **[用户使用文档 →](https://iflytek.github.io/skillhub/)**
41+
4042
使用以下命令之一启动完整的本地环境:
4143

4244
官方镜像:
@@ -48,10 +50,21 @@ curl -fsSL https://raw.githubusercontent.com/iflytek/skillhub/main/scripts/runti
4850
默认命令会拉取 `latest` 稳定版镜像;如果你想跟随 `main`
4951
的最新构建,请显式传 `--version edge`
5052

53+
**配置公网访问地址(生产环境推荐):**
54+
55+
```bash
56+
curl -fsSL https://raw.githubusercontent.com/iflytek/skillhub/main/scripts/runtime.sh | sh -s -- up --public-url https://skillhub.your-company.com
57+
```
58+
59+
`--public-url` 参数用于设置 SkillHub 实例的公网访问地址。配置后:
60+
- CLI 安装命令会显示正确的注册中心地址
61+
- Agent 设置指引会显示正确的 skill.md URL
62+
- OAuth 回调和设备认证链接能正常工作
63+
5164
阿里云镜像快捷方式:
5265
```bash
5366
rm -rf /tmp/skillhub-aliyun
54-
curl -fsSL https://imageless.oss-cn-beijing.aliyuncs.com/runtime.sh | sh -s -- up --home /tmp/skillhub-aliyun --aliyun --version latest
67+
curl -fsSL https://imageless.oss-cn-beijing.aliyuncs.com/runtime.sh | sh -s -- up --home /tmp/skillhub-aliyun --aliyun --version latest --public-url https://skillhub.your-company.com
5568
```
5669

5770
如果部署遇到问题,请清除现有的运行时目录并重试。
@@ -160,12 +173,24 @@ skillhub/
160173

161174
```bash
162175
# 使用官方镜像
163-
curl -fsSL https://raw.githubusercontent.com/iflytek/skillhub/main/scripts/runtime.sh | sh -s -- up
176+
curl -fsSL https://raw.githubusercontent.com/iflytek/skillhub/main/scripts/runtime.sh | sh -s -- up --public-url https://skillhub.your-company.com
164177

165178
# 使用阿里云镜像
166-
curl -fsSL https://imageless.oss-cn-beijing.aliyuncs.com/runtime.sh | sh -s -- up --aliyun
179+
curl -fsSL https://imageless.oss-cn-beijing.aliyuncs.com/runtime.sh | sh -s -- up --aliyun --public-url https://skillhub.your-company.com
167180
```
168181

182+
### 配置参数说明
183+
184+
| 参数 | 说明 | 示例 |
185+
|------|------|------|
186+
| `--public-url <url>` | 公网访问地址(推荐配置) | `--public-url https://skill.example.com` |
187+
| `--version <tag>` | 指定镜像版本 | `--version v0.2.0` |
188+
| `--aliyun` | 使用阿里云镜像(国内推荐) | `--aliyun` |
189+
| `--home <dir>` | 指定运行时目录 | `--home /opt/skillhub` |
190+
| `--no-scanner` | 禁用安全扫描服务 | `--no-scanner` |
191+
192+
> **重要**:生产环境请务必配置 `--public-url`,确保 CLI 安装命令和 Agent 设置指引显示正确的地址。
193+
169194
### 使用 Kubernetes
170195

171196
```bash

scripts/runtime.sh

100644100755
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ SKILLHUB_REF="${SKILLHUB_REF:-main}"
1212
SKILLHUB_HOME_DEFAULT="${TMPDIR:-/tmp}/skillhub-runtime"
1313
SKILLHUB_HOME="${SKILLHUB_HOME:-$SKILLHUB_HOME_DEFAULT}"
1414
SKILLHUB_VERSION_VALUE="${SKILLHUB_VERSION:-}"
15+
SKILLHUB_PUBLIC_BASE_URL_VALUE="${SKILLHUB_PUBLIC_BASE_URL:-}"
1516
SKILLHUB_ALIYUN_REGISTRY="${SKILLHUB_ALIYUN_REGISTRY:-crpi-ptu2rqimrigtq0qx.cn-hangzhou.personal.cr.aliyuncs.com}"
1617
SKILLHUB_ALIYUN_NAMESPACE="${SKILLHUB_ALIYUN_NAMESPACE:-skill_hub}"
1718
SKILLHUB_MIRROR_REGISTRY_VALUE="${SKILLHUB_MIRROR_REGISTRY:-}"
@@ -81,6 +82,11 @@ while [ "$#" -gt 0 ]; do
8182
DISABLE_SCANNER=true
8283
shift
8384
;;
85+
--public-url)
86+
[ "$#" -ge 2 ] || { echo "Missing value for --public-url" >&2; exit 1; }
87+
SKILLHUB_PUBLIC_BASE_URL_VALUE="$2"
88+
shift 2
89+
;;
8490
--help|-h)
8591
cat <<EOF
8692
Usage: sh runtime.sh [up|down|clean|ps|logs|pull] [options]
@@ -91,6 +97,7 @@ Options:
9197
--mirror-registry <r> Use mirrored images from <registry>/<namespace>
9298
--home <dir> Store runtime files in a specific directory
9399
--ref <git-ref> Download runtime files from a specific Git ref
100+
--public-url <url> Public access URL (e.g. https://skill.example.com)
94101
--server-image <img> Override backend image repository
95102
--web-image <img> Override frontend image repository
96103
--scanner-image <img> Override scanner image repository
@@ -204,6 +211,10 @@ prepare_runtime_files() {
204211
if [ -n "$SKILLHUB_SCANNER_IMAGE_VALUE" ]; then
205212
set_env_value "SKILLHUB_SCANNER_IMAGE" "$SKILLHUB_SCANNER_IMAGE_VALUE"
206213
fi
214+
215+
if [ -n "$SKILLHUB_PUBLIC_BASE_URL_VALUE" ]; then
216+
set_env_value "SKILLHUB_PUBLIC_BASE_URL" "$SKILLHUB_PUBLIC_BASE_URL_VALUE"
217+
fi
207218
}
208219

209220
run_compose() {
@@ -221,9 +232,10 @@ case "$COMMAND" in
221232
else
222233
run_compose up -d
223234
fi
235+
PUBLIC_URL="${SKILLHUB_PUBLIC_BASE_URL_VALUE:-http://localhost}"
224236
cat <<EOF
225237
SkillHub runtime started.
226-
Web UI: http://localhost
238+
Web UI: $PUBLIC_URL
227239
Backend API: http://localhost:8080
228240
Runtime dir: $SKILLHUB_HOME
229241
Stop with:

web/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN pnpm build
88

99
FROM nginx:alpine
1010
COPY --from=build /app/dist /usr/share/nginx/html
11-
COPY --from=build /app/src/docs/skill.md /usr/share/nginx/html/registry/skill.md
11+
COPY --from=build /app/src/docs/skill.md.template /usr/share/nginx/html/registry/skill.md.template
1212
COPY nginx.conf.template /etc/nginx/templates/default.conf.template
1313
COPY runtime-config.js.template /usr/share/nginx/html/runtime-config.js.template
1414
COPY docker-entrypoint.d/30-runtime-config.sh /docker-entrypoint.d/30-runtime-config.sh

web/docker-entrypoint.d/30-runtime-config.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ set -eu
44
: "${SKILLHUB_WEB_API_BASE_URL:=}"
55
: "${SKILLHUB_PUBLIC_BASE_URL:=}"
66

7+
# Generate runtime-config.js
78
envsubst '${SKILLHUB_WEB_API_BASE_URL} ${SKILLHUB_PUBLIC_BASE_URL}' \
89
< /usr/share/nginx/html/runtime-config.js.template \
910
> /usr/share/nginx/html/runtime-config.js
11+
12+
# Generate registry/skill.md with actual public URL
13+
envsubst '${SKILLHUB_PUBLIC_BASE_URL}' \
14+
< /usr/share/nginx/html/registry/skill.md.template \
15+
> /usr/share/nginx/html/registry/skill.md

web/src/docs/skill.md.template

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
---
2+
name: skillhub-registry
3+
description: Use this when you need to search, inspect, install, or publish agent skills against a SkillHub registry. SkillHub is a skill registry with a ClawHub-compatible API layer, so prefer the `clawhub` CLI for registry operations instead of making raw HTTP calls.
4+
---
5+
6+
# SkillHub Registry
7+
8+
Use this skill when you need to work with a SkillHub registry: search skills, inspect metadata, install a package, or publish a new version.
9+
10+
> Important: Prefer the `clawhub` CLI for registry workflows. SkillHub exposes a ClawHub-compatible API surface and a discovery endpoint at `/.well-known/clawhub.json`, so the CLI is the safest path for auth, resolution, and download behavior. Only fall back to raw HTTP when debugging the server itself.
11+
12+
## What SkillHub Is
13+
14+
SkillHub is an enterprise-oriented skill registry. It stores versioned skill packages, supports namespace-based skill management, and keeps `SKILL.md` compatibility with OpenSkills-style packages.
15+
16+
Key facts:
17+
18+
- Internal coordinates use `@{namespace}/{skill_slug}`.
19+
- If using the clawhub CLI, the compatible format is `{namespace}--{skill_slug}`.
20+
- ClawHub-compatible clients use a `{namespace}--{skill_slug}` slug instead.
21+
- `latest` always means the latest published version, never draft or pending review.
22+
- Public skills in `@global` can be downloaded anonymously.
23+
- If no namespace is specified, it defaults to `@global`.
24+
- `{skill_slug}` can be used instead of `global--{skill_slug}`
25+
- Team namespace skills and non-public skills require authentication.
26+
27+
## Configure The CLI
28+
29+
Point `clawhub` at the SkillHub base URL:
30+
31+
```bash
32+
export CLAWHUB_REGISTRY=${SKILLHUB_PUBLIC_BASE_URL}
33+
```
34+
35+
Alternatively, use the `--registry` parameter every time, for example:
36+
37+
```bash
38+
npx clawhub install my-skill --registry ${SKILLHUB_PUBLIC_BASE_URL}
39+
```
40+
41+
42+
If you need authenticated access, provide an API token:
43+
44+
```bash
45+
clawhub login --token sk_your_api_token_here
46+
```
47+
48+
Optional local check:
49+
50+
```bash
51+
curl ${SKILLHUB_PUBLIC_BASE_URL}/.well-known/clawhub.json
52+
```
53+
54+
Expected response:
55+
56+
```json
57+
{"apiBase":"/api/v1"}
58+
```
59+
60+
## Coordinate Rules - IMPORTANT
61+
62+
SkillHub has two naming forms:
63+
64+
| SkillHub coordinate | Canonical slug for `clawhub` |
65+
|---|---|
66+
| `@global/my-skill` | `my-skill` |
67+
| `@team-name/my-skill` | `team-name--my-skill` |
68+
69+
Rules:
70+
71+
- `--` is the namespace separator in the compatibility layer.
72+
- If there is no `--`, the skill is treated as `@global/...`.
73+
- `latest` resolves to the latest published version only.
74+
75+
Examples:
76+
77+
```bash
78+
npx clawhub install my-skill
79+
npx clawhub install my-skill@1.2.0
80+
npx clawhub install team-name--my-skill
81+
```
82+
83+
## Common Workflows
84+
85+
### Search
86+
87+
```bash
88+
npx clawhub search email
89+
```
90+
91+
Use an empty query when you want a broad listing:
92+
93+
```bash
94+
npx clawhub search ""
95+
```
96+
97+
### Inspect A Skill
98+
99+
```bash
100+
npx clawhub info my-skill
101+
npx clawhub info team-name--my-skill
102+
```
103+
104+
### Install
105+
106+
```bash
107+
npx clawhub install my-skill
108+
npx clawhub install my-skill@1.2.0
109+
npx clawhub install team-name--my-skill
110+
```
111+
112+
### Publish
113+
114+
Prepare a skill package directory, then publish it:
115+
116+
```bash
117+
npx clawhub publish ./my-skill
118+
```
119+
120+
Publishing requires authentication and sufficient permissions in the target namespace.
121+
122+
## Authentication And Visibility
123+
124+
Download and search permissions depend on namespace and visibility:
125+
126+
- `@global` + `PUBLIC`: anonymous search, inspect, and download are allowed.
127+
- Team namespace + `PUBLIC`: authentication required for download.
128+
- `NAMESPACE_ONLY`: authenticated namespace members only.
129+
- `PRIVATE`: owner or explicitly authorized users only.
130+
- Publish, star, and other write operations always require authentication.
131+
132+
If a request fails with `403`, check:
133+
134+
- whether the skill belongs to a team namespace,
135+
- whether the skill is `NAMESPACE_ONLY` or `PRIVATE`,
136+
- whether your token is valid,
137+
- whether you have namespace publish permissions.
138+
139+
## Skill Package Contract
140+
141+
SkillHub expects OpenSkills-style packages with `SKILL.md` as the entry point.
142+
143+
## Publishing Guidance
144+
145+
Just need to follow the OpenSkills-style standards.

web/src/features/skill/install-command.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ describe('install-command', () => {
7373
expect(getBaseUrl()).toBe('https://fallback.example.com')
7474
})
7575

76+
it('falls back to browser origin when app base url is localhost', () => {
77+
setMockWindow('http://localhost')
78+
expect(getBaseUrl()).toBe('https://fallback.example.com')
79+
})
80+
81+
it('falls back to browser origin when app base url contains localhost', () => {
82+
setMockWindow('http://localhost:8080')
83+
expect(getBaseUrl()).toBe('https://fallback.example.com')
84+
})
85+
7686
it('renders the install command in a more compact code block', () => {
7787
setMockWindow('http://localhost:3000')
7888

web/src/features/skill/install-command.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ export function getBaseUrl(): string {
1919
return ''
2020
}
2121
const runtimeConfig = window.__SKILLHUB_RUNTIME_CONFIG__
22-
if (runtimeConfig?.appBaseUrl) {
23-
return runtimeConfig.appBaseUrl
22+
const configuredUrl = runtimeConfig?.appBaseUrl
23+
// Use configured URL only if it's set and not localhost
24+
if (configuredUrl && !configuredUrl.includes('localhost')) {
25+
return configuredUrl
2426
}
27+
// Fallback to current page origin
2528
return `${window.location.protocol}//${window.location.host}`
2629
}
2730

web/src/i18n/landing-quick-start-locale.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,9 @@ describe('landing quick start locales', () => {
77
expect(zh.landing.quickStart.agent.command).toBe('阅读 https://www.example.com/registry/skill.md,并按照说明完成 SkillHub Skills Registry 的配置')
88
expect(en.landing.quickStart.agent.command).toBe('Read https://www.example.com/registry/skill.md and follow the instructions to setup SkillHub Skills Registry')
99
})
10+
11+
it('provides command templates with url placeholder for dynamic rendering', () => {
12+
expect(zh.landing.quickStart.agent.commandTemplate).toBe('阅读 {{url}},并按照说明完成 SkillHub Skills Registry 的配置')
13+
expect(en.landing.quickStart.agent.commandTemplate).toBe('Read {{url}} and follow the instructions to setup SkillHub Skills Registry')
14+
})
1015
})

web/src/i18n/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@
107107
},
108108
"agent": {
109109
"description": "Send a prompt to your Agent to set up the SkillHub Registry",
110-
"command": "Read https://www.example.com/registry/skill.md and follow the instructions to setup SkillHub Skills Registry"
110+
"command": "Read https://www.example.com/registry/skill.md and follow the instructions to setup SkillHub Skills Registry",
111+
"commandTemplate": "Read {{url}} and follow the instructions to setup SkillHub Skills Registry"
111112
},
112113
"human": {
113114
"description": "Use the CLI tool to install Skills",

0 commit comments

Comments
 (0)