diff --git a/docs/hosting/environment-variables/configuration-methods.md b/docs/hosting/environment-variables/configuration-methods.md index f04f2a5e78d..1434f1de8d8 100644 --- a/docs/hosting/environment-variables/configuration-methods.md +++ b/docs/hosting/environment-variables/configuration-methods.md @@ -22,12 +22,12 @@ In Docker you can use the `-e` flag from the command line: ```bash docker run -it --rm \ - --name n8n \ - -p 5678:5678 \ - -e N8N_BASIC_AUTH_ACTIVE="true" \ - -e N8N_BASIC_AUTH_USER="" \ - -e N8N_BASIC_AUTH_PASSWORD="" \ - n8nio/n8n + --name n8n \ + -p 5678:5678 \ + -e N8N_BASIC_AUTH_ACTIVE="true" \ + -e N8N_BASIC_AUTH_USER="" \ + -e N8N_BASIC_AUTH_PASSWORD="" \ + n8nio/n8n ``` ## Set environment variables using a file @@ -52,29 +52,29 @@ For example: ```json { - "executions": { - "process": "main", - "saveDataOnSuccess": "none" - }, - "generic": { - "timezone": "Europe/Berlin" - }, - "security": { - "basicAuth": { - "active": true, - "user": "frank", - "password": "some-secure-password" - } - }, - "nodes": { - "exclude": "[\"n8n-nodes-base.executeCommand\",\"n8n-nodes-base.writeBinaryFile\"]" - } + "executions": { + "process": "main", + "saveDataOnSuccess": "none" + }, + "generic": { + "timezone": "Europe/Berlin" + }, + "security": { + "basicAuth": { + "active": true, + "user": "frank", + "password": "some-secure-password" + } + }, + "nodes": { + "exclude": "[\"n8n-nodes-base.executeCommand\",\"n8n-nodes-base.writeBinaryFile\"]" + } } ``` ### Docker -In Docker, you can set your environment variables in the `n8n: environment:` element of your `docker-compose.yaml` file. +In Docker, you can set your environment variables in the `n8n: environment:` element of your `docker-compose.yaml` file. For example: @@ -92,33 +92,33 @@ You can append `_FILE` to some individual environment variables to provide their The following environment variables support file input: - - `CREDENTIALS_OVERWRITE_DATA_FILE` - - `DB_TYPE_FILE` - - `DB_MYSQLDB_DATABASE_FILE` - - `DB_MYSQLDB_HOST_FILE` - - `DB_MYSQLDB_PORT_FILE` - - `DB_MYSQLDB_USER_FILE` - - `DB_MYSQLDB_PASSWORD_FILE` - - `DB_POSTGRESDB_DATABASE_FILE` - - `DB_POSTGRESDB_HOST_FILE` - - `DB_POSTGRESDB_PASSWORD_FILE` - - `DB_POSTGRESDB_PORT_FILE` - - `DB_POSTGRESDB_SSL_CA_FILE` - - `DB_POSTGRESDB_SSL_CERT_FILE` - - `DB_POSTGRESDB_SSL_KEY_FILE` - - `DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED_FILE` - - `DB_POSTGRESDB_USER_FILE` - - `DB_POSTGRESDB_SCHEMA_FILE` - - `N8N_BASIC_AUTH_PASSWORD_FILE` - - `N8N_BASIC_AUTH_USER_FILE` - - `N8N_BASIC_AUTH_HASH_FILE` - - `N8N_JWT_AUTH_HEADER_FILE` - - `N8N_JWKS_URI_FILE` - - `N8N_JWT_AUTH_HEADER_VALUE_PREFIX_FILE` - - `N8N_JWT_ISSUER_FILE` - - `N8N_JWT_NAMESPACE_FILE` - - `N8N_JWT_ALLOWED_TENANT_FILE` - - `N8N_JWT_ALLOWED_TENANT_KEY_FILE` +- `CREDENTIALS_OVERWRITE_DATA_FILE` +- `DB_TYPE_FILE` +- `DB_MYSQLDB_DATABASE_FILE` +- `DB_MYSQLDB_HOST_FILE` +- `DB_MYSQLDB_PORT_FILE` +- `DB_MYSQLDB_USER_FILE` +- `DB_MYSQLDB_PASSWORD_FILE` +- `DB_POSTGRESDB_DATABASE_FILE` +- `DB_POSTGRESDB_HOST_FILE` +- `DB_POSTGRESDB_PASSWORD_FILE` +- `DB_POSTGRESDB_PORT_FILE` +- `DB_POSTGRESDB_SSL_CA_FILE` +- `DB_POSTGRESDB_SSL_CERT_FILE` +- `DB_POSTGRESDB_SSL_KEY_FILE` +- `DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED_FILE` +- `DB_POSTGRESDB_USER_FILE` +- `DB_POSTGRESDB_SCHEMA_FILE` +- `N8N_BASIC_AUTH_PASSWORD_FILE` +- `N8N_BASIC_AUTH_USER_FILE` +- `N8N_BASIC_AUTH_HASH_FILE` +- `N8N_JWT_AUTH_HEADER_FILE` +- `N8N_JWKS_URI_FILE` +- `N8N_JWT_AUTH_HEADER_VALUE_PREFIX_FILE` +- `N8N_JWT_ISSUER_FILE` +- `N8N_JWT_NAMESPACE_FILE` +- `N8N_JWT_ALLOWED_TENANT_FILE` +- `N8N_JWT_ALLOWED_TENANT_KEY_FILE` ## Examples @@ -127,7 +127,6 @@ The following environment variables support file input: !!! warning "Requires manual UI build" This variable requires a manual build of the `n8n-editor-ui` package. You can't use it with the default n8n Docker image. The default is `/`, meaning that it uses the root-domain. - Tells the front end how to reach the REST API of the back end: ```bash @@ -233,6 +232,9 @@ export WEBHOOK_URL=https://n8n.example.com/ ### Prometheus +!!! note "Experimental" + Prometheus metrics are an experimental feature. + To collect and expose metrics, n8n uses the [prom-client](https://www.npmjs.com/package/prom-client) library. The `/metrics` endpoint is disabled by default, but it's possible to enable it using the `N8N_METRICS` environment variable. @@ -241,11 +243,4 @@ The `/metrics` endpoint is disabled by default, but it's possible to enable it u export N8N_METRICS=true ``` -It's also possible to overwrite the prefix of the metric names by setting the `N8N_METRICS_PREFIX` environment variable. - -```bash -export N8N_METRICS_PREFIX=n8n_ -``` - -!!! note "Metrics and webhooks" - At the moment, n8n doesn't support metrics for webhooks. +Refer to the respective [Environment Variables](/hosting/environment-variables/environment-variables/#endpoints) (`N8N_METRICS_INCLUDE_*`) for configuring which metrics and labels should get exposed. diff --git a/docs/hosting/environment-variables/environment-variables.md b/docs/hosting/environment-variables/environment-variables.md index e1f86e87715..08c35d6d020 100644 --- a/docs/hosting/environment-variables/environment-variables.md +++ b/docs/hosting/environment-variables/environment-variables.md @@ -3,7 +3,6 @@ !!! note "File-based configuration" You can provide a [configuration file](/hosting/environment-variables/configuration-methods/) for n8n. You can also append `_FILE` to certain variables to provide their configuration in a separate file. Variables that support this have the "/`_FILE`" option listed below. - ## Credentials Enabling overwrites for credentials allows you to set default values for credentials which get automatically populated. The user can't see or change these credentials. The format is `{ CREDENTIAL_NAME: { PARAMETER: VALUE }}`. @@ -90,7 +89,6 @@ Enabling overwrites for credentials allows you to set default values for credent | `N8N_DEFAULT_BINARY_DATA_MODE` | String | `default` | The default binary data mode. `default` keeps binary data in memory. Set to `filesystem` to use the filesystem. | | `N8N_PERSISTED_BINARY_DATA_TTL` | Number | `1440` | Time to live (in minutes) for persisted data. | - ## User management and SMTP Refer to [User management](/hosting/authentication/user-management-self-hosted/) for more information on setting up user management and emails. @@ -109,14 +107,21 @@ Refer to [User management](/hosting/authentication/user-management-self-hosted/) | `N8N_UM_EMAIL_TEMPLATES_PWRESET` | String | - | Full path to your HTML email template. This overrides the default template for password reset emails. | | `N8N_USER_MANAGEMENT_JWT_SECRET` | String | - | Set a specific JWT secret. By default, n8n generates one on start. | - ## Endpoints | Variable | Type | Default | Description | | :------- | :---- | :------- | :---------- | | `N8N_PAYLOAD_SIZE_MAX` | Number | `16` | The maximum payload size in MB. | -| `N8N_METRICS` | Boolean | `false` | Whether to enable the metrics endpoint. | -| `N8N_METRICS_PREFIX` | String | `n8n_` | Optional prefix for metrics names. | +| `N8N_METRICS` | Boolean | `false` | Whether to enable the `/metrics` endpoint. | +| `N8N_METRICS_PREFIX` | String | `n8n_` | Optional prefix for n8n specific metrics names. | +| `N8N_METRICS_INCLUDE_DEFAULT_METRICS` | Boolean | `true` | Whether to expose default system and node.js metrics. | +| `N8N_METRICS_INCLUDE_WORKFLOW_ID_LABEL` | Boolean | `false` | Whether to include a label for the workflow ID on workflow metrics. | +| `N8N_METRICS_INCLUDE_NODE_TYPE_LABEL` | Boolean | `false` | Whether to include a label for the node type on node metrics. | +| `N8N_METRICS_INCLUDE_CREDENTIAL_TYPE_LABEL` | Boolean | `false` | Whether to include a label for the credential type on credential metrics. | +| `N8N_METRICS_INCLUDE_API_ENDPOINTS` | Boolean | `false` | Whether to expose metrics for API endpoints. | +| `N8N_METRICS_INCLUDE_API_PATH_LABEL` | Boolean | `false` | Whether to include a label for the path of API invocations. | +| `N8N_METRICS_INCLUDE_API_METHOD_LABEL` | Boolean | `false` | Whether to include a label for the HTTP method (GET, POST, ...) of API invocations. | +| `N8N_METRICS_INCLUDE_API_STATUS_CODE_LABEL` | Boolean | `false` | Whether to include a label for the HTTP status code (200, 404, ...) of API invocations. | | `N8N_ENDPOINT_REST` | String | `rest` | The path used for REST endpoint. | | `N8N_ENDPOINT_WEBHOOK` | String | `webhook` | The path used for webhook endpoint. | | `N8N_ENDPOINT_WEBHOOK_TEST` | String | `webhook-test` | The path used for test-webhook endpoint. |