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

Nats: db proposal #42

Merged
merged 38 commits into from
Jan 17, 2025
Merged

Nats: db proposal #42

merged 38 commits into from
Jan 17, 2025

Conversation

JettTech
Copy link
Contributor

@JettTech JettTech commented Dec 18, 2024

Nats PR#2

Updates:

  • adds the following nats util-libs:
    • adds mongodb schema (and indexing setup)
    • adds mongodb interface
  • cleans up baseline
    • removes endpoint files and extracts common call sig into the service call method
    • updates the js service endpoint handler to take a generic type
    • standardizes input and output for workload service

@steveej steveej force-pushed the nats-baseline branch 3 times, most recently from 382ddd1 to 78492d1 Compare December 20, 2024 13:00
Base automatically changed from nats-baseline to main December 20, 2024 15:44
@JettTech JettTech requested a review from zeeshan595 January 16, 2025 17:45
@JettTech JettTech requested review from zeeshan595 and a team and removed request for zeeshan595 January 16, 2025 21:00
@JettTech JettTech merged commit 0d15426 into main Jan 17, 2025
2 checks passed
@JettTech JettTech deleted the nats-crates branch January 17, 2025 17:39
Copy link
Contributor

@mattgeddes mattgeddes left a 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();
Copy link
Contributor

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.

Copy link
Contributor Author

@JettTech JettTech Jan 20, 2025

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())
Copy link
Contributor

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.

Copy link
Contributor Author

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 {
Copy link
Contributor

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.

Copy link
Contributor Author

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. 👍

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.

3 participants