docker-airflow icon indicating copy to clipboard operation
docker-airflow copied to clipboard

Add optional importing of Airflow variables in entrypoint.sh

Open bdvll opened this issue 5 years ago • 6 comments

Hello,

I stumbled across this repo recently and I want to thank you for setting it up. I need to import Airflow variables from my prod env. and I couldn't find a way to do this reading the docs or source code so i added it, its a small change but adds a lot of value for me (and hopefully others).

If there is a better way of doing this or you have any comments regarding my approach please share.

bdvll avatar Aug 07 '19 09:08 bdvll

Hi @bdvll We use a separate service in my docker-compose-*.yml. Which does exactly what you describe, without having to patch readme, and allowing multiple variable files ( ie parametrized by env).

A service name variables. Your mountpoint in the 'volumes' section

command: > 
wait-for-it.sh webserver:8080 -t 300 --
bash -c " airflow variables -i varfile.json"

We also do the same for user creation.

This allows us to not run this at every startup for example.

enys avatar Aug 07 '19 09:08 enys

Hi @enys

Thank you for taking the time to explain how you do it. If this is the consensus on how variable import should be done, I'm fine with that, even though I suggest adding an example to the docs would not hurt.

bdvll avatar Aug 07 '19 10:08 bdvll

No idea if this is the consensus however. Completely agree on docs.

enys avatar Aug 07 '19 10:08 enys

command: > wait-for-it.sh webserver:8080 -t 300 -- bash -c " airflow variables -i varfile.json"

@enys Could you give a little more detail on that, and post an example?

hughgrigg avatar Oct 22 '19 09:10 hughgrigg

Is this available in puckel::master ? @bdvll

renjithpaul27 avatar Jun 19 '20 09:06 renjithpaul27

Hi @bdvll We use a separate service in my docker-compose-*.yml. Which does exactly what you describe, without having to patch readme, and allowing multiple variable files ( ie parametrized by env).

A service name variables. Your mountpoint in the 'volumes' section

command: > 
wait-for-it.sh webserver:8080 -t 300 --
bash -c " airflow variables -i varfile.json"

We also do the same for user creation.

This allows us to not run this at every startup for example.

Could you provide a detailed example with docker compose file if possible?

renjithpaul27 avatar Jun 20 '20 11:06 renjithpaul27