mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Clean stale code
This commit is contained in:
parent
61a0becae5
commit
4cc37ae9f3
@ -1,47 +0,0 @@
|
|||||||
# Since right now we can't set volumes to the docker during build, we split building container in stages:
|
|
||||||
# 1. build base container
|
|
||||||
# 2. run base conatiner with mounted volumes
|
|
||||||
# 3. commit container as image
|
|
||||||
# 4. build final container atop that image
|
|
||||||
# Middle steps are performed by the bash script.
|
|
||||||
|
|
||||||
FROM ubuntu:18.04 as clickhouse-server-base
|
|
||||||
ARG gosu_ver=1.14
|
|
||||||
|
|
||||||
VOLUME /packages/
|
|
||||||
|
|
||||||
# update to allow installing dependencies of clickhouse automatically
|
|
||||||
RUN apt update; \
|
|
||||||
DEBIAN_FRONTEND=noninteractive \
|
|
||||||
apt install -y locales;
|
|
||||||
|
|
||||||
ADD https://github.com/tianon/gosu/releases/download/${gosu_ver}/gosu-amd64 /bin/gosu
|
|
||||||
|
|
||||||
RUN locale-gen en_US.UTF-8
|
|
||||||
ENV LANG en_US.UTF-8
|
|
||||||
ENV LANGUAGE en_US:en
|
|
||||||
ENV LC_ALL en_US.UTF-8
|
|
||||||
|
|
||||||
# installing via apt to simulate real-world scenario, where user installs deb package and all it's dependecies automatically.
|
|
||||||
CMD DEBIAN_FRONTEND=noninteractive \
|
|
||||||
apt install -y \
|
|
||||||
/packages/clickhouse-common-static_*.deb \
|
|
||||||
/packages/clickhouse-server_*.deb ;
|
|
||||||
|
|
||||||
FROM clickhouse-server-base:postinstall as clickhouse-server
|
|
||||||
|
|
||||||
RUN mkdir /docker-entrypoint-initdb.d
|
|
||||||
|
|
||||||
COPY docker_related_config.xml /etc/clickhouse-server/config.d/
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
|
||||||
|
|
||||||
RUN chmod +x \
|
|
||||||
/entrypoint.sh \
|
|
||||||
/bin/gosu
|
|
||||||
|
|
||||||
EXPOSE 9000 8123 9009
|
|
||||||
VOLUME /var/lib/clickhouse
|
|
||||||
|
|
||||||
ENV CLICKHOUSE_CONFIG /etc/clickhouse-server/config.xml
|
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
|
@ -1,86 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e -x
|
|
||||||
|
|
||||||
# Not sure why shellcheck complains that rc is not assigned before it is referenced.
|
|
||||||
# shellcheck disable=SC2154
|
|
||||||
trap 'rc=$?; echo EXITED WITH: $rc; exit $rc' EXIT
|
|
||||||
|
|
||||||
# CLI option to prevent rebuilding images, just re-run tests with images leftover from previuos time
|
|
||||||
readonly NO_REBUILD_FLAG="--no-rebuild"
|
|
||||||
|
|
||||||
readonly CLICKHOUSE_DOCKER_DIR="$(realpath "${1}")"
|
|
||||||
readonly CLICKHOUSE_PACKAGES_ARG="${2}"
|
|
||||||
CLICKHOUSE_SERVER_IMAGE="${3}"
|
|
||||||
|
|
||||||
if [ "${CLICKHOUSE_PACKAGES_ARG}" != "${NO_REBUILD_FLAG}" ]; then
|
|
||||||
readonly CLICKHOUSE_PACKAGES_DIR="$(realpath "${2}")" # or --no-rebuild
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# In order to allow packages directory to be anywhere, and to reduce amount of context sent to the docker daemon,
|
|
||||||
# all images are built in multiple stages:
|
|
||||||
# 1. build base image, install dependencies
|
|
||||||
# 2. run image with volume mounted, install what needed from those volumes
|
|
||||||
# 3. tag container as image
|
|
||||||
# 4. [optional] build another image atop of tagged.
|
|
||||||
|
|
||||||
# TODO: optionally mount most recent clickhouse-test and queries directory from local machine
|
|
||||||
|
|
||||||
if [ "${CLICKHOUSE_PACKAGES_ARG}" != "${NO_REBUILD_FLAG}" ]; then
|
|
||||||
docker build --network=host \
|
|
||||||
-f "${CLICKHOUSE_DOCKER_DIR}/test/stateless/clickhouse-statelest-test-runner.Dockerfile" \
|
|
||||||
--target clickhouse-test-runner-base \
|
|
||||||
-t clickhouse-test-runner-base:preinstall \
|
|
||||||
"${CLICKHOUSE_DOCKER_DIR}/test/stateless"
|
|
||||||
|
|
||||||
docker rm -f clickhouse-test-runner-installing-packages || true
|
|
||||||
docker run --network=host \
|
|
||||||
-v "${CLICKHOUSE_PACKAGES_DIR}:/packages" \
|
|
||||||
--name clickhouse-test-runner-installing-packages \
|
|
||||||
clickhouse-test-runner-base:preinstall
|
|
||||||
docker commit clickhouse-test-runner-installing-packages clickhouse-statelest-test-runner:local
|
|
||||||
docker rm -f clickhouse-test-runner-installing-packages || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# # Create a bind-volume to the clickhouse-test script file
|
|
||||||
# docker volume create --driver local --opt type=none --opt device=/home/enmk/proj/ClickHouse_master/tests/clickhouse-test --opt o=bind clickhouse-test-script-volume
|
|
||||||
# docker volume create --driver local --opt type=none --opt device=/home/enmk/proj/ClickHouse_master/tests/queries --opt o=bind clickhouse-test-queries-dir-volume
|
|
||||||
|
|
||||||
# Build server image (optional) from local packages
|
|
||||||
if [ -z "${CLICKHOUSE_SERVER_IMAGE}" ]; then
|
|
||||||
CLICKHOUSE_SERVER_IMAGE="clickhouse/server:local"
|
|
||||||
|
|
||||||
if [ "${CLICKHOUSE_PACKAGES_ARG}" != "${NO_REBUILD_FLAG}" ]; then
|
|
||||||
docker build --network=host \
|
|
||||||
-f "${CLICKHOUSE_DOCKER_DIR}/server/local.Dockerfile" \
|
|
||||||
--target clickhouse-server-base \
|
|
||||||
-t clickhouse-server-base:preinstall \
|
|
||||||
"${CLICKHOUSE_DOCKER_DIR}/server"
|
|
||||||
|
|
||||||
docker rm -f clickhouse_server_base_installing_server || true
|
|
||||||
docker run --network=host -v "${CLICKHOUSE_PACKAGES_DIR}:/packages" \
|
|
||||||
--name clickhouse_server_base_installing_server \
|
|
||||||
clickhouse-server-base:preinstall
|
|
||||||
docker commit clickhouse_server_base_installing_server clickhouse-server-base:postinstall
|
|
||||||
|
|
||||||
docker build --network=host \
|
|
||||||
-f "${CLICKHOUSE_DOCKER_DIR}/server/local.Dockerfile" \
|
|
||||||
--target clickhouse-server \
|
|
||||||
-t "${CLICKHOUSE_SERVER_IMAGE}" \
|
|
||||||
"${CLICKHOUSE_DOCKER_DIR}/server"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
docker rm -f test-runner || true
|
|
||||||
docker-compose down
|
|
||||||
CLICKHOUSE_SERVER_IMAGE="${CLICKHOUSE_SERVER_IMAGE}" \
|
|
||||||
docker-compose -f "${CLICKHOUSE_DOCKER_DIR}/test/test_runner_docker_compose.yaml" \
|
|
||||||
create \
|
|
||||||
--build --force-recreate
|
|
||||||
|
|
||||||
CLICKHOUSE_SERVER_IMAGE="${CLICKHOUSE_SERVER_IMAGE}" \
|
|
||||||
docker-compose -f "${CLICKHOUSE_DOCKER_DIR}/test/test_runner_docker_compose.yaml" \
|
|
||||||
run \
|
|
||||||
--name test-runner \
|
|
||||||
test-runner
|
|
@ -1,34 +0,0 @@
|
|||||||
version: "2"
|
|
||||||
|
|
||||||
services:
|
|
||||||
clickhouse-server:
|
|
||||||
image: ${CLICKHOUSE_SERVER_IMAGE}
|
|
||||||
expose:
|
|
||||||
- "8123" # HTTP
|
|
||||||
- "9000" # TCP
|
|
||||||
- "9009" # HTTP-interserver
|
|
||||||
restart: "no"
|
|
||||||
|
|
||||||
test-runner:
|
|
||||||
image: clickhouse-statelest-test-runner:local
|
|
||||||
|
|
||||||
restart: "no"
|
|
||||||
depends_on:
|
|
||||||
- clickhouse-server
|
|
||||||
environment:
|
|
||||||
# these are used by clickhouse-test to point clickhouse-client to the right server
|
|
||||||
- CLICKHOUSE_HOST=clickhouse-server
|
|
||||||
- CLICKHOUSE_PORT=9009
|
|
||||||
- CLICKHOUSE_TEST_HOST_EXPOSED_PORT=51234
|
|
||||||
expose:
|
|
||||||
# port for any test to serve data to clickhouse-server on rare occasion (like URL-engine tables in 00646),
|
|
||||||
# should match value of CLICKHOUSE_TEST_HOST_EXPOSED_PORT above
|
|
||||||
- "51234"
|
|
||||||
|
|
||||||
# NOTE: Dev-mode: mount newest versions of the queries and clickhouse-test script into container.
|
|
||||||
# volumes:
|
|
||||||
# - /home/enmk/proj/ClickHouse_master/tests/queries:/usr/share/clickhouse-test/queries:ro
|
|
||||||
# - /home/enmk/proj/ClickHouse_master/tests/clickhouse-test:/usr/bin/clickhouse-test:ro
|
|
||||||
|
|
||||||
# String-form instead of list-form to allow multiple arguments in "${CLICKHOUSE_TEST_ARGS}"
|
|
||||||
entrypoint: "clickhouse-test ${CLICKHOUSE_TEST_ARGS}"
|
|
Loading…
Reference in New Issue
Block a user