Reputation: 1913
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 protected]
Upvotes: 3
Views: 13287
Reputation: 11284
I am on 2.7.x now and you can use command to create
airflow users create \
--username admin \
--firstname rubyxxx \
--lastname gzeg \
--role Admin \
--email [email protected]
UserWarning: Using the in-memory storage for tracking rate limits as no storage was explicitly specified. This is not recommended for production use. See: https://flask-limiter.readthedocs.io#configuring-a-storage-backend for documentation about configuring the storage backend.
[2023-09-21T21:25:30.320+1000] {manager.py:666} WARNING - No user yet created, use flask fab command to do it.
Password:
Repeat for confirmation:
[2023-09-21T21:25:40.042+1000] {manager.py:211} INFO - Added user %s
User "admin" created with role "Admin"
Upvotes: 1
Reputation: 906
(I'm on airflow 2.2.2)
Looks like they changed the admin creation command password from -p test
to -p $DEFAULT_PASSWORD
. I had to pass in this DEFAULT_PASSWORD
env var to the docker-compose environment for the admin user to be created. It also looks like they now suggest using the .env.localrunner
file for configuration.
Here is the commit where that change was made.
(I think you asked this question prior to that change being made, but maybe this will help someone in the future who had my same issue).
Upvotes: 0
Reputation: 3955
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
Upvotes: 4