Skip to content

Commit ff13ecf

Browse files
committed
Add instructions for using Docker Compose
1 parent 46482bf commit ff13ecf

2 files changed

Lines changed: 11 additions & 22 deletions

File tree

docs/development.rst

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,29 +41,14 @@ Create container desired version of ``clickhouse-server``:
4141
4242
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
4343
44-
Create container with the same version of ``clickhouse-client``:
44+
Or run the docker-compose defined in tests folder:
4545

4646
.. code-block:: bash
4747
48-
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'
48+
cd tests && docker compose up -d
4949
50-
Create ``clickhouse-client`` script on your host machine:
51-
52-
.. code-block:: bash
53-
54-
echo -e '#!/bin/bash\n\ndocker exec test-clickhouse-client clickhouse-client "$@"' | sudo tee /usr/local/bin/clickhouse-client > /dev/null
55-
sudo chmod +x /usr/local/bin/clickhouse-client
56-
57-
After it container ``test-clickhouse-client`` will communicate with
58-
``test-clickhouse-server`` transparently from host machine.
59-
60-
Set ``host=clickhouse-server`` in ``setup.cfg``.
61-
62-
Add entry in hosts file:
63-
64-
.. code-block:: bash
65-
66-
echo '127.0.0.1 clickhouse-server' | sudo tee -a /etc/hosts > /dev/null
50+
# Optionally test connecting to server.
51+
docker run -it --rm --network clickhouse-net clickhouse/clickhouse-client --host test-clickhouse-server
6752
6853
And run tests:
6954

tests/docker-compose.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ version: '3'
22

33
services:
44
clickhouse-server:
5-
image: "$ORG/clickhouse-server:$VERSION"
5+
image: "${ORG:-clickhouse}/clickhouse-server:${VERSION:-latest}"
66
container_name: test-clickhouse-server
77
ports:
8-
- "127.0.0.1:9000:9000"
9-
- "127.0.0.1:8123:8123"
8+
- "9000:9000"
9+
- "8123:8123"
10+
11+
networks:
12+
default:
13+
name: clickhouse-net

0 commit comments

Comments
 (0)