Skip to content

Commit

Permalink
Add instructions for using Docker Compose
Browse files Browse the repository at this point in the history
  • Loading branch information
aronbierbaum committed Mar 22, 2024
1 parent ac9442a commit 5a71d3b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
23 changes: 4 additions & 19 deletions docs/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
10 changes: 7 additions & 3 deletions tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 5a71d3b

Please sign in to comment.