diff --git a/CHANGELOG.md b/CHANGELOG.md index b4b77df..691b74f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,18 @@ # Changelog -## 0.2.2 +## 0.2.3 + +### New + +* Add Docker Compose example. [Ben Dalling] + +### Fix + +* Stop duplicated log messages. [Ben Dalling] + + +## 0.2.2 (2021-11-23) ### New diff --git a/docs/.doctrees/environment.pickle b/docs/.doctrees/environment.pickle index 83a0716..309f96d 100644 Binary files a/docs/.doctrees/environment.pickle and b/docs/.doctrees/environment.pickle differ diff --git a/docs/.doctrees/index.doctree b/docs/.doctrees/index.doctree index 90a0654..148c9aa 100644 Binary files a/docs/.doctrees/index.doctree and b/docs/.doctrees/index.doctree differ diff --git a/docs/docker-hub-README.md b/docs/docker-hub-README.md index 89c3ade..99a5acc 100644 --- a/docs/docker-hub-README.md +++ b/docs/docker-hub-README.md @@ -9,3 +9,49 @@ to the script. For full documentation, see the project home at https://github.com/locp/wait4localstack To raise issues please go to https://github.com/locp/wait4localstack/issues + +## Examples + +### Docker Compose + +Given a Docker Compose file like the following: + +```yaml +--- +version: "3" + +services: + localstack: + container_name: "${LOCALSTACK_DOCKER_NAME-localstack}" + image: localstack/localstack:0.13.1 + ports: + - "127.0.0.1:53:53" # only required for Pro + - "127.0.0.1:53:53/udp" # only required for Pro + - "127.0.0.1:443:443" # only required for Pro + - "127.0.0.1:4510-4530:4510-4530" # only required for Pro + - "127.0.0.1:4566:4566" + - "127.0.0.1:4571:4571" + environment: + - SERVICES=${SERVICES-iam} + - DEBUG=1 + - DATA_DIR=${DATA_DIR- } + - LAMBDA_EXECUTOR=docker-reuse + - HOST_TMP_FOLDER=${TMPDIR:-/tmp/} + - DOCKER_HOST=unix:///var/run/docker.sock + volumes: + - "${TMPDIR:-/tmp}/localstack:/tmp/localstack" + - "/var/run/docker.sock:/var/run/docker.sock" + + wait4localstack: + command: -de http://localstack:4566/health + container_name: wait4localstack + depends_on: + - localstack + image: "locp/wait4localstack:${DOCKER_IMAGE_TAG-latest}" +``` + +Run the following command to bring up Localstack and wait for it to be ready: + +```shell +docker-compose -f examples/docker-compose.yml run --rm wait4localstack +``` diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index e989234..c1902cc 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -4,7 +4,7 @@ version: "3" services: localstack: container_name: "${LOCALSTACK_DOCKER_NAME-localstack}" - image: localstack/localstack:0.13.0 + image: localstack/localstack:0.13.1 ports: - "127.0.0.1:53:53" # only required for Pro - "127.0.0.1:53:53/udp" # only required for Pro diff --git a/tests/features/wait4localstack.feature b/tests/features/wait4localstack.feature index 80af9be..dac38b7 100644 --- a/tests/features/wait4localstack.feature +++ b/tests/features/wait4localstack.feature @@ -26,7 +26,7 @@ Feature: Wait4Localstack Then expect package response to match Examples: | testinfra_package | resource_name | package_response | - | file.exists | /tmp/dist/wait4localstack-0.2.2.tar.gz | True | + | file.exists | /tmp/dist/wait4localstack-0.2.3.tar.gz | True | | file.exists | /usr/local/bin/entrypoint.sh | True | | file.exists | /usr/local/bin/wait4localstack | True | | host.run | /usr/local/bin/wait4localstack -h | 0 | diff --git a/wait4localstack/VERSION b/wait4localstack/VERSION index ee1372d..7179039 100644 --- a/wait4localstack/VERSION +++ b/wait4localstack/VERSION @@ -1 +1 @@ -0.2.2 +0.2.3 diff --git a/wait4localstack/__init__.py b/wait4localstack/__init__.py index 755131d..b875e09 100644 --- a/wait4localstack/__init__.py +++ b/wait4localstack/__init__.py @@ -55,10 +55,8 @@ def __init__(self, localstack_endpoint='http://localhost:4566/health', self._logger = None self._maximum_retries = None self._test_interval = None - logging.basicConfig() + logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') logger = logging.getLogger('wait4localstack') - handler = logging.StreamHandler() - logger.addHandler(handler) logger.setLevel(log_level) self.logger(logger) self.exponential_backoff(exponential_backoff) @@ -237,6 +235,8 @@ def wait_for_all_services(self): attempts += 1 time.sleep(sleep_time) + logger.info(f'The following service(s) are {status} {",".join(service_names)}.') + def command_line_interface(args): """