-
Notifications
You must be signed in to change notification settings - Fork 4
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
[rest] Adding SKEMA_GRAPH_DB_HOST and SKEMA_GRAPH_DB_PORT environment variables #650
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vincentraymond-ua , this is a great start, but we will also need to modify how the skema-rs
REST API receives this information:
skema/skema/skema-rs/skema/src/bin/skema_service.rs
Lines 19 to 21 in d193a52
/// Database host | |
#[arg(long, default_value_t = String::from("localhost"))] | |
db_host: String, |
It seems it uses as assumed port.
The information is passed as a command line argument on the docker side entrypoint for the RUST service. So this should still work for both services, since the environment variable is also set on the docker side. |
@Free-Quarks, can you explain what happens today if you're using something other than the default DB port (ex. a proxied request)? |
I agree it should be an environment variable and is a left over way of doing things before we dockerized everything |
If I'm reading the Rust code correctly (big if), if you include the port in your value for skema/skema/skema-rs/skema/src/database.rs Lines 89 to 94 in d193a52
Is that correct, @Free-Quarks ? |
Actually, I take that back. I think a port is assumed: https://docs.rs/rsmgclient/latest/rsmgclient/struct.ConnectParams.html Could we at least optionally specify the db port in the skema-rs runnable with the standard bolt-like default? |
let connect_params = ConnectParams {
host: Some(host.to_string()),
port: Some(port.to_int()),
..Default::default()
}; ... and: #[derive(Debug)]
pub struct Config {
pub db_host: String,
// FIXME: how to set a default (ex. 7687) here?
pub db_port: int
}
|
^ idk if my Rust is correct (probably not), but hopefully it at least conveys the idea. |
Yeah I think I get what you are saying. (looping in @adarshp to double check as he wrote the code) We have it setup to get the port from the command line argument, but when we hit Memgraph we don't specify it each time and assume it is static, but we could specify it in the way you are showing. I could add that to this PR. |
I see use of |
I will deal with it on the deployment side and drop pushing for a change for now... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noting that a DB port cannot currently be passed on the Rust side.
@vincentraymond-ua , do you these env variables need to be noted in our documentation, or is it sufficient to update the dockerVM repo? |
@myedibleenso - Thats a good question, it may be valuable to have these described in the documentation, perhaps in the dev environment page: https://ml4ai.github.io/skema/dev/env/ |
… variables (#650) ## Adding environmental variables Adds the `SKEMA_GRAPH_DB_HOST` and `SKEMA_GRAPH_DB_PORT` environmental variables to skema/rest. Updates the execution engine to use these values to connect to Memgraph. See the corresponding PR to set these values in the ASKEM-TA1-DockerVM repo: ml4ai/ASKEM-TA1-DockerVM#44 --------- Co-authored-by: Justin <[email protected]> Co-authored-by: Gus Hahn-Powell <[email protected]> d5aecfd
Adding environmental variables
Adds the
SKEMA_GRAPH_DB_HOST
andSKEMA_GRAPH_DB_PORT
environmental variables to skema/rest.Updates the execution engine to use these values to connect to Memgraph.
See the corresponding PR to set these values in the ASKEM-TA1-DockerVM repo:
ml4ai/ASKEM-TA1-DockerVM#44