airbnb / streamalert

StreamAlert is a serverless, realtime data analysis framework which empowers you to ingest, analyze, and alert on data from any environment, using datasources and alerting logic you define.
https://streamalert.io
Apache License 2.0
2.86k stars 332 forks source link

[apps] remove need for precompile package zips via usage of docker or vagrant #1153

Open ryandeivert opened 4 years ago

ryandeivert commented 4 years ago

Background

StreamAlert apps currently have some pre-packaged zips due to the need for natively compiled libraries in the lambda environment (shakes fist at cryptography lib). These are extracted as part of the lambda packaging process and injected into the other pip-installed OS independent libraries.

This is currently needed because we cannot guarantee that people are deploying from a Linux environment. For instance, if we did not have these packaged libs, and installed directly with pip, users on macOS would run into issues when their code runs in the AWS lambda environment.

The biggest problem with this is that it's very annoying to update dependencies when we need to, and requires some janky stuff. See the README.rst for apps.

Desired Change

Leverage the new vagrant stuff to build Lambda packages. We should also look at using Docker for this.

Notes

jack1902 commented 4 years ago

Another alternative is to consider using a docker container. This exact issue is one I've ran into when using an XML parsing library within a Serverless Framework Project using the Python Requirements plugin which allows you to "dockerize pip" during the packaging process.

Perhaps the user can have the option of using docker or vagrant? So when running the deploy command it would detect if the environment in use is vagrant, otherwise fall onto the python3.7 lambci container

The containers in question: https://hub.docker.com/r/lambci/lambda/