diff --git a/Cargo.lock b/Cargo.lock
index f89045bb6b..98d888cfbb 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4723,7 +4723,7 @@ dependencies = [
[[package]]
name = "greptime-proto"
version = "0.1.0"
-source = "git+https://github.com/GreptimeTeam/greptime-proto.git?rev=683e9d10ae7f3dfb8aaabd89082fc600c17e3795#683e9d10ae7f3dfb8aaabd89082fc600c17e3795"
+source = "git+https://github.com/GreptimeTeam/greptime-proto.git?rev=1915576b113a494f5352fd61f211d899b7f87aab#1915576b113a494f5352fd61f211d899b7f87aab"
dependencies = [
"prost 0.13.3",
"serde",
diff --git a/Cargo.toml b/Cargo.toml
index c094a2d651..ca58730599 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -127,7 +127,8 @@ etcd-client = "0.14"
fst = "0.4.7"
futures = "0.3"
futures-util = "0.3"
-greptime-proto = { git = "https://github.com/GreptimeTeam/greptime-proto.git", rev = "683e9d10ae7f3dfb8aaabd89082fc600c17e3795" }
+# branch: poc-write-path
+greptime-proto = { git = "https://github.com/GreptimeTeam/greptime-proto.git", rev = "1915576b113a494f5352fd61f211d899b7f87aab" }
hex = "0.4"
http = "1"
humantime = "2.1"
diff --git a/README.md b/README.md
index ba94fdbbb2..51434ff837 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@
GreptimeCloud |
User Guide |
API Docs |
- Roadmap 2024
+ Roadmap 2025
diff --git a/config/config.md b/config/config.md
index 0639e06a21..42cbe6c116 100644
--- a/config/config.md
+++ b/config/config.md
@@ -26,6 +26,8 @@
| `http.addr` | String | `127.0.0.1:4000` | The address to bind the HTTP server. |
| `http.timeout` | String | `30s` | HTTP request timeout. Set to 0 to disable timeout. |
| `http.body_limit` | String | `64MB` | HTTP request body limit.
The following units are supported: `B`, `KB`, `KiB`, `MB`, `MiB`, `GB`, `GiB`, `TB`, `TiB`, `PB`, `PiB`.
Set to 0 to disable limit. |
+| `http.enable_cors` | Bool | `true` | HTTP CORS support, it's turned on by default
This allows browser to access http APIs without CORS restrictions |
+| `http.cors_allowed_origins` | Array | Unset | Customize allowed origins for HTTP CORS. |
| `grpc` | -- | -- | The gRPC server options. |
| `grpc.addr` | String | `127.0.0.1:4001` | The address to bind the gRPC server. |
| `grpc.runtime_size` | Integer | `8` | The number of server worker threads. |
@@ -216,6 +218,8 @@
| `http.addr` | String | `127.0.0.1:4000` | The address to bind the HTTP server. |
| `http.timeout` | String | `30s` | HTTP request timeout. Set to 0 to disable timeout. |
| `http.body_limit` | String | `64MB` | HTTP request body limit.
The following units are supported: `B`, `KB`, `KiB`, `MB`, `MiB`, `GB`, `GiB`, `TB`, `TiB`, `PB`, `PiB`.
Set to 0 to disable limit. |
+| `http.enable_cors` | Bool | `true` | HTTP CORS support, it's turned on by default
This allows browser to access http APIs without CORS restrictions |
+| `http.cors_allowed_origins` | Array | Unset | Customize allowed origins for HTTP CORS. |
| `grpc` | -- | -- | The gRPC server options. |
| `grpc.addr` | String | `127.0.0.1:4001` | The address to bind the gRPC server. |
| `grpc.hostname` | String | `127.0.0.1:4001` | The hostname advertised to the metasrv,
and used for connections from outside the host |
diff --git a/config/frontend.example.toml b/config/frontend.example.toml
index ade1b9169a..2ecd7a19e8 100644
--- a/config/frontend.example.toml
+++ b/config/frontend.example.toml
@@ -31,6 +31,12 @@ timeout = "30s"
## The following units are supported: `B`, `KB`, `KiB`, `MB`, `MiB`, `GB`, `GiB`, `TB`, `TiB`, `PB`, `PiB`.
## Set to 0 to disable limit.
body_limit = "64MB"
+## HTTP CORS support, it's turned on by default
+## This allows browser to access http APIs without CORS restrictions
+enable_cors = true
+## Customize allowed origins for HTTP CORS.
+## @toml2docs:none-default
+cors_allowed_origins = ["https://example.com"]
## The gRPC server options.
[grpc]
diff --git a/config/standalone.example.toml b/config/standalone.example.toml
index c86e48ae51..da1afc29fc 100644
--- a/config/standalone.example.toml
+++ b/config/standalone.example.toml
@@ -39,6 +39,12 @@ timeout = "30s"
## The following units are supported: `B`, `KB`, `KiB`, `MB`, `MiB`, `GB`, `GiB`, `TB`, `TiB`, `PB`, `PiB`.
## Set to 0 to disable limit.
body_limit = "64MB"
+## HTTP CORS support, it's turned on by default
+## This allows browser to access http APIs without CORS restrictions
+enable_cors = true
+## Customize allowed origins for HTTP CORS.
+## @toml2docs:none-default
+cors_allowed_origins = ["https://example.com"]
## The gRPC server options.
[grpc]
diff --git a/docker/docker-compose/cluster-with-etcd.yaml b/docker/docker-compose/cluster-with-etcd.yaml
index e7794662a8..8e1773c7d7 100644
--- a/docker/docker-compose/cluster-with-etcd.yaml
+++ b/docker/docker-compose/cluster-with-etcd.yaml
@@ -39,14 +39,16 @@ services:
container_name: metasrv
ports:
- 3002:3002
+ - 3000:3000
command:
- metasrv
- start
- --bind-addr=0.0.0.0:3002
- --server-addr=metasrv:3002
- --store-addrs=etcd0:2379
+ - --http-addr=0.0.0.0:3000
healthcheck:
- test: [ "CMD", "curl", "-f", "http://metasrv:3002/health" ]
+ test: [ "CMD", "curl", "-f", "http://metasrv:3000/health" ]
interval: 5s
timeout: 3s
retries: 5
@@ -73,10 +75,10 @@ services:
volumes:
- /tmp/greptimedb-cluster-docker-compose/datanode0:/tmp/greptimedb
healthcheck:
- test: [ "CMD", "curl", "-f", "http://datanode0:5000/health" ]
+ test: [ "CMD", "curl", "-fv", "http://datanode0:5000/health" ]
interval: 5s
timeout: 3s
- retries: 5
+ retries: 10
depends_on:
metasrv:
condition: service_healthy
@@ -115,6 +117,7 @@ services:
container_name: flownode0
ports:
- 4004:4004
+ - 4005:4005
command:
- flownode
- start
@@ -122,9 +125,15 @@ services:
- --metasrv-addrs=metasrv:3002
- --rpc-addr=0.0.0.0:4004
- --rpc-hostname=flownode0:4004
+ - --http-addr=0.0.0.0:4005
depends_on:
frontend0:
condition: service_healthy
+ healthcheck:
+ test: [ "CMD", "curl", "-f", "http://flownode0:4005/health" ]
+ interval: 5s
+ timeout: 3s
+ retries: 5
networks:
- greptimedb
diff --git a/flake.nix b/flake.nix
index 4daa373959..a6d9fbc0df 100644
--- a/flake.nix
+++ b/flake.nix
@@ -18,7 +18,11 @@
libgit2
libz
];
-
+ lib = nixpkgs.lib;
+ rustToolchain = fenix.packages.${system}.fromToolchainName {
+ name = (lib.importTOML ./rust-toolchain.toml).toolchain.channel;
+ sha256 = "sha256-f/CVA1EC61EWbh0SjaRNhLL0Ypx2ObupbzigZp8NmL4=";
+ };
in
{
devShells.default = pkgs.mkShell {
@@ -30,14 +34,20 @@
protobuf
gnumake
mold
- (fenix.packages.${system}.fromToolchainFile {
- dir = ./.;
- sha256 = "sha256-f/CVA1EC61EWbh0SjaRNhLL0Ypx2ObupbzigZp8NmL4=";
- })
+ (rustToolchain.withComponents [
+ "cargo"
+ "clippy"
+ "rust-src"
+ "rustc"
+ "rustfmt"
+ "rust-analyzer"
+ "llvm-tools"
+ ])
cargo-nextest
cargo-llvm-cov
taplo
curl
+ gnuplot ## for cargo bench
];
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
diff --git a/rust-toolchain.toml b/rust-toolchain.toml
index 388d16249a..eb2546003b 100644
--- a/rust-toolchain.toml
+++ b/rust-toolchain.toml
@@ -1,3 +1,2 @@
[toolchain]
channel = "nightly-2024-12-25"
-components = ["rust-analyzer", "llvm-tools"]
diff --git a/src/cli/src/database.rs b/src/cli/src/database.rs
index 7152aac592..24c4514fbc 100644
--- a/src/cli/src/database.rs
+++ b/src/cli/src/database.rs
@@ -17,6 +17,7 @@ use std::time::Duration;
use base64::engine::general_purpose;
use base64::Engine;
use common_catalog::consts::{DEFAULT_CATALOG_NAME, DEFAULT_SCHEMA_NAME};
+use common_error::ext::BoxedError;
use humantime::format_duration;
use serde_json::Value;
use servers::http::header::constants::GREPTIME_DB_HEADER_TIMEOUT;
@@ -24,7 +25,9 @@ use servers::http::result::greptime_result_v1::GreptimedbV1Response;
use servers::http::GreptimeQueryOutput;
use snafu::ResultExt;
-use crate::error::{HttpQuerySqlSnafu, Result, SerdeJsonSnafu};
+use crate::error::{
+ BuildClientSnafu, HttpQuerySqlSnafu, ParseProxyOptsSnafu, Result, SerdeJsonSnafu,
+};
#[derive(Debug, Clone)]
pub struct DatabaseClient {
@@ -32,6 +35,23 @@ pub struct DatabaseClient {
catalog: String,
auth_header: Option,
timeout: Duration,
+ proxy: Option,
+}
+
+pub fn parse_proxy_opts(
+ proxy: Option,
+ no_proxy: bool,
+) -> std::result::Result