-
Notifications
You must be signed in to change notification settings - Fork 19
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
Serve UI in trustify #176
Serve UI in trustify #176
Conversation
I love the idea but I suspect we can find a way so you can keep UI in your own repo. I'll ponder a bit. |
I think it's great to see that this is within reach! I really love that. When it comes to having the code in the same repository, then the only thing that was bothering me in the past was the fact that there had been numerous warnings spamming the CI logs. So making a change on the backend side brought up a lot of unrelated warnings from the UI side. If that's solved (and stays solved in general) then I think it would be good to have both parts in the same repository. But that is just me. I understand people having a different preference. |
So, you know I'm a monorepo kinda guy. @carlosthe19916 -- what's your view on where it should live? Do you have a strong opinion? If merged back in, can we ensure that CI logs are quite clean? |
|
I think that points a big flaw. I am ok with just pushing to main or even force pushing every now and then. However, that shouldn't be the norm. We are actually required to have a review process in place by our internal policies. And for good reason! If we do not have enough team members to do even a basic review, then I think we have a problem. Just ignoring that problem by not doing reviews feels completely wrong. |
Would @gildub be a suitable reviewer? He has some react experience yeah? |
Anyone can be a reviewer, the only requirement is the wiliness to do it. What do you think @gildub , would you be willing to review UI PRs? I'd rather ask you rather than give you a task without your permission :) |
@carlosthe19916 The PR review process is a very well established best practice that we must continue to do. As we discussed this morning we need to get more Engineers capable of contributing to the UI. @gildub already has those skills so he should be your go to guy for now. |
From the commentary, it seems obvious we should keep the two repos separate for now. Everyone has mentioned potential downsides to doing this, and the only barely recognizable upside I see is "you know I'm a monorepo kinda guy". |
@jcrossley3 well, the original motivation was "having trustd" serve it. But, I also think we can sort that across repos, somehow. |
I think a monorepo approach makes sense for a project organized with full stack teams working across the board (likely broken down by services) otherwise having a separate repo is easier to maintain by an UI dedicated team. In the meantime, I can review UI PRs. |
I volunteer to also review UI 👍 |
@bobmcwhirter @jcrossley3 @ctron I have updated this PR so the UI code still lives in its own repository. To test this PR you only need to run cargo run --bin trustd Just like it is a requisite to have Rust installed, it is also a requisite to have NodeJs 20 installed in your computer. You can use https://github.com/nvm-sh/nvm for installing NodeJS. |
Sorry, but I'm an idiot, and I require more hand-holding. Can you include specific commands at the top of the README for seeing the UI? All I see is "Error" when I visit http://localhost:8080. You can assume I have You can fill a barn with what I don't know about git submodules and nvm. My |
Ah submodules strike again! |
I don't think I want this. I'd prefer to treat the two repos separately. Serving the UI from the api server is a cool deployment feature, and I'm down for adding whatever tooling is necessary for packaging that, but IMO it's an overall negative for development. If I get outvoted, we need to at least fix |
@@ -34,7 +34,9 @@ fn main() { | |||
} | |||
|
|||
fn clone_ui() -> io::Result<ExitStatus> { | |||
Command::new(GIT_CMD).args(["submodule", "update"]).status() | |||
Command::new(GIT_CMD) | |||
.args(["submodule", "update", "--init", "--recursive"]) |
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.
Ah! I figured this out on my own, not realizing you were attempting to prevent me from having to do that.
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.
yep, the idea is not requiring the user to execute additional commands
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 change fixed my issue, thanks!
I know you already confirmed you have NVM but could you double check you have NodeJS 20?
@jcrossley3 you spotted a mistake on my side. The command for cloning the git submodule was not correct at all, I fixed it in my last commits Sorry for the mistake, but could you test it again please? |
I agree. |
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.
I still don't think I want this, but if we must, we need to bring the log output back.
@@ -34,7 +34,9 @@ fn main() { | |||
} | |||
|
|||
fn clone_ui() -> io::Result<ExitStatus> { | |||
Command::new(GIT_CMD).args(["submodule", "update"]).status() | |||
Command::new(GIT_CMD) | |||
.args(["submodule", "update", "--init", "--recursive"]) |
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 change fixed my issue, thanks!
use std::{fs, io}; | ||
|
||
static UI_DIR: &str = "../ui"; | ||
static UI_DIR_SRC: &str = "../ui/src"; |
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.
static UI_DIR_SRC: &str = "../ui/src"; |
This path doesn't exist, so cargo builds each time.
fn main() { | ||
println!("Build Trustify - build.rs!"); | ||
|
||
println!("cargo:rerun-if-changed={}", UI_DIR_SRC); |
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.
println!("cargo:rerun-if-changed={}", UI_DIR_SRC); | |
println!("cargo:rerun-if-changed={}", UI_DIR); |
This is what you meant, I think, and cargo only builds when something beneath there changes.
Let's see if we can't crate it like the swagger UI and use as a dependency instead of git shenanigans. Say shenanigans one more time. |
Then random jackholes like me won't need NPM. |
You're expecting those same random jackholes to install |
But I agree, a crate would be nice. |
Yah I'm wrong. Source means we'd all still compile it locally including NPM. Which is still better than submodules. |
I think this is getting a little bit out of hand. What about just packaging a And then just fetch, add, commit, and push that zip (or it's extracted content) to this repository. Assuming we do this via something like a "makefile", where there's a single "version" field which refreshes this, we could even run this in the CI and ensure that there are no local changes that we missed (like we did it for the Helm Charts to OpenShift templates conversion). |
Closing, solved differently. |
@bobmcwhirter you mentioned the UI being served by the trustd server. Here is a working example of it.
I opened this PR mainly to show your idea in action. I'll defer the decision of where the UI code should live. So no need to merge this PR until we are happy with it.
How to test this PR
Open http://localhost:8080