mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 18:17:39 +08:00
load mini-dashboard assets
This commit is contained in:
parent
ea5517bc8c
commit
bb79695e44
163
Cargo.lock
generated
163
Cargo.lock
generated
@ -521,6 +521,38 @@ dependencies = [
|
|||||||
"bytes 1.0.1",
|
"bytes 1.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bzip2"
|
||||||
|
version = "0.3.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "42b7c3cbf0fa9c1b82308d57191728ca0256cb821220f4e2fd410a72ade26e3b"
|
||||||
|
dependencies = [
|
||||||
|
"bzip2-sys",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bzip2-sys"
|
||||||
|
version = "0.1.10+1.0.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "17fa3d1ac1ca21c5c4e36a97f3c3eb25084576f6fc47bf0139c1123434216c6c"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
"libc",
|
||||||
|
"pkg-config",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cargo_toml"
|
||||||
|
version = "0.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d94e66797729c3a52b74980ec7992a9399aace3044bbcde9ce6bb98926abb673"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
"serde_derive",
|
||||||
|
"toml",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.67"
|
version = "1.0.67"
|
||||||
@ -1236,6 +1268,12 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hex"
|
||||||
|
version = "0.4.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hostname"
|
name = "hostname"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
@ -1268,6 +1306,17 @@ dependencies = [
|
|||||||
"http",
|
"http",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "http-body"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5dfb77c123b4e2f72a2069aeae0b4b4949cc7e966df277813fc16347e7549737"
|
||||||
|
dependencies = [
|
||||||
|
"bytes 1.0.1",
|
||||||
|
"http",
|
||||||
|
"pin-project-lite 0.2.6",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "httparse"
|
name = "httparse"
|
||||||
version = "1.4.0"
|
version = "1.4.0"
|
||||||
@ -1313,7 +1362,7 @@ dependencies = [
|
|||||||
"futures-util",
|
"futures-util",
|
||||||
"h2 0.2.7",
|
"h2 0.2.7",
|
||||||
"http",
|
"http",
|
||||||
"http-body",
|
"http-body 0.3.1",
|
||||||
"httparse",
|
"httparse",
|
||||||
"httpdate",
|
"httpdate",
|
||||||
"itoa",
|
"itoa",
|
||||||
@ -1325,6 +1374,30 @@ dependencies = [
|
|||||||
"want",
|
"want",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hyper"
|
||||||
|
version = "0.14.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8bf09f61b52cfcf4c00de50df88ae423d6c02354e385a86341133b5338630ad1"
|
||||||
|
dependencies = [
|
||||||
|
"bytes 1.0.1",
|
||||||
|
"futures-channel",
|
||||||
|
"futures-core",
|
||||||
|
"futures-util",
|
||||||
|
"h2 0.3.2",
|
||||||
|
"http",
|
||||||
|
"http-body 0.4.1",
|
||||||
|
"httparse",
|
||||||
|
"httpdate",
|
||||||
|
"itoa",
|
||||||
|
"pin-project",
|
||||||
|
"socket2 0.4.0",
|
||||||
|
"tokio 1.5.0",
|
||||||
|
"tower-service",
|
||||||
|
"tracing",
|
||||||
|
"want",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hyper-rustls"
|
name = "hyper-rustls"
|
||||||
version = "0.21.0"
|
version = "0.21.0"
|
||||||
@ -1333,7 +1406,7 @@ checksum = "37743cc83e8ee85eacfce90f2f4102030d9ff0a95244098d781e9bee4a90abb6"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes 0.5.6",
|
"bytes 0.5.6",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"hyper",
|
"hyper 0.13.10",
|
||||||
"log",
|
"log",
|
||||||
"rustls 0.18.1",
|
"rustls 0.18.1",
|
||||||
"tokio 0.2.25",
|
"tokio 0.2.25",
|
||||||
@ -1341,6 +1414,21 @@ dependencies = [
|
|||||||
"webpki",
|
"webpki",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hyper-rustls"
|
||||||
|
version = "0.22.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64"
|
||||||
|
dependencies = [
|
||||||
|
"futures-util",
|
||||||
|
"hyper 0.14.5",
|
||||||
|
"log",
|
||||||
|
"rustls 0.19.1",
|
||||||
|
"tokio 1.5.0",
|
||||||
|
"tokio-rustls 0.22.0",
|
||||||
|
"webpki",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "idna"
|
name = "idna"
|
||||||
version = "0.2.3"
|
version = "0.2.3"
|
||||||
@ -1638,6 +1726,7 @@ dependencies = [
|
|||||||
"async-trait",
|
"async-trait",
|
||||||
"byte-unit",
|
"byte-unit",
|
||||||
"bytes 0.6.0",
|
"bytes 0.6.0",
|
||||||
|
"cargo_toml",
|
||||||
"chrono",
|
"chrono",
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"dashmap",
|
"dashmap",
|
||||||
@ -1649,6 +1738,7 @@ dependencies = [
|
|||||||
"futures-util",
|
"futures-util",
|
||||||
"grenad",
|
"grenad",
|
||||||
"heed",
|
"heed",
|
||||||
|
"hex",
|
||||||
"http",
|
"http",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"itertools 0.10.0",
|
"itertools 0.10.0",
|
||||||
@ -1669,11 +1759,13 @@ dependencies = [
|
|||||||
"rand 0.7.3",
|
"rand 0.7.3",
|
||||||
"rayon",
|
"rayon",
|
||||||
"regex",
|
"regex",
|
||||||
|
"reqwest 0.11.3",
|
||||||
"rustls 0.19.1",
|
"rustls 0.19.1",
|
||||||
"sentry",
|
"sentry",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_url_params",
|
"serde_url_params",
|
||||||
|
"sha-1 0.9.4",
|
||||||
"sha2",
|
"sha2",
|
||||||
"siphasher",
|
"siphasher",
|
||||||
"slice-group-by",
|
"slice-group-by",
|
||||||
@ -1687,6 +1779,7 @@ dependencies = [
|
|||||||
"uuid",
|
"uuid",
|
||||||
"vergen",
|
"vergen",
|
||||||
"walkdir",
|
"walkdir",
|
||||||
|
"zip",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2503,9 +2596,9 @@ dependencies = [
|
|||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"http",
|
"http",
|
||||||
"http-body",
|
"http-body 0.3.1",
|
||||||
"hyper",
|
"hyper 0.13.10",
|
||||||
"hyper-rustls",
|
"hyper-rustls 0.21.0",
|
||||||
"ipnet",
|
"ipnet",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
@ -2528,6 +2621,41 @@ dependencies = [
|
|||||||
"winreg",
|
"winreg",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "reqwest"
|
||||||
|
version = "0.11.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2296f2fac53979e8ccbc4a1136b25dcefd37be9ed7e4a1f6b05a6029c84ff124"
|
||||||
|
dependencies = [
|
||||||
|
"base64 0.13.0",
|
||||||
|
"bytes 1.0.1",
|
||||||
|
"encoding_rs",
|
||||||
|
"futures-core",
|
||||||
|
"futures-util",
|
||||||
|
"http",
|
||||||
|
"http-body 0.4.1",
|
||||||
|
"hyper 0.14.5",
|
||||||
|
"hyper-rustls 0.22.1",
|
||||||
|
"ipnet",
|
||||||
|
"js-sys",
|
||||||
|
"lazy_static",
|
||||||
|
"log",
|
||||||
|
"mime",
|
||||||
|
"percent-encoding",
|
||||||
|
"pin-project-lite 0.2.6",
|
||||||
|
"rustls 0.19.1",
|
||||||
|
"serde",
|
||||||
|
"serde_urlencoded",
|
||||||
|
"tokio 1.5.0",
|
||||||
|
"tokio-rustls 0.22.0",
|
||||||
|
"url",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"wasm-bindgen-futures",
|
||||||
|
"web-sys",
|
||||||
|
"webpki-roots 0.21.1",
|
||||||
|
"winreg",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "retain_mut"
|
name = "retain_mut"
|
||||||
version = "0.1.2"
|
version = "0.1.2"
|
||||||
@ -2691,7 +2819,7 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"rand 0.7.3",
|
"rand 0.7.3",
|
||||||
"regex",
|
"regex",
|
||||||
"reqwest",
|
"reqwest 0.10.10",
|
||||||
"rustc_version 0.2.3",
|
"rustc_version 0.2.3",
|
||||||
"sentry-types",
|
"sentry-types",
|
||||||
"uname",
|
"uname",
|
||||||
@ -3275,6 +3403,15 @@ dependencies = [
|
|||||||
"tokio 1.5.0",
|
"tokio 1.5.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml"
|
||||||
|
version = "0.5.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tower-service"
|
name = "tower-service"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
@ -3700,6 +3837,20 @@ dependencies = [
|
|||||||
"synstructure",
|
"synstructure",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zip"
|
||||||
|
version = "0.5.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9c83dc9b784d252127720168abd71ea82bf8c3d96b17dc565b5e2a02854f2b27"
|
||||||
|
dependencies = [
|
||||||
|
"byteorder",
|
||||||
|
"bzip2",
|
||||||
|
"crc32fast",
|
||||||
|
"flate2",
|
||||||
|
"thiserror",
|
||||||
|
"time 0.1.44",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zstd"
|
name = "zstd"
|
||||||
version = "0.5.4+zstd.1.4.7"
|
version = "0.5.4+zstd.1.4.7"
|
||||||
|
@ -10,7 +10,13 @@ name = "meilisearch"
|
|||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
anyhow = "*"
|
||||||
|
cargo_toml = "0.9.0"
|
||||||
|
hex = "0.4.3"
|
||||||
|
reqwest = { version = "0.11.3", features = ["blocking", "rustls-tls"], default-features = false}
|
||||||
|
sha-1 = "0.9.4"
|
||||||
vergen = "3.1.0"
|
vergen = "3.1.0"
|
||||||
|
zip = "0.5.12"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-cors = "0.6.0-beta.1"
|
actix-cors = "0.6.0-beta.1"
|
||||||
@ -96,3 +102,7 @@ default = ["sentry"]
|
|||||||
|
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
[target.'cfg(target_os = "linux")'.dependencies]
|
||||||
jemallocator = "0.3.2"
|
jemallocator = "0.3.2"
|
||||||
|
|
||||||
|
[package.metadata.mini-dashboard]
|
||||||
|
assets-url = "https://github.com/meilisearch/mini-dashboard/releases/download/v0.1.0/build.zip"
|
||||||
|
sha1 = "abb7bd8765b9fab38675958bc9d06088589c712c"
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
use std::env;
|
use std::env;
|
||||||
|
use std::fs::create_dir_all;
|
||||||
|
use std::io::Cursor;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
use anyhow::Context;
|
||||||
|
use sha1::{Sha1, Digest};
|
||||||
|
use reqwest::blocking::get;
|
||||||
|
|
||||||
use vergen::{generate_cargo_keys, ConstantsFlags};
|
use vergen::{generate_cargo_keys, ConstantsFlags};
|
||||||
|
use cargo_toml::Manifest;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// Setup the flags, toggling off the 'SEMVER_FROM_CARGO_PKG' flag
|
// Setup the flags, toggling off the 'SEMVER_FROM_CARGO_PKG' flag
|
||||||
@ -11,6 +19,40 @@ fn main() {
|
|||||||
generate_cargo_keys(ConstantsFlags::all()).expect("Unable to generate the cargo keys!");
|
generate_cargo_keys(ConstantsFlags::all()).expect("Unable to generate the cargo keys!");
|
||||||
|
|
||||||
if let Ok(_) = env::var("CARGO_FEATURE_MINI_DASHBOARD") {
|
if let Ok(_) = env::var("CARGO_FEATURE_MINI_DASHBOARD") {
|
||||||
todo!()
|
setup_mini_dashboard().expect("Could not load mini-dashboard assets");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn setup_mini_dashboard() -> anyhow::Result<()> {
|
||||||
|
let cargo_manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
|
||||||
|
let cargo_toml = cargo_manifest_dir.join("Cargo.toml");
|
||||||
|
|
||||||
|
let manifest = Manifest::from_path(cargo_toml).unwrap();
|
||||||
|
|
||||||
|
let meta = &manifest
|
||||||
|
.package
|
||||||
|
.as_ref()
|
||||||
|
.context("package not specified in Cargo.toml")?
|
||||||
|
.metadata
|
||||||
|
.as_ref()
|
||||||
|
.context("no metadata specified in Cargo.toml")?
|
||||||
|
["mini-dashboard"];
|
||||||
|
|
||||||
|
let url = meta["assets-url"].as_str().unwrap();
|
||||||
|
|
||||||
|
let dashboard_assets_bytes = get(url)?
|
||||||
|
.bytes()?;
|
||||||
|
|
||||||
|
let mut hasher = Sha1::new();
|
||||||
|
hasher.update(&dashboard_assets_bytes);
|
||||||
|
let sha1_dashboard = hex::encode(hasher.finalize());
|
||||||
|
|
||||||
|
assert_eq!(meta["sha1"].as_str().unwrap(), sha1_dashboard);
|
||||||
|
|
||||||
|
let dashboard_dir = cargo_manifest_dir.join("mini-dashboard");
|
||||||
|
create_dir_all(&dashboard_dir)?;
|
||||||
|
let cursor = Cursor::new(&dashboard_assets_bytes);
|
||||||
|
let mut zip = zip::read::ZipArchive::new(cursor)?;
|
||||||
|
zip.extract(&dashboard_dir)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user