Skip to content

Commit

Permalink
Merge pull request #43 from puckel/fernet-key-as-env
Browse files Browse the repository at this point in the history
Fix issue #39
  • Loading branch information
puckel committed Oct 17, 2016
2 parents 2ba7a95 + 5477ea7 commit 8f3189e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,13 @@ Go to Admin -> Connections and Edit "mysql_default" set this values (equivalent
- Login : airflow
- Password : airflow

For encrypted connection passwords (in Local or Celery Executor), you must have the same fernet_key. By default docker-airflow generates the fernet_key at startup, you have to set an environment variable in the docker-compose (ie: docker-compose-LocalExecutor.yml) file to set the same key accross containers. To generate a fernet_key :

python -c "from cryptography.fernet import Fernet; FERNET_KEY = Fernet.generate_key().decode(); print FERNET_KEY"

Check [Airflow Documentation](http://pythonhosted.org/airflow/)


## Install custom python package

- Create a file "requirements.txt" with the dedired python modules
Expand Down
2 changes: 2 additions & 0 deletions docker-compose-LocalExecutor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ services:
environment:
# - LOAD_EX=n
- EXECUTOR=Local
# - FERNET_KEY=9IoTgQ_EJ0hCsamBU3Mctc7F9OkODnndOKCwkwXCAA
# volumes:
# - /localpath/to/dags:/usr/local/airflow/dags
ports:
Expand All @@ -31,5 +32,6 @@ services:
# - /localpath/to/dags:/usr/local/airflow/dags
environment:
# - LOAD_EX=n
# - FERNET_KEY=9IoTgQ_EJ0hCsamBU3Mctc7F9OkODnndOKCwkwXCAA
- EXECUTOR=Local
command: scheduler -n 5
3 changes: 2 additions & 1 deletion script/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ POSTGRES_HOST="postgres"
POSTGRES_PORT="5432"
RABBITMQ_HOST="rabbitmq"
RABBITMQ_CREDS="airflow:airflow"
FERNET_KEY=$(python -c "from cryptography.fernet import Fernet; FERNET_KEY = Fernet.generate_key().decode(); print FERNET_KEY")
: ${FERNET_KEY:=$(python -c "from cryptography.fernet import Fernet; FERNET_KEY = Fernet.generate_key().decode(); print FERNET_KEY")}
# FERNET_KEY=$(python -c "from cryptography.fernet import Fernet; FERNET_KEY = Fernet.generate_key().decode(); print FERNET_KEY")

# Load DAGs exemples (default: Yes)
if [ "x$LOAD_EX" = "xn" ]; then
Expand Down

0 comments on commit 8f3189e

Please sign in to comment.