Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure via env vars, not sed #115

Merged
merged 2 commits into from
Dec 19, 2017
Merged

Conversation

ashb
Copy link
Contributor

@ashb ashb commented Sep 8, 2017

This PR changes the entrypoint.sh script so that it doesn't need to change airflow.cfg to customize the settings.

The main reason we want this is that we have a repo which is our AIRFLOW_HOME, it contains a dags/ folder, and custom plugins in plugins/, some library functions/python modules and an airflow.cfg.

Because we have more than just the dags folder in our repo I'd prefer to not have to manually volume mount each thing individually and would prefer to just docker run -v .:/usr/local/airflow. Which works, except that our config is no longer default so some of the sed commands fail, and others end up changing the file which is tracked in git. All just a bit messy.

So since Airflow has built in feature to read config settings from environment variables we can just export some vars. No sed needed, no changes I need to revert every time in git (and an added bonus no changing to the base docker image at run time)

@ashb
Copy link
Contributor Author

ashb commented Nov 28, 2017

@puckel Anything I can do to get this merged? (other than inventing a magic machine that gives everyone more time)

@puckel
Copy link
Owner

puckel commented Nov 29, 2017

Hi @ashb
Thanks for your PR, I've tested your changes. It would be great if you update the readme too according to your changes.
Thanks

If any of these had spaces in them they could have caused interesting
behaviour. As a safety measure lets just quote them.
Airfow will look at "AIRFLOW__${section}__${setting}" in preference to
anything in the config file, so using this we can 1) avoid having to run
sed, and 2) means we don't have to change the config file at run time
@ashb
Copy link
Contributor Author

ashb commented Dec 19, 2017

Hi @puckel I've finally gotten around to adding some docs to the readme about configuration via environment. Let me know if you'd like any more detail.

@puckel puckel merged commit f0e5b34 into puckel:master Dec 19, 2017
@ashb ashb deleted the env-vars-not-sed branch December 19, 2017 15:52
@puckel
Copy link
Owner

puckel commented Dec 19, 2017

Thanks @ashb I'll release it at the same time with 1.9.0

@ashb
Copy link
Contributor Author

ashb commented Dec 19, 2017

Great, 1.9.0 should be soon - RC8 has been accepted by the Airfow team so we're just waiting on Apache governance process now. (Not sure if you follow along on the mailing list or not.)

@puckel
Copy link
Owner

puckel commented Dec 19, 2017

I'm following the mailing-list too. I'll release as soon as possible when 1.9.0 is out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants