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

feat(dashboard): embedded assets into binary for release builds #15656

Merged
merged 17 commits into from
Mar 14, 2024

Conversation

BugenZhao
Copy link
Member

@BugenZhao BugenZhao commented Mar 13, 2024

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

See #15280 (comment) for the background.

Introduce a dashboard crate for building and embedding assets. The embedded mode and proxied mode will be chosen based on configuration.

/// The router for the dashboard.
///
/// Based on the configuration, it will either serve the assets embedded in the binary,
/// or proxy all requests to the latest static files built and hosted on GitHub.
///
/// - For development and CI builds, the requests to the dashboard will be proxied. This
/// is to reduce the build time and eliminate the dependency on `node`, so that the
/// developer experience can be better.
///
/// - For release builds, the assets will built in the build script and embedded in the
/// binary. This is to make the deployment easier and the dashboard more reliable
/// without relying on external or remote resources.
///
/// If you're going to develop with the dashboard, see `dashboard/README.md` for more
/// details.

Note that there's no actual change on the binary release or docker release. This PR is mainly focusing on introducing the functionality. Will deprecate the old external ui approach in next PRs.

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • All checks passed in ./risedev check (or alias, ./risedev c)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

Copy link
Member Author

BugenZhao commented Mar 13, 2024

@BugenZhao BugenZhao force-pushed the bz/deprecate-risedev-build-dashboard branch from f920970 to a540de9 Compare March 13, 2024 07:57
@BugenZhao BugenZhao marked this pull request as ready for review March 13, 2024 09:11
@BugenZhao BugenZhao requested a review from a team as a code owner March 13, 2024 09:11
@BugenZhao BugenZhao force-pushed the bz/deprecate-risedev-build-dashboard branch from deaeb65 to efef179 Compare March 13, 2024 09:44
Base automatically changed from bz/deprecate-risedev-build-dashboard to main March 13, 2024 10:14
Copy link
Member

@xxchan xxchan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM

src/meta/dashboard/build.rs Outdated Show resolved Hide resolved
src/meta/dashboard/build.rs Outdated Show resolved Hide resolved
src/meta/dashboard/build.rs Show resolved Hide resolved

#[derive(RustEmbed)]
#[folder = "$OUT_DIR/assets"]
struct Assets;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the size of the embedded asset?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently 3.5 MB. We can also enable compression for embedded files if they're getting larger.

❯ du -sh dashboard/out                                                                                                                
3.5M    dashboard/out

Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
@BugenZhao BugenZhao requested a review from xxchan March 14, 2024 07:14
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Copy link
Member

@xxchan xxchan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gogogo

@BugenZhao BugenZhao added this pull request to the merge queue Mar 14, 2024
Merged via the queue into main with commit 89c1152 Mar 14, 2024
29 of 30 checks passed
@BugenZhao BugenZhao deleted the bz/embed-dashboard branch March 14, 2024 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants