A focused Docker Compose management web application.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: static fileserver

Brooke 1aa01269 d336d174

+73 -32
+28
Cargo.lock
··· 755 755 checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" 756 756 dependencies = [ 757 757 "powerfmt", 758 + "serde_core", 758 759 ] 759 760 760 761 [[package]] ··· 2176 2177 ] 2177 2178 2178 2179 [[package]] 2180 + name = "path-slash" 2181 + version = "0.2.1" 2182 + source = "registry+https://github.com/rust-lang/crates.io-index" 2183 + checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" 2184 + 2185 + [[package]] 2179 2186 name = "pem" 2180 2187 version = "3.0.6" 2181 2188 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2864 2871 "salvo-acme", 2865 2872 "salvo-oapi", 2866 2873 "salvo-proxy", 2874 + "salvo-serve-static", 2867 2875 "salvo_core", 2868 2876 "salvo_extra", 2869 2877 ] ··· 2990 2998 "proc-macro2", 2991 2999 "quote", 2992 3000 "syn 2.0.116", 3001 + ] 3002 + 3003 + [[package]] 3004 + name = "salvo-serve-static" 3005 + version = "0.89.1" 3006 + source = "registry+https://github.com/rust-lang/crates.io-index" 3007 + checksum = "754271d8494b3dcca612589993bf215936f97964eaf0cee4f59abea61bc9481d" 3008 + dependencies = [ 3009 + "hex", 3010 + "mime", 3011 + "mime-infer", 3012 + "path-slash", 3013 + "percent-encoding", 3014 + "rust-embed", 3015 + "salvo_core", 3016 + "serde", 3017 + "serde_json", 3018 + "time", 3019 + "tokio", 3020 + "tracing", 2993 3021 ] 2994 3022 2995 3023 [[package]]
+5
justfile
··· 12 12 cargo install cargo-watch --locked 13 13 cargo install sqlx-cli --locked 14 14 15 + build: 16 + pnpm build 17 + cargo build --release 18 + cp -R packages/panel/build target/release/static 19 + 15 20 export DATABASE_URL := "sqlite://" + justfile_dir() + "/luminary.db" 16 21 17 22 [working-directory('packages/node')]
+7 -1
packages/node/Cargo.toml
··· 4 4 edition = { workspace = true } 5 5 6 6 [dependencies] 7 - salvo = { version = "0.89.1", features = ["affix-state", "oapi", "sse"] } 8 7 uuid = { version = "1.21.0", features = ["serde", "v4"] } 9 8 bollard = { version = "0.20", features = ["chrono"] } 10 9 luminary-macros = { path = "./macros" } ··· 25 24 eyre = "0.6" 26 25 envy = "0.4" 27 26 bytes = "1" 27 + 28 + salvo = { version = "0.89.1", features = [ 29 + "affix-state", 30 + "oapi", 31 + "sse", 32 + "serve-static", 33 + ] } 28 34 29 35 tokio = { version = "1.49", features = [ 30 36 "rt-multi-thread",
+33 -30
packages/node/src/api/mod.rs
··· 2 2 3 3 use eyre::Result; 4 4 use luminary_macros::wrap_err; 5 + use salvo::serve_static::StaticDir; 5 6 use salvo::{Router, affix_state, oapi::endpoint}; 6 7 use sqlx::SqlitePool; 7 8 ··· 61 62 62 63 /// Sets up a Salvo router with all API routes 63 64 fn router() -> Router { 64 - return Router::new().push( 65 - Router::with_path("/api") 66 - .push(Router::with_path("ping").get(ping)) 67 - .push(auth::router()) 68 - .push( 69 - // New router for protected routes, to avoid repetition 70 - Router::with_hoop(protected) 71 - .push(Router::with_path("realtime").get(app_subscribe)) 72 - .push( 73 - Router::with_path("/project/{project}") 74 - .push(project::router()) 75 - .push(Router::with_path("logs").get(logs_subscribe)) 76 - .push(Router::with_path("restart").post(action::restart_project)) 77 - .push(Router::with_path("start").post(action::start_project)) 78 - .push(Router::with_path("stop").post(action::stop_project)) 79 - .push(Router::with_path("recreate").post(action::recreate_project)) 80 - .push(Router::with_path("pull").post(action::pull_project)) 81 - .push(Router::with_path("build").post(action::build_project)) 82 - .push( 83 - Router::with_path("service/{service}") 84 - .push(Router::with_path("restart").post(action::restart_service)) 85 - .push(Router::with_path("start").post(action::start_service)) 86 - .push(Router::with_path("stop").post(action::stop_service)) 87 - .push(Router::with_path("recreate").post(action::recreate_service)) 88 - .push(Router::with_path("pull").post(action::pull_service)) 89 - .push(Router::with_path("build").post(action::build_service)), 90 - ), 91 - ), 92 - ), 93 - ); 65 + return Router::new() 66 + .push( 67 + Router::with_path("/api") 68 + .push(Router::with_path("ping").get(ping)) 69 + .push(auth::router()) 70 + .push( 71 + // New router for protected routes, to avoid repetition 72 + Router::with_hoop(protected) 73 + .push(Router::with_path("realtime").get(app_subscribe)) 74 + .push( 75 + Router::with_path("/project/{project}") 76 + .push(project::router()) 77 + .push(Router::with_path("logs").get(logs_subscribe)) 78 + .push(Router::with_path("restart").post(action::restart_project)) 79 + .push(Router::with_path("start").post(action::start_project)) 80 + .push(Router::with_path("stop").post(action::stop_project)) 81 + .push(Router::with_path("recreate").post(action::recreate_project)) 82 + .push(Router::with_path("pull").post(action::pull_project)) 83 + .push(Router::with_path("build").post(action::build_project)) 84 + .push( 85 + Router::with_path("service/{service}") 86 + .push(Router::with_path("restart").post(action::restart_service)) 87 + .push(Router::with_path("start").post(action::start_service)) 88 + .push(Router::with_path("stop").post(action::stop_service)) 89 + .push(Router::with_path("recreate").post(action::recreate_service)) 90 + .push(Router::with_path("pull").post(action::pull_service)) 91 + .push(Router::with_path("build").post(action::build_service)), 92 + ), 93 + ), 94 + ), 95 + ) 96 + .push(Router::with_path("{*path}").get(StaticDir::new(["static"]).defaults("fallback.html"))); 94 97 } 95 98 96 99 /// A simple endpoint to test if the server is running.
-1
packages/node/src/main.rs
··· 38 38 .init(); 39 39 40 40 // Load configuration 41 - #[cfg(debug_assertions)] 42 41 let configuration = Arc::new(envy::prefixed("LUMINARY_").from_env::<LuminaryConfiguration>()?); 43 42 44 43 // Set up the app and dependencies