Skip to content

Commit

Permalink
PMM-13171 Remove the unused environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
ademidoff committed Mar 11, 2025
1 parent 294a69e commit ca3ab78
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
24 changes: 20 additions & 4 deletions documentation/docs/reference/third-party/clickhouse.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ PMM predefines certain flags that allow you to use ClickHouse parameters as envi
To use ClickHouse as an external database instance, provide the following environment variables:

`PMM_CLICKHOUSE_ADDR` -> hostname:port
: Name of the host and port of the external ClickHouse database.
: Hostname and port of the external ClickHouse database.

`PMM_CLICKHOUSE_HOST` -> hostname
: Hostname of the external ClickHouse database.

`PMM_CLICKHOUSE_PORT` -> port
: Port of the external ClickHouse database.

`PMM_CLICKHOUSE_USER` -> username
: Username to connect to the external ClickHouse database.
Expand All @@ -29,11 +35,21 @@ To use ClickHouse as an external database instance, provide the following enviro
**Example**

To use ClickHouse as an external database instance, run PMM in docker or podman with the specified variables for external ClickHouse:
​​

```sh
-e PMM_CLICKHOUSE_ADDR=$ADDRESS:$PORT
-e PMM_CLICKHOUSE_DATABASE=$DB
-e PMM_CLICKHOUSE_ADDR=$CH_HOST:$CH_PORT
-e PMM_CLICKHOUSE_DATABASE=$CH_DATABASE
-e PMM_CLICKHOUSE_USER=$CH_USER
-e PMM_CLICKHOUSE_PASSWORD=$CH_PASSWORD
-e PMM_DISABLE_BUILTIN_CLICKHOUSE=1
```

Alternatively, you can use the `PMM_CLICKHOUSE_HOST` and `PMM_CLICKHOUSE_PORT` variables instead of `PMM_CLICKHOUSE_ADDR`.

```sh
-e PMM_CLICKHOUSE_HOST=$CH_HOST
-e PMM_CLICKHOUSE_PORT=$CH_PORT
-e PMM_CLICKHOUSE_DATABASE=$CH_DATABASE
-e PMM_CLICKHOUSE_USER=$CH_USER
-e PMM_CLICKHOUSE_PASSWORD=$CH_PASSWORD
-e PMM_DISABLE_BUILTIN_CLICKHOUSE=1
Expand Down
4 changes: 0 additions & 4 deletions managed/services/supervisord/supervisord.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import (
const (
defaultClickhouseDatabase = "pmm"
defaultClickhouseAddr = "127.0.0.1:9000"
defaultClickhouseDataSourceAddr = "127.0.0.1:8123"
defaultClickhouseUser = "default"
defaultClickhousePassword = "clickhouse"
defaultVMSearchMaxQueryLen = "1MB"
Expand Down Expand Up @@ -277,7 +276,6 @@ func getValueFromENV(envName string, defaultValue string) string {
func (s *Service) marshalConfig(tmpl *template.Template, settings *models.Settings, ssoDetails *models.PerconaSSODetails) ([]byte, error) {
clickhouseDatabase := getValueFromENV("PMM_CLICKHOUSE_DATABASE", defaultClickhouseDatabase)
clickhouseAddr := getValueFromENV("PMM_CLICKHOUSE_ADDR", defaultClickhouseAddr)
clickhouseDataSourceAddr := getValueFromENV("PMM_CLICKHOUSE_DATASOURCE_ADDR", defaultClickhouseDataSourceAddr)
clickhouseAddrPair := strings.SplitN(clickhouseAddr, ":", 2)
clickhouseUser := getValueFromENV("PMM_CLICKHOUSE_USER", defaultClickhouseUser)
clickhousePassword := getValueFromENV("PMM_CLICKHOUSE_PASSWORD", defaultClickhousePassword)
Expand Down Expand Up @@ -308,7 +306,6 @@ func (s *Service) marshalConfig(tmpl *template.Template, settings *models.Settin
"ExternalVM": s.vmParams.ExternalVM(),
"InterfaceToBind": envvars.GetInterfaceToBind(),
"ClickhouseAddr": clickhouseAddr,
"ClickhouseDataSourceAddr": clickhouseDataSourceAddr,
"ClickhouseDatabase": clickhouseDatabase,
"ClickhouseHost": clickhouseAddrPair[0],
"ClickhousePort": clickhouseAddrPair[1],
Expand Down Expand Up @@ -628,7 +625,6 @@ environment =
PMM_POSTGRES_SSL_CA_PATH="{{ .PostgresSSLCAPath }}",
PMM_POSTGRES_SSL_KEY_PATH="{{ .PostgresSSLKeyPath }}",
PMM_POSTGRES_SSL_CERT_PATH="{{ .PostgresSSLCertPath }}",
PMM_CLICKHOUSE_DATASOURCE_ADDR="{{ .ClickhouseDataSourceAddr }}",
PMM_CLICKHOUSE_HOST="{{ .ClickhouseHost }}",
PMM_CLICKHOUSE_PORT="{{ .ClickhousePort }}",
PMM_CLICKHOUSE_USER="{{ .ClickhouseUser }}",
Expand Down
1 change: 0 additions & 1 deletion managed/testdata/supervisord.d/grafana.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ environment =
PMM_POSTGRES_SSL_CA_PATH="path-to-CA-cert",
PMM_POSTGRES_SSL_KEY_PATH="path-to-key",
PMM_POSTGRES_SSL_CERT_PATH="path-to-cert",
PMM_CLICKHOUSE_DATASOURCE_ADDR="127.0.0.1:8123",
PMM_CLICKHOUSE_HOST="127.0.0.1",
PMM_CLICKHOUSE_PORT="9000",
PMM_CLICKHOUSE_USER="default",
Expand Down
7 changes: 4 additions & 3 deletions managed/utils/envvars/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@ func ParseEnvVars(envs []string) (*models.ChangeSettingsParams, []error, []strin
case "PMM_DEBUG", "PMM_TRACE":
// skip cross-component environment variables that are already handled by kingpin
continue
case "PMM_CLICKHOUSE_DATABASE", "PMM_CLICKHOUSE_ADDR", "PMM_CLICKHOUSE_DATASOURCE_ADDR",
"PMM_CLICKHOUSE_USER", "PMM_CLICKHOUSE_PASSWORD", "PMM_DISABLE_BUILTIN_CLICKHOUSE",
"PMM_CLICKHOUSE_HOST", "PMM_CLICKHOUSE_PORT":
case "PMM_CLICKHOUSE_DATABASE", "PMM_CLICKHOUSE_ADDR",
"PMM_CLICKHOUSE_USER", "PMM_CLICKHOUSE_PASSWORD",
"PMM_CLICKHOUSE_HOST", "PMM_CLICKHOUSE_PORT",
"PMM_DISABLE_BUILTIN_CLICKHOUSE":
// skip env variables for external clickhouse
continue
case "PMM_WATCHTOWER_TOKEN", "PMM_WATCHTOWER_HOST":
Expand Down

0 comments on commit ca3ab78

Please sign in to comment.