File tree Expand file tree Collapse file tree 3 files changed +42
-8
lines changed
dev-corner/how-to-test-locally Expand file tree Collapse file tree 3 files changed +42
-8
lines changed Original file line number Diff line number Diff line change 5
5
* .egg
6
6
* .db
7
7
* .pid
8
+ * .zip
8
9
.coverage *
9
10
.DS_Store
10
11
.idea
Original file line number Diff line number Diff line change @@ -36,6 +36,19 @@ isort: ## Run isort in the project on the host
36
36
mypy : # # Run mypy in the project on the host
37
37
tests/scripts/${SCRIPTS_BASE_DIR} mypy.sh
38
38
39
+ package : # # Package lambda by installing python dependencies matching x86_64
40
+ mkdir deps && \
41
+ pip install --target=./deps --platform manylinux2014_x86_64 --implementation cp --python-version 3.12 --only-binary= :all: --upgrade -r requirements.txt && \
42
+ cd ./deps && \
43
+ zip -r ../local_esf.zip . && \
44
+ cd .. && \
45
+ zip -r local_esf.zip main_aws.py handlers share storage shippers && \
46
+ rm -r ./deps
47
+
48
+ clean : # # cleanup any leftover resources
49
+ rm -f -r ./deps
50
+ rm -f local_esf.zip
51
+
39
52
docker-test : # # Run all tests on docker
40
53
docker-test : SCRIPTS_BASE_DIR=docker/
41
54
docker-test : test
Original file line number Diff line number Diff line change 1
- This is just an example of how to build and run ESF locally.
1
+ This document contains details about how to build ESF Lambda locally.
2
+ Once built, the Lambda can be deployed to validate functionality.
2
3
3
- ## Requirements
4
+ ## Building lambda
5
+
6
+ To build the Lambda, you may use one of the options below,
7
+
8
+ ### Using Makefile
9
+
10
+ To build,
11
+
12
+ ``` shell
13
+ make package
14
+ ```
15
+
16
+ This will generate a Lambda zip named ` local_esf.zip ` .
17
+
18
+ To clean up any leftover resources,
19
+
20
+ ``` shell
21
+ make clean
22
+ ```
23
+
24
+ ### Using Task file
25
+
26
+ #### Requirements
4
27
5
28
- [ Terraform] ( https://www.terraform.io/ )
6
29
- (Optional) [ Taskfile] ( https://taskfile.dev/installation/ )
7
30
8
31
9
- ## Steps
32
+ #### Building
10
33
11
34
** Important note** : ESF dependencies have been tested on architecture ` x86_64 ` . Make sure to use it as well.
12
35
13
- ### Step 1: Build your dependencies zip file
14
-
15
36
You can build your own, or you can choose to run:
16
37
``` bash
17
38
task
@@ -24,13 +45,12 @@ You can update the task variables in the `.env` file:
24
45
- The name of the zip file, ` FILENAME ` .
25
46
26
47
27
- ### Step 2: Run ESF terraform
48
+ ## Deploying Lambda
28
49
29
- Use the code in [ ESF terraform repository] ( https://github.com/elastic/terraform-elastic-esf ) .
50
+ Once Lambda zip is ready, you should use the code in [ ESF terraform repository] ( https://github.com/elastic/terraform-elastic-esf ) .
30
51
31
52
> ** NOTE** : ESF lambda function is using architecture ` x86_64 ` .
32
53
33
-
34
54
Place your ` local_esf.zip ` (or ` <FILENAME> ` if you changed the value) in the same directory as ESF terraform.
35
55
36
56
Go to ` esf.tf ` file and edit:
You can’t perform that action at this time.
0 commit comments