19
19
20
20
# Stackable notes:
21
21
# Source of this file is the upstream Apache Airflow project
22
- # https://github.com/apache/airflow/blob/main /scripts/docker/entrypoint_prod.sh
23
- # It was last synced from the upstream repo on 2023-07-31 and is up-to-date as of commit 86193f5
24
-
22
+ # https://github.com/apache/airflow/blob/dc271d0c604ca1836ee4f943726b2d436547700f /scripts/docker/entrypoint_prod.sh
23
+ # It was last synced from the upstream repo on 2025-06-01 and is up-to-date as of commit dc271d0c604ca1836ee4f943726b2d436547700f
24
+ # Changes we made are denoted with a comment "STACKABLE PATCH BEGIN" and # STACKABLE PATCH END
25
25
26
26
AIRFLOW_COMMAND=" ${1:- } "
27
27
@@ -34,9 +34,12 @@ set -euo pipefail
34
34
# The side effect of this is slightly (in the range of 100s of milliseconds) slower load for any
35
35
# binary started and a little memory used for Heap allocated by initialization of libstdc++
36
36
# This overhead is not happening for binaries that already link dynamically libstdc++
37
+
38
+ # STACKABLE PATCH BEGIN
39
+ # The path to this file is different on UBI
37
40
# LD_PRELOAD="/usr/lib/$(uname -m)-linux-gnu/libstdc++.so.6"
38
- # Stackable: The path to this file is different on UBI
39
41
LD_PRELOAD=/usr/lib64/libstdc++.so.6
42
+ # STACKABLE PATCH END
40
43
export LD_PRELOAD
41
44
42
45
function run_check_with_retries {
@@ -161,13 +164,17 @@ function create_www_user() {
161
164
exit 1
162
165
fi
163
166
164
- airflow users create \
165
- --username " ${_AIRFLOW_WWW_USER_USERNAME=" admin" } " \
166
- --firstname " ${_AIRFLOW_WWW_USER_FIRSTNAME=" Airflow" } " \
167
- --lastname " ${_AIRFLOW_WWW_USER_LASTNAME=" Admin" } " \
168
- --email " ${_AIRFLOW_WWW_USER_EMAIL=" airflowadmin@example.com" } " \
169
- --role " ${_AIRFLOW_WWW_USER_ROLE=" Admin" } " \
170
- --password " ${local_password} " || true
167
+ if airflow config get-value core auth_manager | grep -q " FabAuthManager" ; then
168
+ airflow users create \
169
+ --username " ${_AIRFLOW_WWW_USER_USERNAME=" admin" } " \
170
+ --firstname " ${_AIRFLOW_WWW_USER_FIRSTNAME=" Airflow" } " \
171
+ --lastname " ${_AIRFLOW_WWW_USER_LASTNAME=" Admin" } " \
172
+ --email " ${_AIRFLOW_WWW_USER_EMAIL=" airflowadmin@example.com" } " \
173
+ --role " ${_AIRFLOW_WWW_USER_ROLE=" Admin" } " \
174
+ --password " ${local_password} " || true
175
+ else
176
+ echo " Skipping user creation as auth manager different from Fab is used"
177
+ fi
171
178
}
172
179
173
180
function create_system_user_if_missing() {
@@ -193,7 +200,7 @@ function set_pythonpath_for_root_user() {
193
200
# Now also adds applications installed as local user "airflow".
194
201
if [[ $UID == " 0" ]]; then
195
202
local python_major_minor
196
- python_major_minor=" $( python --version | cut -d " " -f 2 | cut -d " . " -f 1-2 ) "
203
+ python_major_minor=$( python -c ' import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}") ' )
197
204
export PYTHONPATH=" ${AIRFLOW_USER_HOME_DIR} /.local/lib/python${python_major_minor} /site-packages:${PYTHONPATH:- } "
198
205
>&2 echo " The container is run as root user. For security, consider using a regular user account."
199
206
fi
@@ -204,9 +211,9 @@ function wait_for_airflow_db() {
204
211
run_check_with_retries " airflow db check"
205
212
}
206
213
207
- function upgrade_db () {
208
- # Runs airflow db upgrade
209
- airflow db upgrade || true
214
+ function migrate_db () {
215
+ # Runs airflow db migrate
216
+ airflow db migrate || true
210
217
}
211
218
212
219
function wait_for_celery_broker() {
@@ -272,7 +279,10 @@ function check_uid_gid() {
272
279
# not set when PIP is run by Airflow later on
273
280
unset PIP_USER
274
281
275
- check_uid_gid
282
+ # STACKABLE PATCH BEGIN
283
+ # Disable check for uid & gid (https://github.com/stackabletech/issues/issues/645)
284
+ # check_uid_gid
285
+ # STACKABLE PATCH END
276
286
277
287
# Set umask to 0002 to make all the directories created by the current user group-writeable
278
288
# This allows the same directories to be writeable for any arbitrary user the image will be
@@ -292,8 +302,12 @@ if [[ "${CONNECTION_CHECK_MAX_COUNT}" -gt "0" ]]; then
292
302
wait_for_airflow_db
293
303
fi
294
304
305
+ if [[ -n " ${_AIRFLOW_DB_UPGRADE=} " ]] || [[ -n " ${_AIRFLOW_DB_MIGRATE=} " ]] ; then
306
+ migrate_db
307
+ fi
308
+
295
309
if [[ -n " ${_AIRFLOW_DB_UPGRADE=} " ]] ; then
296
- upgrade_db
310
+ >&2 echo " WARNING: Environment variable '_AIRFLOW_DB_UPGRADE' is deprecated please use '_AIRFLOW_DB_MIGRATE' instead "
297
311
fi
298
312
299
313
if [[ -n " ${_AIRFLOW_WWW_USER_CREATE=} " ]] ; then
@@ -310,10 +324,13 @@ if [[ -n "${_PIP_ADDITIONAL_REQUIREMENTS=}" ]] ; then
310
324
>&2 echo " https://airflow.apache.org/docs/docker-stack/build.html"
311
325
>&2 echo
312
326
>&2 echo " Adding requirements at container startup is fragile and is done every time"
313
- >&2 echo " the container starts, so it is onlny useful for testing and trying out"
327
+ >&2 echo " the container starts, so it is only useful for testing and trying out"
314
328
>&2 echo " of adding dependencies."
315
329
>&2 echo
316
- pip install --root-user-action ignore --no-cache-dir " ${_PIP_ADDITIONAL_REQUIREMENTS} "
330
+ # STACKABLE PATCH BEGIN
331
+ # Add double quotes to silence Shellcheck warning SC2086
332
+ pip install --root-user-action ignore " ${_PIP_ADDITIONAL_REQUIREMENTS} "
333
+ # STACKABLE PATCH END
317
334
fi
318
335
319
336
0 commit comments