diff --git a/.github/workflows/docker-build-image.yml b/.github/workflows/docker-build-image.yml index b949aefbdb..f8885a2ee1 100644 --- a/.github/workflows/docker-build-image.yml +++ b/.github/workflows/docker-build-image.yml @@ -1,6 +1,11 @@ name: Test Docker image build on: + pull_request: + paths: + - '.github/workflows/docker-build-image.yml' + - 'Dockerfile' + - 'docker/**' push: paths: - '.github/workflows/docker-build-image.yml' @@ -23,4 +28,11 @@ jobs: run: >- docker run -p ${CERESDB_ADDR}:${CERESDB_PORT}:${CERESDB_PORT} -d ceresdb-server && sleep 10 && - bash ./docker/basic.sh + bash ./docker/basic.sh && + docker rm -f ceresdb-server + - name: Test the Built Image With Config + run: >- + docker run -p ${CERESDB_ADDR}:${CERESDB_PORT}:${CERESDB_PORT} -v `pwd`/docs/minimal.toml:/etc/ceresdb/ceresdb.toml -d ceresdb-server && + sleep 10 && + bash ./docker/basic.sh && + docker rm -f ceresdb-server diff --git a/Dockerfile b/Dockerfile index 20efd6951f..920ef41b0d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,7 @@ COPY --from=build /ceresdb/target/release/ceresdb-server /usr/bin/ceresdb-server RUN chmod +x /usr/bin/ceresdb-server COPY ./docker/entrypoint.sh /entrypoint.sh -COPY ./configs/ceresdb.toml /etc/ceresdb/ceresdb.toml +COPY ./docs/minimal.toml /etc/ceresdb/ceresdb.toml COPY ./docker/tini /tini RUN chmod +x /tini diff --git a/configs/ceresdb.toml b/configs/ceresdb.toml deleted file mode 100644 index 7db4e70074..0000000000 --- a/configs/ceresdb.toml +++ /dev/null @@ -1,18 +0,0 @@ -bind_addr = "0.0.0.0" -http_port = ${HTTP_PORT} -grpc_port = ${GRPC_PORT} -log_level = "info" - -[analytic] -data_path = "${DATA_PATH}" - -[[meta_client.cluster_view.schema_shards]] -schema = 'public' -auto_create_tables = true - -[[meta_client.cluster_view.schema_shards.shard_views]] -shard_id = 0 - -[meta_client.cluster_view.schema_shards.shard_views.node] -addr = "${NODE_ADDR}" -port = ${GRPC_PORT} diff --git a/docs/example-cluster-0.toml b/docs/example-cluster-0.toml new file mode 100644 index 0000000000..f39c5f875f --- /dev/null +++ b/docs/example-cluster-0.toml @@ -0,0 +1,30 @@ +bind_addr = "0.0.0.0" +http_port = 5440 +grpc_port = 8831 +mysql_port = 3307 +log_level = "info" +deploy_mode = "Cluster" + +[analytic] +wal_path = "/tmp/ceresdb" +sst_data_cache_cap = 10000 +sst_meta_cache_cap = 10000 + +[analytic.storage] +type = "Local" +data_path = "/tmp/ceresdb" + +[cluster] +cmd_channel_buffer_size = 10 + +[cluster.node] +addr = "127.0.0.1" +port = 8831 + +[cluster.meta_client] +# Only support "defaultCluster" currently. +cluster_name = "defaultCluster" +meta_addr = "{meta_addr}:2379" +lease = "10s" +timeout = "5s" + diff --git a/docs/example-cluster-1.toml b/docs/example-cluster-1.toml new file mode 100644 index 0000000000..4921607b55 --- /dev/null +++ b/docs/example-cluster-1.toml @@ -0,0 +1,30 @@ +bind_addr = "0.0.0.0" +http_port = 5441 +grpc_port = 8832 +mysql_port = 13307 +log_level = "info" +deploy_mode = "Cluster" + +[analytic] +wal_path = "/tmp/ceresdb2" +sst_data_cache_cap = 10000 +sst_meta_cache_cap = 10000 + +[analytic.storage] +type = "Local" +data_path = "/tmp/ceresdb2" + +[cluster] +cmd_channel_buffer_size = 10 + +[cluster.node] +addr = "127.0.0.1" +port = 8832 + +[cluster.meta_client] +# Only support "defaultCluster" currently. +cluster_name = "defaultCluster" +meta_addr = "{meta_addr}:2379" +lease = "10s" +timeout = "5s" + diff --git a/docs/guides/src/deploy/dynamic_routing.md b/docs/guides/src/deploy/dynamic_routing.md new file mode 100644 index 0000000000..a21495ba91 --- /dev/null +++ b/docs/guides/src/deploy/dynamic_routing.md @@ -0,0 +1,99 @@ +# Dynamic Routing +This guide shows how to deploy a CeresDB cluster with CeresMeta. + +## Target +First, let's assume that our target is to deploy a cluster consisting of two CeresDB instances on the same machine. And a large cluster of more CeresDB instances can deploy according to the two-instances example. + +## Start CeresDBs +You can use the following command to create a CeresDB cluster with two instances. +1. Start CeresMeta first + Refer to [CeresMeta](https://github.com/CeresDB/ceresmeta) + +2. Prepare config of CeresDB +* Replace `{meta_addr}` with the actual address of CeresMeta in config file + +```toml +# {project_path}/docs/example-cluster-0.toml +bind_addr = "0.0.0.0" +http_port = 5440 +grpc_port = 8831 +mysql_port = 3307 +log_level = "info" +deploy_mode = "Cluster" + +[analytic] +wal_path = "/tmp/ceresdb" +sst_data_cache_cap = 10000 +sst_meta_cache_cap = 10000 + +[analytic.storage] +type = "Local" +data_path = "/tmp/ceresdb" + +[cluster] +cmd_channel_buffer_size = 10 + +[cluster.node] +addr = "127.0.0.1" +port = 8831 + +[cluster.meta_client] +# Only support "defaultCluster" currently. +cluster_name = "defaultCluster" +meta_addr = "{meta_addr}:2379" +lease = "10s" +timeout = "5s" +``` + +```toml +# {project_path}/docs/example-cluster-1.toml +bind_addr = "0.0.0.0" +http_port = 5441 +grpc_port = 8832 +mysql_port = 13307 +log_level = "info" +deploy_mode = "Cluster" + +[analytic] +wal_path = "/tmp/ceresdb2" +sst_data_cache_cap = 10000 +sst_meta_cache_cap = 10000 + +[analytic.storage] +type = "Local" +data_path = "/tmp/ceresdb2" + +[cluster] +cmd_channel_buffer_size = 10 + +[cluster.node] +addr = "127.0.0.1" +port = 8832 + +[cluster.meta_client] +# Only support "defaultCluster" currently. +cluster_name = "defaultCluster" +meta_addr = "{meta_addr}:2379" +lease = "10s" +timeout = "5s" +``` + +3. Start CeresDB instances +* You need to replace `{project_path}` with the actual project path + +```bash +# Update address of CeresMeta in CeresDB config. +docker run -d --name ceresdb-server \ + -p 8831:8831 \ + -p 3307:3307 \ + -p 5440:5440 \ + -v {project_path}/docs/example-cluster-0.toml:/etc/ceresdb/ceresdb.toml \ + ceresdb/ceresdb-server:v0.3.1 + +docker run -d --name ceresdb-server2 \ + -p 8832:8832 \ + -p 13307:13307 \ + -p 5441:5441 \ + -v {project_path}/docs/example-cluster-1.toml:/etc/ceresdb/ceresdb.toml \ + ceresdb/ceresdb-server:v0.3.1 +``` \ No newline at end of file diff --git a/docs/guides/src/deploy/static_routing.md b/docs/guides/src/deploy/static_routing.md index babf84de9f..4950961617 100644 --- a/docs/guides/src/deploy/static_routing.md +++ b/docs/guides/src/deploy/static_routing.md @@ -1,10 +1,10 @@ # Static Routing -This guide shows how to deloy a CeresDB cluster with static, rule-based routing. +This guide shows how to deploy a CeresDB cluster with static, rule-based routing. The crucial point here is that CeresDB server provides configurable routing function on table name so what we need is just a valid config containing routing rules which will be shipped to every CeresDB instance in the cluster. ## Target -First of all, let's assume that our target is to deploy a cluster consisting of two CeresDB instances on the same machine. And a large cluster of more CeresDB instances can deployed according to the two-instances example. +First, let's assume that our target is to deploy a cluster consisting of two CeresDB instances on the same machine. And a large cluster of more CeresDB instances can deploy according to the two-instances example. ## Prepare Config ### Basic diff --git a/docs/guides/src/quick_start.md b/docs/guides/src/quick_start.md index a04afdcede..65c5562a5e 100644 --- a/docs/guides/src/quick_start.md +++ b/docs/guides/src/quick_start.md @@ -4,7 +4,7 @@ This page shows you how to get started with CeresDB quickly. You'll start a stan ## Start server -[CeresDB docker image](https://hub.docker.com/r/ceresdb/ceresdb-server) is the easiest way to get started, if you haven't install Docker, go [there](https://www.docker.com/products/docker-desktop/) to install it first. +[CeresDB docker image](https://hub.docker.com/r/ceresdb/ceresdb-server) is the easiest way to get started, if you haven't installed Docker, go [there](https://www.docker.com/products/docker-desktop/) to install it first. You can use command below to start a standalone server ```bash @@ -12,7 +12,7 @@ docker run -d --name ceresdb-server \ -p 8831:8831 \ -p 3307:3307 \ -p 5440:5440 \ - ceresdb/ceresdb-server:v0.2.0 + ceresdb/ceresdb-server:v0.3.1 ``` CeresDB will listen three ports when start: diff --git a/configs/minimal.toml b/docs/minimal.toml similarity index 67% rename from configs/minimal.toml rename to docs/minimal.toml index 1b4e223990..5e4283392a 100644 --- a/configs/minimal.toml +++ b/docs/minimal.toml @@ -12,13 +12,13 @@ wal_path = "/tmp/ceresdb" sst_data_cache_cap = 10000 sst_meta_cache_cap = 10000 -[[meta_client.cluster_view.schema_shards]] +[[static_route.topology.schema_shards]] schema = 'public' auto_create_tables = true -[[meta_client.cluster_view.schema_shards.shard_views]] +[[static_route.topology.schema_shards.shard_views]] shard_id = 0 -[meta_client.cluster_view.schema_shards.shard_views.node] +[static_route.topology.schema_shards.shard_views.endpoint] addr = "127.0.0.1" port = 8831 \ No newline at end of file