Skip to content
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

improve docker integration with localstack start command #8772

Merged
merged 2 commits into from Jul 31, 2023

Conversation

thrau
Copy link
Member

@thrau thrau commented Jul 30, 2023

Motivation

There were a few things that bothered me about the localstack start command:

  • No first-class flags for operations i need often (specifying the docker network, adding environment variables), I dislike using the DOCKER_FLAGS for common stuff
  • If the docker image is not there, localstack didn't really tell you, and would be pulled implicitly sometime during the startup procedure.
  • The "Localstack Runtime Log" ruler wasn't placed correctly

Changes

  • added a --network and -e flag to localstack start which are handed down to the docker run command. for that i needed to hand down the CLI parameters to the plumbing
  • added a check that creates the specified network if it doesn't exist yet
  • added an ensure_container_image method that checks whether the requested container image is there, and if not, pulls it explicitly (+status indicator)
  • added a console status indicator for while the localstack container is still starting up.

Startup without docker image

Here's what the startup looks like now

Peek.2023-07-30.20-43_edit.mp4

LocalStack Runtime Log Rule

Before/After (not quite the same startup procedure though, but note the rule is right before the

CLI-before
CLI-after

Network

A custom network is much easier now. localstack as network could be the default at some point? (cc @cabeaulac @simonrw).

python -m localstack.cli.main start --network localstack
docker run --rm -it --network=localstack curlimages/curl http://localstack_main:4566/_localstack/health
{"services": {"acm": "available", "apigateway": "available", "cloudformation": "available", "cloudwatch": "available", "config": "available", "dynamodb": "available", "dynamodbstreams": "available", "ec2": "available", "es": "available", "events": "available", "firehose": "available", "iam": "available", "kinesis": "available", "kms": "available", "lambda": "available", "logs": "available", "opensearch": "available", "redshift": "available", "resource-groups": "available", "resourcegroupstaggingapi": "available", "route53": "available", "route53resolver": "available", "s3": "available", "s3control": "available", "secretsmanager": "available", "ses": "available", "sns": "available", "sqs": "available", "ssm": "available", "stepfunctions": "available", "sts": "available", "support": "available", "swf": "available", "transcribe": "available", "sso-admin": "available"}, "version": "2.1.1.dev"}

TODO

@thrau thrau requested a review from alexrashed July 30, 2023 19:06
@thrau thrau added the semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases label Jul 30, 2023
@thrau thrau added this to the 2.3 milestone Jul 30, 2023
@github-actions
Copy link

github-actions bot commented Jul 30, 2023

LocalStack Community integration with Pro

       2 files         2 suites   1h 32m 5s ⏱️
2 278 tests 1 919 ✔️ 359 💤 0
2 279 runs  1 919 ✔️ 360 💤 0

Results for commit 7493e9d.

♻️ This comment has been updated with latest results.

Copy link
Member

@alexrashed alexrashed left a comment

Choose a reason for hiding this comment

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

Nice! These new features and small UX improvements are looking good!
For now, I just had some minor nitpicks. There are still some TODOs and FIXMEs in the code, but I guess some of them might stay there for the first iteration. 🚀

localstack/cli/localstack.py Outdated Show resolved Hide resolved
@thrau thrau marked this pull request as ready for review July 31, 2023 16:17
@thrau thrau merged commit 71cfcfe into master Jul 31, 2023
22 of 23 checks passed
@thrau thrau deleted the improve-start-cmd branch July 31, 2023 23:03
@simonrw simonrw mentioned this pull request Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants