From 3fd4e77fa751d1a31fb49ce751ee76b3150fd38e Mon Sep 17 00:00:00 2001 From: meelahme Date: Mon, 12 May 2025 13:27:08 -0700 Subject: [PATCH 1/5] docs(influxdb3): Add code-placeholders and tabbed examples for admin token creation (#6020) --- .../v3-enterprise-get-started/_index.md | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/content/shared/v3-enterprise-get-started/_index.md b/content/shared/v3-enterprise-get-started/_index.md index 50116db52..eafbd5c06 100644 --- a/content/shared/v3-enterprise-get-started/_index.md +++ b/content/shared/v3-enterprise-get-started/_index.md @@ -282,15 +282,40 @@ To have the `influxdb3` CLI use your admin token automatically, assign it to the To create an admin token, use the `influxdb3 create token --admin` subcommand--for example: +{{% code-placeholders "INFLUXDB_HOST|CONTAINER_NAME" %}} + +{{< code-tabs-wrapper >}} + +{{% code-tabs %}} +[CLI](#) +[Docker](#) +{{% /code-tabs %}} + +{{% code-tab-content %}} ```bash influxdb3 create token --admin \ - --host http://{{< influxdb/host >}} + --host http://INFLUXDB_HOST ``` +{{% /code-tab-content %}} + +{{% code-tab-content %}} + ```bash -# With Docker -- In a new terminal, run: +# With Docker — in a new terminal: docker exec -it CONTAINER_NAME influxdb3 create token --admin ``` +{{% /code-tab-content %}} + +{{< /code-tabs-wrapper >}} + +Replace the following: + +- {{% code-placeholder-key %}}`INFLUXDB_HOST`{{% /code-placeholder-key %}}: Host address of your InfluxDB 3 server (for example, `localhost:8181`) +- {{% code-placeholder-key %}}`CONTAINER_NAME`{{% /code-placeholder-key %}}: Name of your running Docker container + +{{% /code-placeholders %}} + The command returns a token string that you can use to authenticate CLI commands and API requests. After you have created an admin token, you can use it to create database tokens and system tokens. @@ -327,8 +352,7 @@ influxdb3 create token \ ``` {{% /code-placeholders %}} -In your command, replace {{% code-placeholder-key %}} `ADMIN_TOKEN`{{% /code-placeholder-key %}} -with the admin token you created earlier. +In your command, replace {{% code-placeholder-key %}} `ADMIN_TOKEN`{{% /code-placeholder-key %}} with the admin token you created earlier. #### Create a system token @@ -355,6 +379,8 @@ To create a system token, use the `influxdb3 create token` subcommand and pass t The following example shows how to create a system token that expires in 1 year and has read permissions for all system endpoints on the server: +{{% code-placeholders "ADMIN_TOKEN" %}} + ```bash influxdb3 create token \ --permission \ @@ -364,6 +390,9 @@ influxdb3 create token \ --name "all system endpoints" \ "system:*:read" ``` +{{% /code-placeholders %}} + +In your command, replace {{% code-placeholder-key %}} `ADMIN_TOKEN`{{% /code-placeholder-key %}} with the admin token you created earlier. For more information, see how to [Manage resource tokens](/influxdb3/version/admin/tokens/resource/). From 7ae03927fb051b0bd79927d726d5d711802793ec Mon Sep 17 00:00:00 2001 From: meelahme Date: Mon, 12 May 2025 13:58:30 -0700 Subject: [PATCH 2/5] docs(influxdb3): updating code-placeholders and tabbed examples --- content/shared/v3-core-get-started/_index.md | 29 +++++++++++++++++-- .../v3-enterprise-get-started/_index.md | 15 ++++++---- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/content/shared/v3-core-get-started/_index.md b/content/shared/v3-core-get-started/_index.md index f6f3bfa69..079c10b70 100644 --- a/content/shared/v3-core-get-started/_index.md +++ b/content/shared/v3-core-get-started/_index.md @@ -252,15 +252,40 @@ To have the `influxdb3` CLI use your admin token automatically, assign it to the To create an admin token, use the `influxdb3 create token --admin` subcommand--for example: +{{% code-placeholders "INFLUXDB_HOST|CONTAINER_NAME" %}} + +{{< code-tabs-wrapper >}} + +{{% code-tabs %}} +[CLI](#) +[Docker](#) +{{% /code-tabs %}} + +{{% code-tab-content %}} ```bash influxdb3 create token --admin \ - --host http://{{< influxdb/host >}} + --host http://INFLUXDB_HOST ``` +{{% /code-tab-content %}} + +{{% code-tab-content %}} + ```bash -# With Docker -- In a new terminal, run: +# With Docker — in a new terminal: docker exec -it CONTAINER_NAME influxdb3 create token --admin ``` +{{% /code-tab-content %}} + +{{< /code-tabs-wrapper >}} + +Replace the following: + +- {{% code-placeholder-key %}}`INFLUXDB_HOST`{{% /code-placeholder-key %}}: Host address of your InfluxDB 3 server (for example, `localhost:8181`) +- {{% code-placeholder-key %}}`CONTAINER_NAME`{{% /code-placeholder-key %}}: Name of your running Docker container + +{{% /code-placeholders %}} + The command returns a token string that you can use to authenticate CLI commands and API requests. For more information, see how to [Manage admin tokens](/influxdb3/version/admin/tokens/admin/). diff --git a/content/shared/v3-enterprise-get-started/_index.md b/content/shared/v3-enterprise-get-started/_index.md index eafbd5c06..71acde9a5 100644 --- a/content/shared/v3-enterprise-get-started/_index.md +++ b/content/shared/v3-enterprise-get-started/_index.md @@ -309,13 +309,13 @@ docker exec -it CONTAINER_NAME influxdb3 create token --admin {{< /code-tabs-wrapper >}} +{{% /code-placeholders %}} + Replace the following: - {{% code-placeholder-key %}}`INFLUXDB_HOST`{{% /code-placeholder-key %}}: Host address of your InfluxDB 3 server (for example, `localhost:8181`) - {{% code-placeholder-key %}}`CONTAINER_NAME`{{% /code-placeholder-key %}}: Name of your running Docker container -{{% /code-placeholders %}} - The command returns a token string that you can use to authenticate CLI commands and API requests. After you have created an admin token, you can use it to create database tokens and system tokens. @@ -341,6 +341,7 @@ To create a database token, use the `influxdb3 create token` subcommand and pass The following example shows how to create a database token that expires in 90 days and has read and write permissions for all databases on the server: {{% code-placeholders "ADMIN_TOKEN" %}} + ```bash influxdb3 create token \ --permission \ @@ -401,14 +402,18 @@ For more information, see how to [Manage resource tokens](/influxdb3/version/adm - To authenticate `influxdb3` CLI commands, use the `--token` option or assign your token to the `INFLUXDB3_AUTH_TOKEN` environment variable for `influxdb3` to use it automatically. - To authenticate HTTP API requests, include `Bearer ` in the `Authorization` header value--for example: - + +{{% code-placeholders "SYSTEM_TOKEN" %}} + ```bash curl "http://{{< influxdb/host >}}/health" \ --header "Authorization: Bearer SYSTEM_TOKEN" ``` +{{% /code-placeholders %}} - In your request, replace - {{% code-placeholder-key %}}`SYSTEM_TOKEN`{{% /code-placeholder-key %}} with the system token you created earlier. +Replace the following: + +In your command, replace {{% code-placeholder-key %}}`SYSTEM_TOKEN`{{% /code-placeholder-key %}}: System token that grants access to system endpoints (`/health`, `/metrics`, etc.) ### Data model From 5c8935f6f7d19a784ee6083c2070cb5b98587ad4 Mon Sep 17 00:00:00 2001 From: meelahme Date: Fri, 16 May 2025 10:20:55 -0700 Subject: [PATCH 3/5] fix(docs): remove nested code-placeholders and scope per code tab --- content/shared/v3-core-get-started/_index.md | 12 ++++++------ content/shared/v3-enterprise-get-started/_index.md | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/content/shared/v3-core-get-started/_index.md b/content/shared/v3-core-get-started/_index.md index 079c10b70..09e6ab1d4 100644 --- a/content/shared/v3-core-get-started/_index.md +++ b/content/shared/v3-core-get-started/_index.md @@ -252,28 +252,30 @@ To have the `influxdb3` CLI use your admin token automatically, assign it to the To create an admin token, use the `influxdb3 create token --admin` subcommand--for example: -{{% code-placeholders "INFLUXDB_HOST|CONTAINER_NAME" %}} - {{< code-tabs-wrapper >}} {{% code-tabs %}} [CLI](#) [Docker](#) {{% /code-tabs %}} - {{% code-tab-content %}} + ```bash influxdb3 create token --admin \ --host http://INFLUXDB_HOST ``` -{{% /code-tab-content %}} +{{% /code-tab-content %}} {{% code-tab-content %}} +{{% code-placeholders "CONTAINER_NAME" %}} ```bash # With Docker — in a new terminal: docker exec -it CONTAINER_NAME influxdb3 create token --admin ``` +{{% /code-placeholders %}} + +Replace {{% code-placeholder-key %}}`CONTAINER_NAME`{{% /code-placeholder-key %}} with the name of your running Docker container. {{% /code-tab-content %}} @@ -284,8 +286,6 @@ Replace the following: - {{% code-placeholder-key %}}`INFLUXDB_HOST`{{% /code-placeholder-key %}}: Host address of your InfluxDB 3 server (for example, `localhost:8181`) - {{% code-placeholder-key %}}`CONTAINER_NAME`{{% /code-placeholder-key %}}: Name of your running Docker container -{{% /code-placeholders %}} - The command returns a token string that you can use to authenticate CLI commands and API requests. For more information, see how to [Manage admin tokens](/influxdb3/version/admin/tokens/admin/). diff --git a/content/shared/v3-enterprise-get-started/_index.md b/content/shared/v3-enterprise-get-started/_index.md index 71acde9a5..a37886a1e 100644 --- a/content/shared/v3-enterprise-get-started/_index.md +++ b/content/shared/v3-enterprise-get-started/_index.md @@ -282,35 +282,35 @@ To have the `influxdb3` CLI use your admin token automatically, assign it to the To create an admin token, use the `influxdb3 create token --admin` subcommand--for example: -{{% code-placeholders "INFLUXDB_HOST|CONTAINER_NAME" %}} - {{< code-tabs-wrapper >}} {{% code-tabs %}} [CLI](#) [Docker](#) {{% /code-tabs %}} - {{% code-tab-content %}} + ```bash influxdb3 create token --admin \ --host http://INFLUXDB_HOST ``` -{{% /code-tab-content %}} +{{% /code-tab-content %}} {{% code-tab-content %}} +{{% code-placeholders "CONTAINER_NAME" %}} ```bash # With Docker — in a new terminal: docker exec -it CONTAINER_NAME influxdb3 create token --admin ``` +{{% /code-placeholders %}} + +Replace {{% code-placeholder-key %}}`CONTAINER_NAME`{{% /code-placeholder-key %}} with the name of your running Docker container. {{% /code-tab-content %}} {{< /code-tabs-wrapper >}} -{{% /code-placeholders %}} - Replace the following: - {{% code-placeholder-key %}}`INFLUXDB_HOST`{{% /code-placeholder-key %}}: Host address of your InfluxDB 3 server (for example, `localhost:8181`) From cc3b1a93257c0369f2a8f4bbd05cee89014e9c5c Mon Sep 17 00:00:00 2001 From: Jameelah Mercer <36314199+MeelahMe@users.noreply.github.com> Date: Fri, 16 May 2025 10:51:28 -0700 Subject: [PATCH 4/5] Update content/shared/v3-enterprise-get-started/_index.md Co-authored-by: Scott Anderson --- content/shared/v3-enterprise-get-started/_index.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/content/shared/v3-enterprise-get-started/_index.md b/content/shared/v3-enterprise-get-started/_index.md index a37886a1e..7262570f5 100644 --- a/content/shared/v3-enterprise-get-started/_index.md +++ b/content/shared/v3-enterprise-get-started/_index.md @@ -311,11 +311,6 @@ Replace {{% code-placeholder-key %}}`CONTAINER_NAME`{{% /code-placeholder-key %} {{< /code-tabs-wrapper >}} -Replace the following: - -- {{% code-placeholder-key %}}`INFLUXDB_HOST`{{% /code-placeholder-key %}}: Host address of your InfluxDB 3 server (for example, `localhost:8181`) -- {{% code-placeholder-key %}}`CONTAINER_NAME`{{% /code-placeholder-key %}}: Name of your running Docker container - The command returns a token string that you can use to authenticate CLI commands and API requests. After you have created an admin token, you can use it to create database tokens and system tokens. From da0fde5af631a9037f21c6f854ce4e34914f6525 Mon Sep 17 00:00:00 2001 From: Jameelah Mercer <36314199+MeelahMe@users.noreply.github.com> Date: Fri, 16 May 2025 10:51:35 -0700 Subject: [PATCH 5/5] Update content/shared/v3-core-get-started/_index.md Co-authored-by: Scott Anderson --- content/shared/v3-core-get-started/_index.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/content/shared/v3-core-get-started/_index.md b/content/shared/v3-core-get-started/_index.md index 09e6ab1d4..f4e160ab4 100644 --- a/content/shared/v3-core-get-started/_index.md +++ b/content/shared/v3-core-get-started/_index.md @@ -281,11 +281,6 @@ Replace {{% code-placeholder-key %}}`CONTAINER_NAME`{{% /code-placeholder-key %} {{< /code-tabs-wrapper >}} -Replace the following: - -- {{% code-placeholder-key %}}`INFLUXDB_HOST`{{% /code-placeholder-key %}}: Host address of your InfluxDB 3 server (for example, `localhost:8181`) -- {{% code-placeholder-key %}}`CONTAINER_NAME`{{% /code-placeholder-key %}}: Name of your running Docker container - The command returns a token string that you can use to authenticate CLI commands and API requests. For more information, see how to [Manage admin tokens](/influxdb3/version/admin/tokens/admin/).