From ff13ecf6671e701d0caf40ec56624fe274fb6180 Mon Sep 17 00:00:00 2001 From: Aron Bierbaum Date: Sat, 2 Mar 2024 10:56:34 -0600 Subject: [PATCH] Add instructions for using Docker Compose --- docs/development.rst | 23 ++++------------------- tests/docker-compose.yml | 10 +++++++--- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/docs/development.rst b/docs/development.rst index d381a764..33dbbd94 100644 --- a/docs/development.rst +++ b/docs/development.rst @@ -41,29 +41,14 @@ Create container desired version of ``clickhouse-server``: docker run --rm -p 127.0.0.1:9000:9000 -p 127.0.0.1:8123:8123 --name test-clickhouse-server clickhouse/clickhouse-server:$VERSION -Create container with the same version of ``clickhouse-client``: +Or run the docker-compose defined in tests folder: .. code-block:: bash - docker run --rm --entrypoint "/bin/sh" --name test-clickhouse-client --link test-clickhouse-server:clickhouse-server clickhouse/clickhouse-client:$VERSION -c 'while :; do sleep 1; done' + cd tests && docker compose up -d -Create ``clickhouse-client`` script on your host machine: - - .. code-block:: bash - - echo -e '#!/bin/bash\n\ndocker exec test-clickhouse-client clickhouse-client "$@"' | sudo tee /usr/local/bin/clickhouse-client > /dev/null - sudo chmod +x /usr/local/bin/clickhouse-client - -After it container ``test-clickhouse-client`` will communicate with -``test-clickhouse-server`` transparently from host machine. - -Set ``host=clickhouse-server`` in ``setup.cfg``. - -Add entry in hosts file: - - .. code-block:: bash - - echo '127.0.0.1 clickhouse-server' | sudo tee -a /etc/hosts > /dev/null + # Optionally test connecting to server. + docker run -it --rm --network clickhouse-net clickhouse/clickhouse-client --host test-clickhouse-server And run tests: diff --git a/tests/docker-compose.yml b/tests/docker-compose.yml index 8d29960e..fe5937fe 100644 --- a/tests/docker-compose.yml +++ b/tests/docker-compose.yml @@ -2,8 +2,12 @@ version: '3' services: clickhouse-server: - image: "$ORG/clickhouse-server:$VERSION" + image: "${ORG:-clickhouse}/clickhouse-server:${VERSION:-latest}" container_name: test-clickhouse-server ports: - - "127.0.0.1:9000:9000" - - "127.0.0.1:8123:8123" + - "9000:9000" + - "8123:8123" + +networks: + default: + name: clickhouse-net