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

Stop relying on npm to have the UI static files available in the server #312

Closed

Conversation

carlosthe19916
Copy link
Member

@carlosthe19916 carlosthe19916 commented May 20, 2024

Fix #265

Depends on: trustification/trustify-ui#30

Problem

Currently we rely on NPM to be installed for the UI crate to build the UI static files. This introduces a new layer that developers on the backend side might have difficulties with.

Proposed solution

  • By default the server uses the directory ./static-local to serve the UI.
    • The directory ./static-local contains just a basic "welcome" HTML page.
  • If the directory ./static exists, then this directory will be used to serve the UI. We can populate this directory with the static files generated by trustify-ui (this process can be manual or we can set some automation on it)
    • Relying only on the existence of ./static decouples the build phase of the UI and Trustify.
    • The static files can easily be added to the Dockerfile

Steps to test this

To test the default behaviour (default UI, not trustify-ui):

  • Execute cargo run --bin trustd and then open http://localhost:8080. You should see only a welcome message.

To test the UI from trustify-ui:

  • Clone the static files from ui into this repository directory:
podman cp $(docker create --name ui-download ghcr.io/trustification/trustify-ui:latest):/opt/app-root/dist/client/dist static && podman rm ui-download
  • Execute cargo clean
  • Execute cargo run --bin trustd and open http://localhost:8080 (open it in incognito mode to make sure cache is not there)

@carlosthe19916
Copy link
Member Author

Guys, after a nice debate internally, I think we should not merge this PR just to have contributions :)
Let's take our time to decide whether or not this is something we want.

  • If this is not the kind of solution we need, then we can open other PRs and solve the problem with other approaches

Take your time to review it, and feel free to close without merging :)

Note: we can not even merge this PR as it contains build errors, but before fixing the gh action errors I would rather have an official review and decide if we can merge this PR or we can close it

@carlosthe19916
Copy link
Member Author

Replaced by #319

@carlosthe19916 carlosthe19916 deleted the static-fui branch December 30, 2024 19:27
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.

Unable to build project due to trustify-ui
2 participants