Skip to content
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

Docker compose #295

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section was dedicated for running tests on machine without clickhouse-client installed.

is it still possible to run tests on such 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