Airflow 2.0.2 - No user yet created

Viewed 7091

we're moving from airflow 1.x to 2.0.2, and I'm noticing the below error in my terminal after i run docker-compose run --rm webserver initdb:

{{manager.py:727}} WARNING - No user yet created, use flask fab command to do it.

but in my entrypoint.sh I have the below to create users:

echo "Creating airflow user: ${AIRFLOW_CREATE_USER_USER_NAME}..."
su -c "airflow users create -r ${AIRFLOW_CREATE_USER_ROLE} -u ${AIRFLOW_CREATE_USER_USER_NAME} -e ${AIRFLOW_CREATE_USER_USER_NAME}@vice.com \
    -p ${AIRFLOW_CREATE_USER_PASSWORD} -f ${AIRFLOW_CREATE_USER_FIRST_NAME} -l \
    ${AIRFLOW_CREATE_USER_LAST_NAME}" airflow
echo "Created airflow user: ${AIRFLOW_CREATE_USER_USER_NAME} done!"
;;

Because of this error whenever I try to run airflow locally I still have to run the below to create a user manually every time I start up airflow:

docker-compose run --rm webserver bash
airflow users create \
          --username name \
          --firstname fname \
          --lastname lname \
          --password pw \
          --role Admin \
          --email email@email.com
1 Answers

Looking at the airflow docker entrypoint script entrypoint_prod.sh file, looks like airflow will create the an admin for you when the container on boots.

By default the admin user is 'admin' without password.

If you want something diferent, set this variables: _AIRFLOW_WWW_USER_PASSWORD and _AIRFLOW_WWW_USER_USERNAME

Related