localstack / localstack Public
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
restructure localstack container bootstrapping and add CLI commands #4969
Merged
Conversation
This file contains 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
whummer
reviewed
Nov 20, 2021
tests/bootstrap/test_cli.py
Outdated
|
||
result = runner.invoke( | ||
cli, ["wait", "-t", "0.5"] | ||
) # on day this test will hopefully fail ;-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whummer
approved these changes
Nov 20, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds the following CLI commands and the necessary restructuring to make them possible:
localstack start --detached
: starts the localstack container in the backgroundlocalstack wait
blocks until localstack is running (the ready marker has been printed)localstack logs --follow
tails the log output of localstackThe most noteworthy changes and improvements:
start_infra_in_docker
routine, the terminal output no longer comes directly from thedocker run
command itself, but is forwarded to a logfile in the TMP folder that is then tailed using a new uiltity calledFileListener
(that is platform independent, but needs to be tested on Windows). that log is then printed to stdout asynchronously, while waiting on the docker run command to stop (via theServer
abstraction)start_infra_in_docker
that was building the command is now separated into a holder object (LocalstackContainer
) and a configuration routine (configure_container
)FORCE_NONINTERACTIVE
is not used anymore (there's no obvious reason to have an interactive tty docker session when only logs are printed to stdout)Some things that I hope will be useful in the future:
LocalstackContainerServer
, you can now treat localstack as you would anyServer
implementation. this can be used in tests to start up and tear down localstack without mucking about with low-level docker commands.LocalstackContainer
object can be passed to configuration hooks that modify the startup behavior, without being part of the actual startup routineThings that need improving:
LocalstackContainer
is sort of hacky--privileged
flag for the container startupVolumeMappings
and use that throughout theContainerClient
abstraction (some ideas in this gist: https://gist.github.com/thrau/b450e79c6a08d965ca2731b26065b67c)default_out_file
as a workaround, which is handed down asoutfile
parameter to the underlying subprocess to be able to capture the output of arun_container
executionThe text was updated successfully, but these errors were encountered: