Skip to content

Commit

Permalink
docs: use variables for versions (#944)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicecui authored May 13, 2024
1 parent 7bab0c9 commit 9b879da
Show file tree
Hide file tree
Showing 16 changed files with 43 additions and 39 deletions.
22 changes: 10 additions & 12 deletions docs/.vitepress/config/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 `${_}`
}
})
}
})
}
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
- 3000:3000

greptime:
image: greptime/greptimedb:latest
image: greptime/greptimedb:<%greptimedb-version%>
container_name: greptimedb
ports:
- 4000:4000
Expand Down
6 changes: 3 additions & 3 deletions docs/nightly/en/getting-started/quick-start/prometheus.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ services:
- 3000:3000
greptime:
image: greptime/greptimedb:latest
image: greptime/greptimedb:<%greptimedb-version%>
container_name: greptimedb
ports:
- 4000:4000
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/nightly/en/getting-started/quick-start/vector.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ services:
- 3000:3000

greptime:
image: greptime/greptimedb:latest
image: greptime/greptimedb:<%greptimedb-version%>
container_name: greptimedb
ports:
- 4000:4000
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/nightly/en/user-guide/client-libraries/go.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion docs/nightly/en/user-guide/client-libraries/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies list:
<dependency>
<groupId>io.greptime</groupId>
<artifactId>ingester-all</artifactId>
<version>${latest_version}</version>
<version><%java-sdk-version%></version>
</dependency>
```

Expand Down
6 changes: 6 additions & 0 deletions docs/nightly/variates.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
```yaml
services:
prometheus:
image: prom/prometheus:latest
image: prom/prometheus:<%prometheus-version%>
container_name: prometheus
depends_on:
- node_exporter
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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 \
Expand Down
4 changes: 2 additions & 2 deletions docs/nightly/zh/getting-started/quick-start/prerequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions docs/nightly/zh/getting-started/quick-start/prometheus.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions docs/nightly/zh/getting-started/quick-start/vector.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/nightly/zh/user-guide/client-libraries/go.md
Original file line number Diff line number Diff line change
Expand Up @@ -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%>
```

引入到代码中:
Expand Down
2 changes: 1 addition & 1 deletion docs/nightly/zh/user-guide/client-libraries/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ GreptimeDB 提供的 Java ingester SDK 是一个轻量级库,具有以下特
<dependency>
<groupId>io.greptime</groupId>
<artifactId>ingester-all</artifactId>
<version>${latest_version}</version>
<version><%java-sdk-version%></version>
</dependency>
```

Expand Down

0 comments on commit 9b879da

Please sign in to comment.