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

can read config from cli / env / toml & docker for arm64 & support docker run --rm ceresdb --help #1015

Closed
wants to merge 3 commits into from

Conversation

xxaier
Copy link

@xxaier xxaier commented Jun 21, 2023

  1. docker for arm64
  2. support docker run --rm ceresdb --help
  3. can read config from cli / env / toml
image image

2. support docker run --rm ceresdb --help
3. can read config from cli / env / toml
@CLAassistant
Copy link

CLAassistant commented Jun 21, 2023

CLA assistant check
All committers have signed the CLA.

@@ -58,15 +58,33 @@ fn main() {
.takes_value(true)
.help("Set configuration file, eg: \"/path/server.toml\""),
)
.arg(
Copy link
Contributor

Choose a reason for hiding this comment

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

This method seems awkward for me, doesn't the original issue is to support env vars to set config?

Copy link
Author

@xxaier xxaier Jun 26, 2023

Choose a reason for hiding this comment

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

it support both env and cli
see the first image line2

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

这个环境变量的配置方式是参考 rust config库的配置方式 参见 https://blog.logrocket.com/configuration-management-in-rust-web-services/
image

比如 qdrant 就是用的这种配置方式,如下图
https://github.com/qdrant/qdrant
image

这个配置方式的优点是,不需要修改原来的代码且通用,不然每个地方都要加一个判断,很麻烦

Copy link
Contributor

@jiacai2050 jiacai2050 Jun 27, 2023

Choose a reason for hiding this comment

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

You use cli_env_toml to do the heavy task, and this is a very new crate, so I'm concern with its stability.

Also, although set config one by one may seems dumb at first, but it make code simple and easy to read, so I suggest you use original style to add env support.

I think following 4 envs are enough for your case.:

CERESDB_BIND_ADDR
CERESDB_HTTP_PORT
CERESDB_MYSQL_PORT
CERESDB_GRPC_PORT

with:
platforms: linux/amd64,linux/arm64
Copy link
Contributor

@jiacai2050 jiacai2050 Jun 26, 2023

Choose a reason for hiding this comment

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

Have you tried build on linux/arm64? We haven't fully tested on it, so I'm afraid something maybe wrong.

Copy link
Author

Choose a reason for hiding this comment

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

可以构建,但是没测试,我觉得可以先添加构建,再去全面测试下

Copy link
Contributor

Choose a reason for hiding this comment

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

How about apply it only in nightly image?

If everything goes fine for some period, we can apply it to production image.

@@ -58,15 +58,33 @@ fn main() {
.takes_value(true)
.help("Set configuration file, eg: \"/path/server.toml\""),
)
.arg(
Copy link
Contributor

Choose a reason for hiding this comment

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

src/bin/ceresdb-server.rs Outdated Show resolved Hide resolved
@jiacai2050
Copy link
Contributor

@xxaier Hi, do you have free time to push this PR forward?

If not, I can do some minor changes based on your branch, Thanks.

@ShiKaiWi
Copy link
Member

Inactive for too long. If any updates, feel free to reopen it.

@ShiKaiWi ShiKaiWi closed this Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants