Skip to content

add service catalog cache loading from static var #12314

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 2 commits into from
Mar 5, 2025

Conversation

alexrashed
Copy link
Member

@alexrashed alexrashed commented Feb 27, 2025

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 the localstack 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

  • Moves get_service_catalog from the service_router to the spec module.
  • Introduces a new lookup directory (highest prio): The static libs directory (usually /usr/lib/localstack/).
  • Adds a new main to the spec which allows to easily generate a ServiceCatalog index cache file to the static libs dir.
  • Adds an invocation of this command to the Dockerfile

Testing

  • Update our downstream dependencies to also generate the service catalog as part of their Docker build process.

@alexrashed alexrashed added the semver: patch Non-breaking changes which can be included in patch releases label Feb 27, 2025
@alexrashed alexrashed added this to the 4.3 milestone Feb 27, 2025
@alexrashed alexrashed self-assigned this Feb 27, 2025
Copy link

github-actions bot commented Feb 27, 2025

S3 Image Test Results (AMD64 / ARM64)

  2 files    2 suites   9m 1s ⏱️
478 tests 426 ✅  52 💤 0 ❌
956 runs  852 ✅ 104 💤 0 ❌

Results for commit 2788a41.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Feb 27, 2025

LocalStack Community integration with Pro

    2 files  ±0      2 suites  ±0   1h 55m 34s ⏱️ + 4m 10s
4 109 tests ±0  3 776 ✅ ±0  333 💤 ±0  0 ❌ ±0 
4 111 runs  ±0  3 776 ✅ ±0  335 💤 ±0  0 ❌ ±0 

Results for commit 2788a41. ± Comparison against base commit f48e6bd.

♻️ This comment has been updated with latest results.

@alexrashed alexrashed force-pushed the build-time-service-catalog branch from fbcedbe to a17ca5e Compare February 28, 2025 07:51
pickle persists the module name when being dumped, which is main
in case of the execution as module. This is not an issue when using
dill, which is an install dependency already.
@alexrashed alexrashed force-pushed the build-time-service-catalog branch from a17ca5e to 2788a41 Compare March 4, 2025 15:42
@alexrashed alexrashed marked this pull request as ready for review March 4, 2025 16:02
@alexrashed alexrashed requested a review from silv-io March 5, 2025 08:54
Copy link
Member

@silv-io silv-io left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just a small question about cache validity

@alexrashed alexrashed merged commit 50ae8ec into master Mar 5, 2025
42 checks passed
@alexrashed alexrashed deleted the build-time-service-catalog branch March 5, 2025 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants