-
Notifications
You must be signed in to change notification settings - Fork 2
eli-599/local-stack-replacement #582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
31e45a5
localstack
Karthikeyannhs ac10a45
localstack
Karthikeyannhs c9776f3
localstack
Karthikeyannhs 9afef83
ELI-662: working sam
Karthikeyannhs 4f66423
ELI-662: working sam
Karthikeyannhs 97697bd
AWS RIE for lambda and moto for other services, Cloud watch cannot be…
Karthikeyannhs 6018f09
moved lambda client to lambda conftest
Karthikeyannhs 1f94c19
use docker compose profiling
Karthikeyannhs e7a15c5
lint fixes
Karthikeyannhs af8055c
docker clean up
Karthikeyannhs 354cd5b
docker clean up
Karthikeyannhs bff73df
test - commit
Karthikeyannhs c09c2df
test - commit
Karthikeyannhs a9850a2
reduced subprocess usage
Karthikeyannhs d348500
lint fix
Karthikeyannhs 96de453
fix services trigger
Karthikeyannhs 0720349
Merge branch 'main' into eli-599/local-stack-replacement
Karthikeyannhs e70602b
simulate API Gateway requests in python
Karthikeyannhs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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,52 @@ | ||
| include: | ||
| - docker-compose.moto.yml | ||
|
|
||
| services: | ||
| lambda-api: | ||
| image: public.ecr.aws/lambda/python:3.13 | ||
| container_name: lambda-api | ||
| ports: | ||
| - "4567:8080" | ||
| platform: linux/amd64 | ||
| volumes: | ||
| - ../dist/lambda.zip:/tmp/lambda.zip:ro | ||
| environment: | ||
| - AWS_ACCESS_KEY_ID=dummy_key | ||
| - AWS_SECRET_ACCESS_KEY=dummy_secret | ||
| - AWS_DEFAULT_REGION=eu-west-1 | ||
| - PYTHONPATH=/var/task | ||
| - AWS_ENDPOINT_URL=http://moto-server:5000 | ||
| - DYNAMODB_ENDPOINT=http://moto-server:5000 | ||
| - S3_ENDPOINT=http://moto-server:5000 | ||
| - SECRET_MANAGER_ENDPOINT=http://moto-server:5000 | ||
| - FIREHOSE_ENDPOINT=http://moto-server:5000 | ||
| - LOG_LEVEL=INFO | ||
| entrypoint: /bin/sh | ||
| command: | ||
| - "-c" | ||
| - | | ||
| mkdir -p /var/task && | ||
| python3 -m zipfile -e /tmp/lambda.zip /var/task && | ||
| exec /usr/local/bin/aws-lambda-rie python3 -m awslambdaric eligibility_signposting_api.app.lambda_handler | ||
| networks: | ||
| - test-network | ||
| depends_on: | ||
| moto-server: | ||
| condition: service_healthy | ||
|
|
||
|
|
||
| api-gateway-mock: | ||
| #used for api gateway simulation | ||
| image: openresty/openresty:alpine | ||
| ports: | ||
| - "9123:9123" | ||
| volumes: | ||
| - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro | ||
| depends_on: | ||
| - lambda-api | ||
| networks: | ||
| - test-network | ||
|
|
||
| networks: | ||
| test-network: | ||
| driver: bridge | ||
This file contains hidden or 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 @@ | ||
| services: | ||
| moto-server: | ||
| #used for s3, dynamodb, kinesis, secret manager | ||
| # lambda cannot be used, because its 3.11 (older) | ||
| image: motoserver/moto:latest | ||
| container_name: moto-server | ||
| ports: | ||
| - "4566:5000" | ||
| networks: | ||
| - test-network | ||
| healthcheck: | ||
| test: ["CMD", "curl", "-f", "http://localhost:5000/"] | ||
| interval: 1s | ||
| timeout: 1s | ||
| retries: 30 | ||
|
|
||
| networks: | ||
| test-network: | ||
| driver: bridge |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,25 @@ | ||
| function unwrap(r) { | ||
| r.subrequest('/proxy' + r.uri, { method: r.method }, function(reply) { | ||
|
|
||
| if (reply.status !== 200) { | ||
| r.return(502, "Lambda Bridge Error: " + reply.status); | ||
| return; | ||
| } | ||
|
|
||
| // Check for empty/undefined body | ||
| if (!reply.responseBody) { | ||
| ngx.log(ngx.ERR, "CRITICAL: Lambda returned 200 but body is EMPTY/UNDEFINED"); | ||
| r.return(502, "Lambda returned empty response. Check Python logs for logic errors."); | ||
| return; | ||
| } | ||
|
|
||
| try { | ||
| var response = JSON.parse(reply.responseBody); | ||
| r.return(response.statusCode || 200, response.body || ""); | ||
| } catch (e) { | ||
| ngx.log(ngx.ERR, "JSON Parse Error: " + e.message + " | Body: " + reply.responseBody); | ||
| r.return(502, "Invalid JSON from Lambda"); | ||
| } | ||
| }); | ||
| } | ||
| export default { unwrap }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.