-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate, cache and pass valid fernet keys for local deployment (#196) (
#207) *Issue #, if available:* #196 *Description of changes:* - Modified run.sh to generate, cache and pass valid fernet key to the docker-compose file. - Added a script to be able to use pip install in run.sh to temporarily install dependencies needed before the bootstrap steps, like in this use-case. - Updated pip_install_check.py and run_all.py quality_check files' shebang for better portability. - Updated lint_bash check to exclude .venv's generated scripts. *Description of testing:* - Built and ran image locally with the run.sh script. - Used log statements to verify the fernet key was valid and being passed correctly. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. Co-authored-by: Kashyap Kannan <[email protected]>
- Loading branch information
1 parent
ecd0ff8
commit 9963b55
Showing
7 changed files
with
65 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
This Module generates Fernet keys, which are used by Airflow for connection encryption | ||
""" | ||
|
||
from cryptography.fernet import Fernet | ||
import json | ||
|
||
def generate_fernet_key(): | ||
""" | ||
Generate a Fernet key and return it as a JSON string. | ||
:returns A JSON string containing the generated Fernet key in the format {"FernetKey": "<key>"} | ||
""" | ||
key = Fernet.generate_key().decode() | ||
return json.dumps({"FernetKey": key}) | ||
|
||
if __name__ == "__main__": | ||
print(generate_fernet_key()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
# This script is specifically designed for temporarily installing packages needed ONLY before bootstrap steps. | ||
# It intentionally bypasses constraint checks, since it is intended that the packages will be used for setup/configuration | ||
# and then UNINSTALLED before the bootstrap steps, during local setup. | ||
# | ||
# NOTE: This script should NOT be used for installing production Airflow/MWAA dependencies. | ||
# For those, use 'safe-pip-install' which properly handles Airflow/MWAA constraints. | ||
|
||
pip3 install "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters