diff --git a/docs/apache-airflow/production-deployment.rst b/docs/apache-airflow/production-deployment.rst index 8d7be95ef2d3f..34b12cb95e61d 100644 --- a/docs/apache-airflow/production-deployment.rst +++ b/docs/apache-airflow/production-deployment.rst @@ -810,6 +810,7 @@ available. This happens always when you use the default entrypoint. The script detects backend type depending on the URL schema and assigns default port numbers if not specified in the URL. Then it loops until the connection to the host/port specified can be established It tries ``CONNECTION_CHECK_MAX_COUNT`` times and sleeps ``CONNECTION_CHECK_SLEEP_TIME`` between checks +To disable check, set ``CONNECTION_CHECK_MAX_COUNT=0``. Supported schemes: @@ -894,7 +895,8 @@ commands are used the entrypoint will wait until the celery broker DB connection The script detects backend type depending on the URL schema and assigns default port numbers if not specified in the URL. Then it loops until connection to the host/port specified can be established -It tries ``CONNECTION_CHECK_MAX_COUNT`` times and sleeps ``CONNECTION_CHECK_SLEEP_TIME`` between checks +It tries ``CONNECTION_CHECK_MAX_COUNT`` times and sleeps ``CONNECTION_CHECK_SLEEP_TIME`` between checks. +To disable check, set ``CONNECTION_CHECK_MAX_COUNT=0``. Supported schemes: diff --git a/docs/apache-airflow/start/airflow.sh b/docs/apache-airflow/start/airflow.sh index b563139174569..4aa1d71cacf11 100755 --- a/docs/apache-airflow/start/airflow.sh +++ b/docs/apache-airflow/start/airflow.sh @@ -25,4 +25,4 @@ PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" set -euo pipefail export COMPOSE_FILE="${PROJECT_DIR}/docker-compose.yaml" -exec docker-compose run airflow-worker "${@}" +exec docker-compose run --rm -e CONNECTION_CHECK_MAX_COUNT=0 airflow-worker "${@}" diff --git a/scripts/in_container/prod/entrypoint_prod.sh b/scripts/in_container/prod/entrypoint_prod.sh index 12214be8a1bac..1dab5795d4c6d 100755 --- a/scripts/in_container/prod/entrypoint_prod.sh +++ b/scripts/in_container/prod/entrypoint_prod.sh @@ -239,7 +239,9 @@ readonly CONNECTION_CHECK_SLEEP_TIME create_system_user_if_missing set_pythonpath_for_root_user -wait_for_airflow_db +if [[ "${CONNECTION_CHECK_MAX_COUNT}" -gt "0" ]]; then + wait_for_airflow_db +fi if [[ -n "${_AIRFLOW_DB_UPGRADE=}" ]] ; then upgrade_db @@ -265,7 +267,8 @@ if [[ ${AIRFLOW_COMMAND} == "airflow" ]]; then fi # Note: the broker backend configuration concerns only a subset of Airflow components -if [[ ${AIRFLOW_COMMAND} =~ ^(scheduler|celery|worker|flower)$ ]]; then +if [[ ${AIRFLOW_COMMAND} =~ ^(scheduler|celery|worker|flower)$ ]] \ + && [[ "${CONNECTION_CHECK_MAX_COUNT}" -gt "0" ]]; then wait_for_celery_backend "${@}" fi