Add debugging setup & re-add release optimizations#12
Add debugging setup & re-add release optimizations#12dominikschubert merged 4 commits intolocalstackfrom
Conversation
joe4dev
left a comment
There was a problem hiding this comment.
I added ARM build support and basic instructions.
It Simplifies development a lot and optimizes the production build 👍
|
|
||
| - name: Build | ||
| env: | ||
| RELEASE_BUILD_LINKER_FLAGS: "-s -w" |
There was a problem hiding this comment.
nice to optimize the production version 👍
| LAMBDA_INIT_DELVE_PORT="${LAMBDA_INIT_DELVE_PORT:-40000}" | ||
|
|
||
| # Run init without delve debugger | ||
| #exec /var/rapid/init |
There was a problem hiding this comment.
I find it useful to have a non-debug entrypoint at hand.
We could even make this configurable through a custom environment variable in the future.
| ```bash | ||
| /dlv --listen=:"${LOCALSTACK_RIE_DEBUG_PORT}" --headless=true --api-version=2 --accept-multiclient exec /usr/local/bin/aws-lambda-rie "${RUNTIME_ENTRYPOINT}" | ||
| ``` No newline at end of file | ||
| ## Debugging with LocalStack |
| docker run --rm -v $$(pwd)/build-delve/:/app/ $(DOCKER_GOLANG_IMAGE) \ | ||
| bash -c "cd /app && export GOARCH=$(GOARCH) && ./build.sh" | ||
|
|
||
| clean clean-init: clean-rapid clean-delve |
There was a problem hiding this comment.
I added cleanup because unless we encode the architecture in the delve build, this is frequently required when switching architectures.
| # On ARM hosts, use: make ARCH=arm64 build-init | ||
| # Check host architecture: uname -m | ||
| # x86_64 or arm64 | ||
| ARCH ?= x86_64 |
|
Should we make the RIE log level configurable through LocalStack ( Going forward, we could then use info (or even warn) to reduce default log verbosity. |
|
@joe4dev Yeah that was the intention, but I didn't follow-up on that thought yet since I probably first want to rework the logging a bit in the init. For now it's probably best we just remove it from the config |
dfangl
left a comment
There was a problem hiding this comment.
LGTM! My only minor nit is the custom-tests folder, I find the naming confusing, as I do not get the connection between custom-tests and adding a debugger.
| build: | ||
| docker build -t rapid-debug . | ||
| # Golang EOL overview: https://endoflife.date/go | ||
| DOCKER_GOLANG_IMAGE ?= golang:1.18.2 |
There was a problem hiding this comment.
We might want to update this at least to 1.18.10, don't you think? We also might want to rebase localstack update localstack to upstream, as they have some dependency updates as well.
There was a problem hiding this comment.
let's do this separately though 😁
We'll iterate over a few init releases anyway in the coming days/weeks
Yeah that one existed for a while now (also with a quite unclear purpose so far), but we can rename this now 👍 |
You can now run:
which will build the necessary files under
debugging/init/var/rapid/for mounting into localstack when debugging.