From 0c7ab243e12e1af245028a059f2d49db7e73d99d Mon Sep 17 00:00:00 2001 From: liukj Date: Thu, 16 Jan 2025 09:39:29 +0800 Subject: [PATCH] chore: add zh and en docs --- docs/.gitignore | 4 + docs/Makefile | 54 ++++++++ docs/README.md | 1 + docs/config.yaml | 97 ++++++++++++++ .../content.en/docs/getting-started/_index.md | 5 + .../docs/getting-started/install.md | 31 +++++ docs/content.en/docs/release-notes/_index.md | 118 ++++++++++++++++++ docs/content.en/menu/index.md | 6 + .../content.zh/docs/getting-started/_index.md | 5 + .../docs/getting-started/install.md | 31 +++++ docs/content.zh/docs/release-notes/_index.md | 115 +++++++++++++++++ docs/content.zh/menu/index.md | 6 + docs/static/img/logo-en.svg | 44 +++++++ docs/static/img/logo-zh.svg | 44 +++++++ 14 files changed, 561 insertions(+) create mode 100644 docs/.gitignore create mode 100644 docs/Makefile create mode 100644 docs/README.md create mode 100644 docs/config.yaml create mode 100644 docs/content.en/docs/getting-started/_index.md create mode 100644 docs/content.en/docs/getting-started/install.md create mode 100644 docs/content.en/docs/release-notes/_index.md create mode 100644 docs/content.en/menu/index.md create mode 100644 docs/content.zh/docs/getting-started/_index.md create mode 100644 docs/content.zh/docs/getting-started/install.md create mode 100644 docs/content.zh/docs/release-notes/_index.md create mode 100644 docs/content.zh/menu/index.md create mode 100644 docs/static/img/logo-en.svg create mode 100644 docs/static/img/logo-zh.svg diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..c5aa3d7 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,4 @@ +/public/ +/resources/ +/themes/ +/config.bak \ No newline at end of file diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..38aa3a9 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,54 @@ +SHELL=/bin/bash + +# Basic info +PRODUCT?= $(shell basename "$(shell cd .. && pwd)") +BRANCH?= main +VERSION?= $(shell [[ "$(BRANCH)" == "main" ]] && echo "main" || echo "$(BRANCH)") +CURRENT_VERSION?= $(VERSION) +VERSIONS?= "main" +OUTPUT?= "/tmp/docs" +THEME_FOLDER?= "themes/book" +THEME_REPO?= "https://github.com/infinilabs/docs-theme.git" +THEME_BRANCH?= "main" + +.PHONY: docs-build + +default: docs-build + +docs-init: + @if [ ! -d $(THEME_FOLDER) ]; then echo "theme does not exist";(git clone -b $(THEME_BRANCH) $(THEME_REPO) $(THEME_FOLDER) ) fi + +docs-env: + @echo "Debugging Variables:" + @echo "PRODUCT: $(PRODUCT)" + @echo "BRANCH: $(BRANCH)" + @echo "VERSION: $(VERSION)" + @echo "CURRENT_VERSION: $(CURRENT_VERSION)" + @echo "VERSIONS: $(VERSIONS)" + @echo "OUTPUT: $(OUTPUT)" + +docs-config: docs-init + cp config.yaml config.bak + # Detect OS and apply the appropriate sed command + @if [ "$$(uname)" = "Darwin" ]; then \ + echo "Running on macOS"; \ + sed -i '' "s/BRANCH/$(VERSION)/g" config.yaml; \ + else \ + echo "Running on Linux"; \ + sed -i 's/BRANCH/$(VERSION)/g' config.yaml; \ + fi + +docs-build: docs-config + hugo --minify --theme book --destination="$(OUTPUT)/$(PRODUCT)/$(VERSION)" \ + --baseURL="/$(PRODUCT)/$(VERSION)" + @$(MAKE) docs-restore-generated-file + +docs-serve: docs-config + hugo serve + @$(MAKE) docs-restore-generated-file + +docs-place-redirect: + echo "

REDIRECT TO THE LATEST_VERSION.

