From 9b879da5af9db21704f1f7c86520b09a4a557dd3 Mon Sep 17 00:00:00 2001 From: Yiran Date: Mon, 13 May 2024 10:33:29 +0800 Subject: [PATCH] docs: use variables for versions (#944) --- docs/.vitepress/config/plugins.ts | 22 +++++++++---------- .../monitor-host-metrics/prometheus-demo.md | 4 ++-- .../installation/greptimedb-standalone.md | 4 ++-- .../quick-start/prerequisites.md | 2 +- .../getting-started/quick-start/prometheus.md | 6 ++--- .../en/getting-started/quick-start/vector.md | 4 ++-- .../en/user-guide/client-libraries/go.md | 2 +- .../en/user-guide/client-libraries/java.md | 2 +- docs/nightly/variates.yml | 6 +++++ .../monitor-host-metrics/prometheus-demo.md | 4 ++-- .../installation/greptimedb-standalone.md | 4 ++-- .../quick-start/prerequisites.md | 4 ++-- .../getting-started/quick-start/prometheus.md | 8 +++---- .../zh/getting-started/quick-start/vector.md | 6 ++--- .../zh/user-guide/client-libraries/go.md | 2 +- .../zh/user-guide/client-libraries/java.md | 2 +- 16 files changed, 43 insertions(+), 39 deletions(-) diff --git a/docs/.vitepress/config/plugins.ts b/docs/.vitepress/config/plugins.ts index cf788065e..eb1ea494c 100644 --- a/docs/.vitepress/config/plugins.ts +++ b/docs/.vitepress/config/plugins.ts @@ -6,18 +6,16 @@ export const replaceVariate = md => { const variatesKey = Object.keys(variates) md.block.ruler.before('paragraph', 'variate_replace', state => { - variatesKey.forEach(key => { - for (let i = 0; i < state.tokens.length; i++) { - const token = state.tokens[i] - if (token) { - token.content = token.content.replace(new RegExp(/<%\s*(.*?)\s*%>/, 'g'), (_, $1) => { - if (variates[$1]) return `${variates[key]}` - else { - return `${_}` - } - }) - } + for (let i = 0; i < state.tokens.length; i++) { + const token = state.tokens[i] + if (token) { + token.content = token.content.replace(new RegExp(/<%\s*(.*?)\s*%>/, 'g'), (_, $1) => { + if (variates[$1]) return `${variates[$1]}` + else { + return `${_}` + } + }) } - }) + } }) } diff --git a/docs/nightly/en/db-cloud-shared/tutorials/monitor-host-metrics/prometheus-demo.md b/docs/nightly/en/db-cloud-shared/tutorials/monitor-host-metrics/prometheus-demo.md index 78040946e..35d22a9a7 100644 --- a/docs/nightly/en/db-cloud-shared/tutorials/monitor-host-metrics/prometheus-demo.md +++ b/docs/nightly/en/db-cloud-shared/tutorials/monitor-host-metrics/prometheus-demo.md @@ -11,7 +11,7 @@ To begin, create a new directory named `quick-start-prometheus` to host our proj ```yaml services: prometheus: - image: prom/prometheus:latest + image: prom/prometheus:<%prometheus-version%> container_name: prometheus depends_on: - node_exporter @@ -21,7 +21,7 @@ services: - ./prometheus-greptimedb.yml:/etc/prometheus/prometheus.yml:ro node_exporter: - image: quay.io/prometheus/node-exporter:latest + image: quay.io/prometheus/node-exporter:<%node-exporter-version%> container_name: node_exporter ports: - 9100:9100 diff --git a/docs/nightly/en/getting-started/installation/greptimedb-standalone.md b/docs/nightly/en/getting-started/installation/greptimedb-standalone.md index c49fbafd7..d9c008ef7 100644 --- a/docs/nightly/en/getting-started/installation/greptimedb-standalone.md +++ b/docs/nightly/en/getting-started/installation/greptimedb-standalone.md @@ -43,7 +43,7 @@ Make sure the [Docker](https://www.docker.com/) is already installed. If not, yo docker run -p 4000-4003:4000-4003 \ -p 4242:4242 -v "$(pwd)/greptimedb:/tmp/greptimedb" \ --name greptime --rm \ -greptime/greptimedb standalone start \ +greptime/greptimedb:<%greptimedb-version%> standalone start \ --http-addr 0.0.0.0:4000 \ --rpc-addr 0.0.0.0:4001 \ --mysql-addr 0.0.0.0:4002 \ @@ -65,7 +65,7 @@ You can: docker run --security-opt seccomp=unconfined -p 4000-4003:4000-4003 \ -p 4242:4242 -v "$(pwd)/greptimedb:/tmp/greptimedb" \ --name greptime --rm \ - greptime/greptimedb standalone start \ + greptime/greptimedb:<%greptimedb-version%> standalone start \ --http-addr 0.0.0.0:4000 \ --rpc-addr 0.0.0.0:4001 \ --mysql-addr 0.0.0.0:4002 \ diff --git a/docs/nightly/en/getting-started/quick-start/prerequisites.md b/docs/nightly/en/getting-started/quick-start/prerequisites.md index eb54d0979..46ae69d13 100644 --- a/docs/nightly/en/getting-started/quick-start/prerequisites.md +++ b/docs/nightly/en/getting-started/quick-start/prerequisites.md @@ -15,7 +15,7 @@ services: - 3000:3000 greptime: - image: greptime/greptimedb:latest + image: greptime/greptimedb:<%greptimedb-version%> container_name: greptimedb ports: - 4000:4000 diff --git a/docs/nightly/en/getting-started/quick-start/prometheus.md b/docs/nightly/en/getting-started/quick-start/prometheus.md index 240bdb306..9311f4d0b 100644 --- a/docs/nightly/en/getting-started/quick-start/prometheus.md +++ b/docs/nightly/en/getting-started/quick-start/prometheus.md @@ -40,7 +40,7 @@ services: - 3000:3000 greptime: - image: greptime/greptimedb:latest + image: greptime/greptimedb:<%greptimedb-version%> container_name: greptimedb ports: - 4000:4000 @@ -52,7 +52,7 @@ services: - ./greptimedb:/tmp/greptimedb prometheus: - image: prom/prometheus:latest + image: prom/prometheus:<%prometheus-version%> container_name: prometheus depends_on: - node_exporter @@ -62,7 +62,7 @@ services: - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro node_exporter: - image: quay.io/prometheus/node-exporter:latest + image: quay.io/prometheus/node-exporter:<%node-exporter-version%> container_name: node_exporter_local ports: - 9100:9100 diff --git a/docs/nightly/en/getting-started/quick-start/vector.md b/docs/nightly/en/getting-started/quick-start/vector.md index 8af177e25..caf77864d 100644 --- a/docs/nightly/en/getting-started/quick-start/vector.md +++ b/docs/nightly/en/getting-started/quick-start/vector.md @@ -36,7 +36,7 @@ services: - 3000:3000 greptime: - image: greptime/greptimedb:latest + image: greptime/greptimedb:<%greptimedb-version%> container_name: greptimedb ports: - 4000:4000 @@ -48,7 +48,7 @@ services: - ./greptimedb:/tmp/greptimedb vector: - image: timberio/vector:0.33.0-debian + image: timberio/vector:<%vector-version%> container_name: vector ports: - 8686:8686 diff --git a/docs/nightly/en/user-guide/client-libraries/go.md b/docs/nightly/en/user-guide/client-libraries/go.md index f759964cc..335046586 100644 --- a/docs/nightly/en/user-guide/client-libraries/go.md +++ b/docs/nightly/en/user-guide/client-libraries/go.md @@ -18,7 +18,7 @@ concurrent-safe library that is easy to use with the metric struct. Use the following command to install the GreptimeDB client library for Go: ```shell -go get -u github.com/GreptimeTeam/greptimedb-ingester-go +go get -u github.com/GreptimeTeam/greptimedb-ingester-go@<%go-sdk-version%> ``` Import the library in your code: diff --git a/docs/nightly/en/user-guide/client-libraries/java.md b/docs/nightly/en/user-guide/client-libraries/java.md index 9c510556b..bd83f141b 100644 --- a/docs/nightly/en/user-guide/client-libraries/java.md +++ b/docs/nightly/en/user-guide/client-libraries/java.md @@ -32,7 +32,7 @@ dependencies list: io.greptime ingester-all - ${latest_version} + <%java-sdk-version%> ``` diff --git a/docs/nightly/variates.yml b/docs/nightly/variates.yml index 294f755ed..57f79ad7b 100644 --- a/docs/nightly/variates.yml +++ b/docs/nightly/variates.yml @@ -1 +1,7 @@ grafana-version: 9.5.15 +greptimedb-version: v0.7.2 +vector-version: 0.33.0-debian +prometheus-version: v2.52.0 +node-exporter-version: v1.8.0 +go-sdk-version: v0.5.0 +java-sdk-version: 0.7.3 diff --git a/docs/nightly/zh/db-cloud-shared/tutorials/monitor-host-metrics/prometheus-demo.md b/docs/nightly/zh/db-cloud-shared/tutorials/monitor-host-metrics/prometheus-demo.md index 411819cd4..e5526db0f 100644 --- a/docs/nightly/zh/db-cloud-shared/tutorials/monitor-host-metrics/prometheus-demo.md +++ b/docs/nightly/zh/db-cloud-shared/tutorials/monitor-host-metrics/prometheus-demo.md @@ -11,7 +11,7 @@ ```yaml services: prometheus: - image: prom/prometheus:latest + image: prom/prometheus:<%prometheus-version%> container_name: prometheus depends_on: - node_exporter @@ -21,7 +21,7 @@ services: - ./prometheus-greptimedb.yml:/etc/prometheus/prometheus.yml:ro node_exporter: - image: quay.io/prometheus/node-exporter:latest + image: quay.io/prometheus/node-exporter:<%node-exporter-version%> container_name: node_exporter ports: - 9100:9100 diff --git a/docs/nightly/zh/getting-started/installation/greptimedb-standalone.md b/docs/nightly/zh/getting-started/installation/greptimedb-standalone.md index 5143675e0..edc60b7d9 100644 --- a/docs/nightly/zh/getting-started/installation/greptimedb-standalone.md +++ b/docs/nightly/zh/getting-started/installation/greptimedb-standalone.md @@ -45,7 +45,7 @@ curl -fsSL \ docker run -p 4000-4003:4000-4003 \ -p 4242:4242 -v "$(pwd)/greptimedb:/tmp/greptimedb" \ --name greptime --rm \ -greptime/greptimedb standalone start \ +greptime/greptimedb:<%greptimedb-version%> standalone start \ --http-addr 0.0.0.0:4000 \ --rpc-addr 0.0.0.0:4001 \ --mysql-addr 0.0.0.0:4002 \ @@ -68,7 +68,7 @@ greptime/greptimedb standalone start \ docker run --security-opt seccomp=unconfined -p 4000-4003:4000-4003 \ -p 4242:4242 -v "$(pwd)/greptimedb:/tmp/greptimedb" \ --name greptime --rm \ - greptime/greptimedb standalone start \ + greptime/greptimedb:<%greptimedb-version%> standalone start \ --http-addr 0.0.0.0:4000 \ --rpc-addr 0.0.0.0:4001 \ --mysql-addr 0.0.0.0:4002 \ diff --git a/docs/nightly/zh/getting-started/quick-start/prerequisites.md b/docs/nightly/zh/getting-started/quick-start/prerequisites.md index 2df72abbe..d5dfa7b54 100644 --- a/docs/nightly/zh/getting-started/quick-start/prerequisites.md +++ b/docs/nightly/zh/getting-started/quick-start/prerequisites.md @@ -9,13 +9,13 @@ ```yaml services: grafana: - image: grafana/grafana-oss:9.5.15 + image: grafana/grafana-oss:<%grafana-version%> container_name: grafana ports: - 3000:3000 greptime: - image: greptime/greptimedb:latest + image: greptime/greptimedb:<%greptimedb-version%> container_name: greptimedb ports: - 4000:4000 diff --git a/docs/nightly/zh/getting-started/quick-start/prometheus.md b/docs/nightly/zh/getting-started/quick-start/prometheus.md index c772930aa..257d22dfb 100644 --- a/docs/nightly/zh/getting-started/quick-start/prometheus.md +++ b/docs/nightly/zh/getting-started/quick-start/prometheus.md @@ -34,13 +34,13 @@ remote_write: ```yaml services: grafana: - image: grafana/grafana-oss:9.5.15 + image: grafana/grafana-oss:<%grafana-version%> container_name: grafana ports: - 3000:3000 greptime: - image: greptime/greptimedb:latest + image: greptime/greptimedb:<%greptimedb-version%> container_name: greptimedb ports: - 4000:4000 @@ -52,7 +52,7 @@ services: - ./greptimedb:/tmp/greptimedb prometheus: - image: prom/prometheus:latest + image: prom/prometheus:<%prometheus-version%> container_name: prometheus depends_on: - node_exporter @@ -62,7 +62,7 @@ services: - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro node_exporter: - image: quay.io/prometheus/node-exporter:latest + image: quay.io/prometheus/node-exporter:<%node-exporter-version%> container_name: node_exporter_local ports: - 9100:9100 diff --git a/docs/nightly/zh/getting-started/quick-start/vector.md b/docs/nightly/zh/getting-started/quick-start/vector.md index f9fda6e8c..7d63c43fe 100644 --- a/docs/nightly/zh/getting-started/quick-start/vector.md +++ b/docs/nightly/zh/getting-started/quick-start/vector.md @@ -29,13 +29,13 @@ dbname = "public" ```yaml services: grafana: - image: grafana/grafana-oss:9.5.15 + image: grafana/grafana-oss:<%grafana-version%> container_name: grafana ports: - 3000:3000 greptime: - image: greptime/greptimedb:latest + image: greptime/greptimedb:<%greptimedb-version%> container_name: greptimedb ports: - 4000:4000 @@ -47,7 +47,7 @@ services: - ./greptimedb:/tmp/greptimedb vector: - image: timberio/vector:0.33.0-debian + image: timberio/vector:<%vector-version%> container_name: vector ports: - 8686:8686 diff --git a/docs/nightly/zh/user-guide/client-libraries/go.md b/docs/nightly/zh/user-guide/client-libraries/go.md index 0d5b9e263..39288d185 100644 --- a/docs/nightly/zh/user-guide/client-libraries/go.md +++ b/docs/nightly/zh/user-guide/client-libraries/go.md @@ -17,7 +17,7 @@ GreptimeDB 提供的 Go Ingest SDK 是一个轻量级、并发安全的库,使 使用下方的命令安装 Go Ingest SDK: ```shell -go get -u github.com/GreptimeTeam/greptimedb-ingester-go +go get -u github.com/GreptimeTeam/greptimedb-ingester-go@<%go-sdk-version%> ``` 引入到代码中: diff --git a/docs/nightly/zh/user-guide/client-libraries/java.md b/docs/nightly/zh/user-guide/client-libraries/java.md index 08aa5715d..a52837b4b 100644 --- a/docs/nightly/zh/user-guide/client-libraries/java.md +++ b/docs/nightly/zh/user-guide/client-libraries/java.md @@ -30,7 +30,7 @@ GreptimeDB 提供的 Java ingester SDK 是一个轻量级库,具有以下特 io.greptime ingester-all - ${latest_version} + <%java-sdk-version%> ```