From 2631f1bb7e54ad5139ba27f8e20d8a75887da8e8 Mon Sep 17 00:00:00 2001 From: Tyler Bigler Date: Fri, 25 Oct 2019 10:02:12 -0400 Subject: [PATCH] Add CONN_MAX_AGE to sample configurations --- docs/configuration/required-settings.md | 4 +++- docs/installation/2-netbox.md | 1 + netbox/netbox/configuration.example.py | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/configuration/required-settings.md b/docs/configuration/required-settings.md index e4f2aed97..d7c07fe9c 100644 --- a/docs/configuration/required-settings.md +++ b/docs/configuration/required-settings.md @@ -21,6 +21,7 @@ NetBox requires access to a PostgreSQL database service to store data. This serv * `PASSWORD` - PostgreSQL password * `HOST` - Name or IP address of the database server (use `localhost` if running locally) * `PORT` - TCP port of the PostgreSQL service; leave blank for default port (5432) +* `CONN_MAX_AGE` - Number in seconds for Netbox to keep database connections open. 150-300 seconds is typically a good starting point ([more info](https://docs.djangoproject.com/en/2.2/ref/databases/#persistent-connections)). Example: @@ -31,6 +32,7 @@ DATABASE = { 'PASSWORD': 'J5brHrAXFLQSif0K', # PostgreSQL password 'HOST': 'localhost', # Database server 'PORT': '', # Database port (leave blank for default) + 'CONN_MAX_AGE': 300, # Max database connection age } ``` @@ -69,7 +71,7 @@ REDIS = { !!! note: If you were using these settings in a prior release with webhooks, the `DATABASE` setting remains the same but an additional `CACHE_DATABASE` setting has been added with a default value of 1 to support the caching backend. The - `DATABASE` setting will be renamed in a future release of NetBox to better relay the meaning of the setting. + `DATABASE` setting will be renamed in a future release of NetBox to better relay the meaning of the setting. !!! warning: It is highly recommended to keep the webhook and cache databases seperate. Using the same database number for both may result in webhook diff --git a/docs/installation/2-netbox.md b/docs/installation/2-netbox.md index cd7aea171..7bae23d77 100644 --- a/docs/installation/2-netbox.md +++ b/docs/installation/2-netbox.md @@ -129,6 +129,7 @@ DATABASE = { 'PASSWORD': 'J5brHrAXFLQSif0K', # PostgreSQL password 'HOST': 'localhost', # Database server 'PORT': '', # Database port (leave blank for default) + 'CONN_MAX_AGE': 300, # Max database connection age } ``` diff --git a/netbox/netbox/configuration.example.py b/netbox/netbox/configuration.example.py index 16316bb66..6f7e61f0b 100644 --- a/netbox/netbox/configuration.example.py +++ b/netbox/netbox/configuration.example.py @@ -17,6 +17,7 @@ DATABASE = { 'PASSWORD': '', # PostgreSQL password 'HOST': 'localhost', # Database server 'PORT': '', # Database port (leave blank for default) + 'CONN_MAX_AGE': 300, # Max database connection age } # This key is used for secure generation of random numbers and strings. It must never be exposed outside of this file.