" > $(OUTPUT)/$(PRODUCT)/index.html + +docs-restore-generated-file: + mv config.bak config.yaml \ No newline at end of file diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/docs/README.md @@ -0,0 +1 @@ + diff --git a/docs/config.yaml b/docs/config.yaml new file mode 100644 index 0000000..c3251f9 --- /dev/null +++ b/docs/config.yaml @@ -0,0 +1,97 @@ +# VERSIONS=latest,v1.0 hugo --minify --baseURL="/product/v1.0/" -d public/product/v1.0 + +title: INFINI Loadgen +theme: book + +# Book configuration +disablePathToLower: true +enableGitInfo: false + +# Needed for mermaid/katex shortcodes +markup: + goldmark: + renderer: + unsafe: true + tableOfContents: + startLevel: 1 + +# Multi-lingual mode config +# There are different options to translate files +# See https://gohugo.io/content-management/multilingual/#translation-by-filename +# And https://gohugo.io/content-management/multilingual/#translation-by-content-directory +defaultContentLanguage: zh +languages: + zh: + languageName: 简体中文 + contentDir: content.zh + weight: 3 + en: + languageName: English + contentDir: content.en + weight: 4 + + +menu: + before: [] + after: + - name: "Github" + url: "https://github.com/infinilabs/loadgen" + weight: 10 + +params: + # (Optional, default light) Sets color theme: light, dark or auto. + # Theme 'auto' switches between dark and light modes based on browser/os preferences + BookTheme: "auto" + + # (Optional, default true) Controls table of contents visibility on right side of pages. + # Start and end levels can be controlled with markup.tableOfContents setting. + # You can also specify this parameter per page in front matter. + BookToC: true + + # (Optional, default none) Set the path to a logo for the book. If the logo is + # /static/logo.png then the path would be logo.png + BookLogo: img/logo + + # (Optional, default none) Set leaf bundle to render as side menu + # When not specified file structure and weights will be used +# BookMenuBundle: /menu + + # (Optional, default docs) Specify root page to render child pages as menu. + # Page is resoled by .GetPage function: https://gohugo.io/functions/getpage/ + # For backward compatibility you can set '*' to render all sections to menu. Acts same as '/' + BookSection: docs + + # Set source repository location. + # Used for 'Last Modified' and 'Edit this page' links. + BookRepo: https://github.com/infinilabs/loadgen + + # Enable "Edit this page" links for 'doc' page type. + # Disabled by default. Uncomment to enable. Requires 'BookRepo' param. + # Edit path must point to root directory of repo. + BookEditPath: edit/BRANCH/docs + + # Configure the date format used on the pages + # - In git information + # - In blog posts + BookDateFormat: "January 2, 2006" + + # (Optional, default true) Enables search function with flexsearch, + # Index is built on fly, therefore it might slowdown your website. + # Configuration for indexing can be adjusted in i18n folder per language. + BookSearch: false + + # (Optional, default true) Enables comments template on pages + # By default partals/docs/comments.html includes Disqus template + # See https://gohugo.io/content-management/comments/#configure-disqus + # Can be overwritten by same param in page frontmatter + BookComments: false + + # /!\ This is an experimental feature, might be removed or changed at any time + # (Optional, experimental, default false) Enables portable links and link checks in markdown pages. + # Portable links meant to work with text editors and let you write markdown without {{< relref >}} shortcode + # Theme will print warning if page referenced in markdown does not exists. + BookPortableLinks: true + + # /!\ This is an experimental feature, might be removed or changed at any time + # (Optional, experimental, default false) Enables service worker that caches visited pages and resources for offline use. + BookServiceWorker: false diff --git a/docs/content.en/docs/getting-started/_index.md b/docs/content.en/docs/getting-started/_index.md new file mode 100644 index 0000000..ef2b89d --- /dev/null +++ b/docs/content.en/docs/getting-started/_index.md @@ -0,0 +1,5 @@ +--- +weight: 10 +title: Getting Started +bookCollapseSection: true +--- diff --git a/docs/content.en/docs/getting-started/install.md b/docs/content.en/docs/getting-started/install.md new file mode 100644 index 0000000..bf3cf70 --- /dev/null +++ b/docs/content.en/docs/getting-started/install.md @@ -0,0 +1,31 @@ +--- +weight: 10 +title: Installing the Loadgen +asciinema: true +--- + +# Installing the Loadgen + +INFINI Loadgen supports mainstream operating systems and platforms. The program package is small, with no extra external dependency. So, the loadgen can be installed very rapidly. + +## Downloading + +**Automatic install** + +```bash +curl -sSL http://get.infini.cloud | bash -s -- -p loadgen +``` + +> The above script can automatically download the latest version of the corresponding platform's loadgen and extract it to /opt/loadgen + +> The optional parameters for the script are as follows: + +>     _-v [version number](Default to use the latest version number)_ + +>     _-d [installation directory] (default installation to /opt/loadgen)_ + +**Manual install** + +Select a package for downloading in the following URL based on your operating system and platform: + +[https://release.infinilabs.com/loadgen/](https://release.infinilabs.com/loadgen/) diff --git a/docs/content.en/docs/release-notes/_index.md b/docs/content.en/docs/release-notes/_index.md new file mode 100644 index 0000000..bed3166 --- /dev/null +++ b/docs/content.en/docs/release-notes/_index.md @@ -0,0 +1,118 @@ +--- +weight: 80 +title: "Release Notes" +--- + +# Release Notes + +Information about release notes of INFINI Loadgen is provided here. + +## 1.28.0 (2025-01-11) + +### Improvements + +- Synchronize updates for known issues fixed in the Framework. + +## 1.27.0 (2024-12-13) + +### Improvements + +- The code is open source, and Github [repository](https://github.com/infinilabs/loadgen) is used for development. +- Keep the same version number as INFINI Console. +- Synchronize updates for known issues fixed in the Framework. + +### Bug fix + +- Fix the abnormal problem of the API interface testing logic. + +## 1.26.1 (2024-08-13) + +### Improvements + +- Keep the same version number as INFINI Console. +- Synchronize updates for known issues fixed in the Framework. + +## 1.26.0 (2024-06-07) + +### Improvements + +- Keep the same version number as INFINI Console. +- Synchronize updates for known issues fixed in the Framework. + +## 1.25.0 (2024-04-30) + +### Improvements + +- Keep the same version number as INFINI Console. +- Synchronize updates for known issues fixed in the Framework. + +## 1.24.0 (2024-04-15) + +### Improvements + +- Keep the same version number as INFINI Console. +- Synchronize updates for known issues fixed in the Framework. + +## 1.22.0 (2024-01-26) + +### Improvements + +- Unified version number with INFINI Console + +## 1.8.0 (2023-11-02) + +### Breaking changes + +- The original Loadrun function is incorporated into Loadgen. +- Test the requests, assertions, etc. that is configured using the new Loadgen DSL syntax. + +## 1.7.0 (2023-04-20) + +### Breaking changes + +- The variables with the same `name` are no longer allowed to be defined in `variables`. + +### Features + +- Add the `log_status_code` configuration to support printing request logs of specific status codes. + +## 1.6.0 (2023-04-06) + +### Breaking ghanges + +- The `file` type variable by default no longer escapes the `"` and `\` characters. Use the `replace` function to manually set variable escaping. + +### Features + +- The variable definition adds an optional `replace` option, which is used to escape characters such as `"` and `\`. + +### Improvements + +- Optimize memory usage. + +### Bug fix + +- Fix the problem that the `\n` cannot be used in the YAML strings. +- Fix the problem that invalid assert configurations are ignored. + +## 1.5.1 + +### Bug fix + +- [DOC] Fix invalid variable grammar in `loadgen.yml`. + +## 1.5.0 + +### Features + +- Added `assert` configuration, support testing response data. +- Added `register` configuration, support registering dynamic variables. +- Added `env` configuration, support loading and using environment variables in `loadgen.yml`. +- Support using dynamic variables in the `headers` configuration. + +### Improvements + +- `-l` option: precisely control the number of requests to send. +- Added `runner.no_warm` to skip warm-up stage. + +### Bug fix diff --git a/docs/content.en/menu/index.md b/docs/content.en/menu/index.md new file mode 100644 index 0000000..4447b3c --- /dev/null +++ b/docs/content.en/menu/index.md @@ -0,0 +1,6 @@ +--- +headless: true +--- + +- [**Documentation**]({{< relref "/docs/" >}}) +
\ No newline at end of file diff --git a/docs/content.zh/docs/getting-started/_index.md b/docs/content.zh/docs/getting-started/_index.md new file mode 100644 index 0000000..ea17d9a --- /dev/null +++ b/docs/content.zh/docs/getting-started/_index.md @@ -0,0 +1,5 @@ +--- +weight: 10 +title: 入门指南 +bookCollapseSection: true +--- diff --git a/docs/content.zh/docs/getting-started/install.md b/docs/content.zh/docs/getting-started/install.md new file mode 100644 index 0000000..93bc97e --- /dev/null +++ b/docs/content.zh/docs/getting-started/install.md @@ -0,0 +1,31 @@ +--- +weight: 10 +title: 下载安装 +asciinema: true +--- + +# 安装 INFINI Loadgen + +INFINI Loadgen 支持主流的操作系统和平台,程序包很小,没有任何额外的外部依赖,安装起来应该是很快的 :) + +## 下载安装 + +**自动安装** + +```bash +curl -sSL http://get.infini.cloud | bash -s -- -p loadgen +``` + +> 通过以上脚本可自动下载相应平台的 loadgen 最新版本并解压到/opt/loadgen + +> 脚本的可选参数如下: + +>     _-v [版本号](默认采用最新版本号)_ + +>     _-d [安装目录](默认安装到/opt/loadgen)_ + +**手动安装** + +根据您所在的操作系统和平台选择下面相应的下载地址: + +[https://release.infinilabs.com/loadgen/](https://release.infinilabs.com/loadgen/) diff --git a/docs/content.zh/docs/release-notes/_index.md b/docs/content.zh/docs/release-notes/_index.md new file mode 100644 index 0000000..c5f2f0e --- /dev/null +++ b/docs/content.zh/docs/release-notes/_index.md @@ -0,0 +1,115 @@ +--- +weight: 80 +title: "版本历史" +--- + +# 版本发布日志 + +这里是`loadgen`历史版本发布的相关说明。 + +## 1.28.0 (2025-01-11) +- 同步更新 Framework 修复的一些已知问题 + +## 1.27.0 (2024-12-13) + +### Improvements + +- 代码开源,统一采用 Github [仓库](https://github.com/infinilabs/loadgen) 进行开发 +- 保持与 Console 相同版本 +- 同步更新 Framework 修复的已知问题 + +### Bug fix + +- 修复 API 接口测试逻辑异常问题 + +## 1.26.1 (2024-08-13) + +### Improvements + +- 与 INFINI Console 统一版本号 +- 同步更新 Framework 修复的已知问题 + +## 1.26.0 (2024-06-07) + +### Improvements + +- 与 INFINI Console 统一版本号 +- 同步更新 Framework 修复的已知问题 + +## 1.25.0 (2024-04-30) + +### Improvements + +- 与 INFINI Console 统一版本号 +- 同步更新 Framework 修复的已知问题 + +## 1.24.0 (2024-04-15) + +### Improvements + +- 与 INFINI Console 统一版本号 +- 同步更新 Framework 修复的已知问题 + +## 1.22.0 (2024-01-26) + +### Improvements + +- 与 INFINI Console 统一版本号 + +## 1.8.0 (2023-11-02) + +### Breaking changes + +- 原 Loadrun 功能并入 Loadgen +- 测试请求、断言等使用新的 Loadgen DSL 语法来配置 + +## 1.7.0 (2023-04-20) + +### Breaking changes + +- `variables` 不再允许定义相同 `name` 的变量。 + +### Features + +- 增加 `log_status_code` 配置,支持打印特定状态码的请求日志。 + +## 1.6.0 (2023-04-06) + +### Breaking ghanges + +- `file` 类型变量默认不再转义 `"` `\` 字符,使用 `replace` 功能手动设置变量转义。 + +### Features + +- 变量定义增加 `replace` 选项,可选跳过 `"` `\` 转义。 + +### Improvements + +- 优化内存占用 + +### Bug fix + +- 修复 YAML 字符串无法使用 `\n` 的问题 +- 修复无效的 assert 配置被忽略的问题 + +## 1.5.1 + +### Bug fix + +- 修复配置文件中无效的变量语法。 + +## 1.5.0 + +### Features + +- 配置文件添加 `assert` 配置,支持验证访问数据。 +- 配置文件添加 `register` 配置,支持注册动态变量。 +- 配置文件添加 `env` 配置,支持加载使用环境变量。 +- 支持在 `headers` 配置中使用动态变量。 + +### Improvements + +- 启动参数添加 `-l`: 控制发送请求的数量。 +- 配置文件添加 `runner.no_warm` 参数跳过预热阶段。 + +### Bug fix diff --git a/docs/content.zh/menu/index.md b/docs/content.zh/menu/index.md new file mode 100644 index 0000000..4447b3c --- /dev/null +++ b/docs/content.zh/menu/index.md @@ -0,0 +1,6 @@ +--- +headless: true +--- + +- [**Documentation**]({{< relref "/docs/" >}}) +
\ No newline at end of file diff --git a/docs/static/img/logo-en.svg b/docs/static/img/logo-en.svg new file mode 100644 index 0000000..366ce8c --- /dev/null +++ b/docs/static/img/logo-en.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/static/img/logo-zh.svg b/docs/static/img/logo-zh.svg new file mode 100644 index 0000000..366ce8c --- /dev/null +++ b/docs/static/img/logo-zh.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file