-
Notifications
You must be signed in to change notification settings - Fork 0
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
Nats: db proposal #42
Conversation
382ddd1
to
78492d1
Compare
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.
A few questions/comments about the MongoDB stuff.
// let mongo_uri = get_mongodb_url(); | ||
// let client_options = ClientOptions::parse(mongo_uri).await?; | ||
// let client = MongoDBClient::with_options(client_options)?; | ||
let mongo_uri = get_mongodb_url(); |
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.
Should we really be calling into MongoDB from the host_agent code? The agent should communicate with the services running centrally, which in turn is the only touch point to the central MongoDB instance. All communication from the agent goes through the API, which is now using NATS as a transport and won't go direct to things like MongoDB.
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.
You're 100% correct. This was added here for the convenience of testing in the first iteration. The host agents will not have a mongodb instance in production. I actually already have a PR out that both adds the workload api for the orchestrator and separates out the api for the orchestrator and host such that only the orchestrator service api has access to mongodb.
@@ -139,6 +156,11 @@ where | |||
} | |||
} | |||
|
|||
// Helpers: | |||
pub fn get_mongodb_url() -> String { | |||
std::env::var("MONGO_URI").unwrap_or_else(|_| "mongodb://127.0.0.1:27017".to_string()) |
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.
This doesn't seem right either. We won't be running a MongoDB instance on the holoports and other workload hosts.
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.
Agreed. See above. :)
@@ -245,8 +267,18 @@ mod tests { | |||
|
|||
fn get_mock_host() -> schemas::Host { |
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.
Is this a placeholder for the inventory? We can probably replace it soon with a call to the hpos_hal::inventory module. The schema itself is still under some change, but that's OK.
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.
The Host
struct that this test is referencing is schema for the Host in mongodb. It is intended to store the relevant inventory data that the hal::inventory
module generates. I agree that we could start to align the two structs, even if the hal::inventory
is subject to change. I'll take a look into aligning those this week. 👍
Updates:
call
method