add service catalog cache loading from static var #12314
Merged
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.
Motivation
With the release of LocalStack 4.1.0, we had issues with the smoke tests of the binary build of our CLI.
It turned out that the initial loading of the service catalog took more than 2 seconds (which is the default connection timeout of
localstack wait
). localstack/localstack-cli#33 introduced a workaround for this, by triggering the service catalog cache creation with a call prior to thelocalstack wait
command.However, this issue has a user impact, as this cache will always be created when localstack is started with a new
botocore
version (even if the localstack volume dir is properly configured).In fact, this was already discussed with @thrau when he introduced the cache in the first place (#6672).
This PR solves this issue by generating the service catalog index cache at docker build time and stores it directly in the Docker image (~650kb uncompressed).
Changes
get_service_catalog
from theservice_router
to thespec
module./usr/lib/localstack/
).main
to the spec which allows to easily generate aServiceCatalog
index cache file to the static libs dir.Testing