related to: #1153
Background
The current LambdaPackage class has a fairly janky method of managing dependencies and creating deployment packages.
Proposal
- Add a setuptools
setup.pyto each streamalert/<function>/ directory (where <function> is a directory for any lambda function code)
- Note: this might require a change to the folder structure. Alternatively, we could create a
lambdas directory or something similar that just implements the handlers and imports code from other packages (?)
- Have the setup.py for each lambda function define the required libraries needed. We would also specify
data_files for setuptools to include config/etc. This all is currently done in a jank way here:
|
package_files = { |
|
'conf', |
|
'streamalert/__init__.py', |
|
'streamalert/classifier', |
|
'streamalert/shared', |
|
} |
|
package_name = 'classifier' |
|
package_libs = {'jmespath', 'jsonlines'} |
- Use
pip to install from each function's setup.py to target install to a directory.
- Remove the "zipping" logic we currently have for creating the archive in favor of using the
archive_file feature in Terraform.
Note
This would require(?) the use of vagrant for installing via pip. See #1153
related to: #1153
Background
The current LambdaPackage class has a fairly janky method of managing dependencies and creating deployment packages.
Proposal
setup.pyto eachstreamalert/<function>/directory (where<function>is a directory for any lambda function code)lambdasdirectory or something similar that just implements the handlers and imports code from other packages (?)data_filesfor setuptools to include config/etc. This all is currently done in a jank way here:streamalert/streamalert_cli/manage_lambda/package.py
Lines 191 to 198 in 9718c28
pipto install from each function's setup.py to target install to a directory.archive_filefeature in Terraform.Note
This would require(?) the use of vagrant for installing via pip. See #1153