From c8c0e7ed4ebb9cca920b3661786724b81dac2756 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 | 22 ++-------------------- tests/compose.yaml | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 20 deletions(-) create mode 100644 tests/compose.yaml diff --git a/docs/development.rst b/docs/development.rst index d381a764..2e7b3097 100644 --- a/docs/development.rst +++ b/docs/development.rst @@ -41,29 +41,11 @@ 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' - -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 + cd tests && docker compose up -d And run tests: diff --git a/tests/compose.yaml b/tests/compose.yaml new file mode 100644 index 00000000..71fa9fd5 --- /dev/null +++ b/tests/compose.yaml @@ -0,0 +1,15 @@ +services: + clickhouse: + image: clickhouse/clickhouse-server:latest + container_name: ClickHouse + ports: + - "8123:8123" + - "9000:9000" + volumes: + - clickhouse-data:/var/lib/clickhouse + - clickhouse-logs:/var/log/clickhouse-server +volumes: + clickhouse-data: + driver: local + clickhouse-logs: + driver: local