adding REDIS_DATABASE env var (#134)

* adding REDIS_DATABASE env var, this allows defining an alterative redis database number so that a redis server can be shared by multiple consumers

Signed-off-by: Travis W Thompson <travis@tmdc.io>

* adding signed off

Signed-off-by: Travis W Thompson <travis@tmdc.io>

Co-authored-by: Travis W Thompson <travis@tmdc.io>
This commit is contained in:
Travis Thompson
2022-04-11 06:45:43 -07:00
committed by Bitnami Containers
parent 11e23fac9f
commit 2d0a67f10b
3 changed files with 4 additions and 1 deletions

View File

@@ -47,6 +47,7 @@ airflow_env_vars=(
AIRFLOW_REDIS_USE_SSL
REDIS_HOST
REDIS_PORT_NUMBER
REDIS_DATABASE
REDIS_USER
REDIS_PASSWORD
AIRFLOW_LDAP_ENABLE
@@ -123,6 +124,7 @@ export AIRFLOW_DATABASE_USE_SSL="${AIRFLOW_DATABASE_USE_SSL:-no}"
export AIRFLOW_REDIS_USE_SSL="${AIRFLOW_REDIS_USE_SSL:-no}"
export REDIS_HOST="${REDIS_HOST:-redis}"
export REDIS_PORT_NUMBER="${REDIS_PORT_NUMBER:-6379}"
export REDIS_DATABASE="${REDIS_DATABASE:-1}"
export REDIS_USER="${REDIS_USER:-}"
export REDIS_PASSWORD="${REDIS_PASSWORD:-}"

View File

@@ -356,7 +356,7 @@ airflow_configure_celery_executor() {
# Configure celery Redis url
local -r redis_user=$(airflow_encode_url "$REDIS_USER")
local -r redis_password=$(airflow_encode_url "$REDIS_PASSWORD")
airflow_conf_set "celery" "broker_url" "redis://${redis_user}:${redis_password}@${REDIS_HOST}:${REDIS_PORT_NUMBER}/1"
airflow_conf_set "celery" "broker_url" "redis://${redis_user}:${redis_password}@${REDIS_HOST}:${REDIS_PORT_NUMBER}/${REDIS_DATABASE}"
is_boolean_yes "$AIRFLOW_REDIS_USE_SSL" && airflow_conf_set "celery" "redis_backend_use_ssl" "true"
# Configure celery backend

View File

@@ -332,6 +332,7 @@ The Airflow instance can be customized by specifying environment variables on th
- `AIRFLOW_REDIS_USE_SSL`: Set to yes if Redis(TM) uses SSL. Default: **no**
- `REDIS_HOST`: Hostname for Redis(TM) server. Default: **redis**
- `REDIS_PORT_NUMBER`: Port used by Redis(TM) server. Default: **6379**
- `REDIS_DATABASE`: Database number for Redis(TM) server. Default: **1**
- `REDIS_USER`: User that Airflow will use to connect with Redis(TM). No defaults.
- `REDIS_PASSWORD`: Password that Airflow will use to connect with Redis(TM). No defaults.