A focused Docker Compose management web application.
0
fork

Configure Feed

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

feat: reading compose project

Brooke 2583a4b8 c7ecc0f8

+358 -4
+338
packages/node/Cargo.lock
··· 24 24 checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" 25 25 26 26 [[package]] 27 + name = "ahash" 28 + version = "0.8.12" 29 + source = "registry+https://github.com/rust-lang/crates.io-index" 30 + checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" 31 + dependencies = [ 32 + "cfg-if", 33 + "getrandom", 34 + "once_cell", 35 + "version_check", 36 + "zerocopy", 37 + ] 38 + 39 + [[package]] 40 + name = "aho-corasick" 41 + version = "1.1.4" 42 + source = "registry+https://github.com/rust-lang/crates.io-index" 43 + checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" 44 + dependencies = [ 45 + "memchr", 46 + ] 47 + 48 + [[package]] 27 49 name = "android_system_properties" 28 50 version = "0.1.5" 29 51 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 31 53 dependencies = [ 32 54 "libc", 33 55 ] 56 + 57 + [[package]] 58 + name = "annotate-snippets" 59 + version = "0.12.11" 60 + source = "registry+https://github.com/rust-lang/crates.io-index" 61 + checksum = "16e4850548ff4a25a77ce3bda7241874e17fb702ea551f0cc62a2dbe052f1272" 62 + dependencies = [ 63 + "anstyle", 64 + "unicode-width", 65 + ] 66 + 67 + [[package]] 68 + name = "anstyle" 69 + version = "1.0.13" 70 + source = "registry+https://github.com/rust-lang/crates.io-index" 71 + checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" 72 + 73 + [[package]] 74 + name = "arraydeque" 75 + version = "0.5.1" 76 + source = "registry+https://github.com/rust-lang/crates.io-index" 77 + checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236" 34 78 35 79 [[package]] 36 80 name = "atomic-waker" ··· 236 280 checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" 237 281 238 282 [[package]] 283 + name = "darling" 284 + version = "0.20.11" 285 + source = "registry+https://github.com/rust-lang/crates.io-index" 286 + checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" 287 + dependencies = [ 288 + "darling_core", 289 + "darling_macro", 290 + ] 291 + 292 + [[package]] 293 + name = "darling_core" 294 + version = "0.20.11" 295 + source = "registry+https://github.com/rust-lang/crates.io-index" 296 + checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" 297 + dependencies = [ 298 + "fnv", 299 + "ident_case", 300 + "proc-macro2", 301 + "quote", 302 + "strsim", 303 + "syn 2.0.114", 304 + ] 305 + 306 + [[package]] 307 + name = "darling_macro" 308 + version = "0.20.11" 309 + source = "registry+https://github.com/rust-lang/crates.io-index" 310 + checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" 311 + dependencies = [ 312 + "darling_core", 313 + "quote", 314 + "syn 2.0.114", 315 + ] 316 + 317 + [[package]] 318 + name = "derive_builder" 319 + version = "0.20.2" 320 + source = "registry+https://github.com/rust-lang/crates.io-index" 321 + checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" 322 + dependencies = [ 323 + "derive_builder_macro", 324 + ] 325 + 326 + [[package]] 327 + name = "derive_builder_core" 328 + version = "0.20.2" 329 + source = "registry+https://github.com/rust-lang/crates.io-index" 330 + checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" 331 + dependencies = [ 332 + "darling", 333 + "proc-macro2", 334 + "quote", 335 + "syn 2.0.114", 336 + ] 337 + 338 + [[package]] 339 + name = "derive_builder_macro" 340 + version = "0.20.2" 341 + source = "registry+https://github.com/rust-lang/crates.io-index" 342 + checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" 343 + dependencies = [ 344 + "derive_builder_core", 345 + "syn 2.0.114", 346 + ] 347 + 348 + [[package]] 239 349 name = "displaydoc" 240 350 version = "0.2.5" 241 351 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 247 357 ] 248 358 249 359 [[package]] 360 + name = "docker-compose-types" 361 + version = "0.22.0" 362 + source = "registry+https://github.com/rust-lang/crates.io-index" 363 + checksum = "7edb75a85449fd9c34d9fb3376c6208ec4115d2ca43b965175a52d71349ecab8" 364 + dependencies = [ 365 + "derive_builder", 366 + "indexmap", 367 + "serde", 368 + "serde_yaml", 369 + ] 370 + 371 + [[package]] 250 372 name = "document-features" 251 373 version = "0.2.12" 252 374 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 262 384 checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" 263 385 264 386 [[package]] 387 + name = "encoding_rs" 388 + version = "0.8.35" 389 + source = "registry+https://github.com/rust-lang/crates.io-index" 390 + checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" 391 + dependencies = [ 392 + "cfg-if", 393 + ] 394 + 395 + [[package]] 396 + name = "encoding_rs_io" 397 + version = "0.1.7" 398 + source = "registry+https://github.com/rust-lang/crates.io-index" 399 + checksum = "1cc3c5651fb62ab8aa3103998dade57efdd028544bd300516baa31840c252a83" 400 + dependencies = [ 401 + "encoding_rs", 402 + ] 403 + 404 + [[package]] 405 + name = "equivalent" 406 + version = "1.0.2" 407 + source = "registry+https://github.com/rust-lang/crates.io-index" 408 + checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" 409 + 410 + [[package]] 265 411 name = "errno" 266 412 version = "0.3.14" 267 413 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 288 434 checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" 289 435 290 436 [[package]] 437 + name = "fnv" 438 + version = "1.0.7" 439 + source = "registry+https://github.com/rust-lang/crates.io-index" 440 + checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 441 + 442 + [[package]] 291 443 name = "form_urlencoded" 292 444 version = "1.2.2" 293 445 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 349 501 ] 350 502 351 503 [[package]] 504 + name = "getrandom" 505 + version = "0.3.4" 506 + source = "registry+https://github.com/rust-lang/crates.io-index" 507 + checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" 508 + dependencies = [ 509 + "cfg-if", 510 + "js-sys", 511 + "libc", 512 + "r-efi", 513 + "wasip2", 514 + "wasm-bindgen", 515 + ] 516 + 517 + [[package]] 352 518 name = "gimli" 353 519 version = "0.32.3" 354 520 source = "registry+https://github.com/rust-lang/crates.io-index" 355 521 checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" 356 522 357 523 [[package]] 524 + name = "hashbrown" 525 + version = "0.16.1" 526 + source = "registry+https://github.com/rust-lang/crates.io-index" 527 + checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" 528 + 529 + [[package]] 358 530 name = "hex" 359 531 version = "0.4.3" 360 532 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 583 755 ] 584 756 585 757 [[package]] 758 + name = "ident_case" 759 + version = "1.0.1" 760 + source = "registry+https://github.com/rust-lang/crates.io-index" 761 + checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 762 + 763 + [[package]] 586 764 name = "idna" 587 765 version = "1.1.0" 588 766 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 608 786 version = "0.3.4" 609 787 source = "registry+https://github.com/rust-lang/crates.io-index" 610 788 checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5" 789 + 790 + [[package]] 791 + name = "indexmap" 792 + version = "2.13.0" 793 + source = "registry+https://github.com/rust-lang/crates.io-index" 794 + checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" 795 + dependencies = [ 796 + "equivalent", 797 + "hashbrown", 798 + "serde", 799 + "serde_core", 800 + ] 611 801 612 802 [[package]] 613 803 name = "indoc" ··· 695 885 "axum", 696 886 "bollard", 697 887 "color-eyre", 888 + "docker-compose-types", 698 889 "itertools 0.14.0", 699 890 "luminary-macros", 700 891 "serde", 892 + "serde-saphyr", 701 893 "serde_json", 702 894 "specta", 703 895 "tokio", ··· 740 932 "wasi", 741 933 "windows-sys 0.61.2", 742 934 ] 935 + 936 + [[package]] 937 + name = "nohash-hasher" 938 + version = "0.2.0" 939 + source = "registry+https://github.com/rust-lang/crates.io-index" 940 + checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" 743 941 744 942 [[package]] 745 943 name = "num-traits" ··· 823 1021 ] 824 1022 825 1023 [[package]] 1024 + name = "r-efi" 1025 + version = "5.3.0" 1026 + source = "registry+https://github.com/rust-lang/crates.io-index" 1027 + checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" 1028 + 1029 + [[package]] 1030 + name = "regex" 1031 + version = "1.12.3" 1032 + source = "registry+https://github.com/rust-lang/crates.io-index" 1033 + checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" 1034 + dependencies = [ 1035 + "aho-corasick", 1036 + "memchr", 1037 + "regex-automata", 1038 + "regex-syntax", 1039 + ] 1040 + 1041 + [[package]] 1042 + name = "regex-automata" 1043 + version = "0.4.14" 1044 + source = "registry+https://github.com/rust-lang/crates.io-index" 1045 + checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" 1046 + dependencies = [ 1047 + "aho-corasick", 1048 + "memchr", 1049 + "regex-syntax", 1050 + ] 1051 + 1052 + [[package]] 1053 + name = "regex-syntax" 1054 + version = "0.8.9" 1055 + source = "registry+https://github.com/rust-lang/crates.io-index" 1056 + checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c" 1057 + 1058 + [[package]] 826 1059 name = "rustc-demangle" 827 1060 version = "0.1.27" 828 1061 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 841 1074 checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" 842 1075 843 1076 [[package]] 1077 + name = "saphyr-parser-bw" 1078 + version = "0.0.608" 1079 + source = "registry+https://github.com/rust-lang/crates.io-index" 1080 + checksum = "d55ae5ea09894b6d5382621db78f586df37ef18ab581bf32c754e75076b124b1" 1081 + dependencies = [ 1082 + "arraydeque", 1083 + "smallvec", 1084 + "thiserror 2.0.18", 1085 + ] 1086 + 1087 + [[package]] 844 1088 name = "serde" 845 1089 version = "1.0.228" 846 1090 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 851 1095 ] 852 1096 853 1097 [[package]] 1098 + name = "serde-saphyr" 1099 + version = "0.0.19" 1100 + source = "registry+https://github.com/rust-lang/crates.io-index" 1101 + checksum = "29fb2d57f074f415e3ea6905994be8aca2bd7a17f8a0344cc43ed15bf240a547" 1102 + dependencies = [ 1103 + "ahash", 1104 + "annotate-snippets", 1105 + "base64", 1106 + "encoding_rs_io", 1107 + "getrandom", 1108 + "nohash-hasher", 1109 + "num-traits", 1110 + "regex", 1111 + "saphyr-parser-bw", 1112 + "serde", 1113 + "serde_json", 1114 + "smallvec", 1115 + "zmij", 1116 + ] 1117 + 1118 + [[package]] 854 1119 name = "serde_core" 855 1120 version = "1.0.228" 856 1121 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 876 1141 source = "registry+https://github.com/rust-lang/crates.io-index" 877 1142 checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" 878 1143 dependencies = [ 1144 + "indexmap", 879 1145 "itoa", 880 1146 "memchr", 881 1147 "serde", ··· 918 1184 ] 919 1185 920 1186 [[package]] 1187 + name = "serde_yaml" 1188 + version = "0.9.33" 1189 + source = "registry+https://github.com/rust-lang/crates.io-index" 1190 + checksum = "a0623d197252096520c6f2a5e1171ee436e5af99a5d7caa2891e55e61950e6d9" 1191 + dependencies = [ 1192 + "indexmap", 1193 + "itoa", 1194 + "ryu", 1195 + "serde", 1196 + "unsafe-libyaml", 1197 + ] 1198 + 1199 + [[package]] 921 1200 name = "sharded-slab" 922 1201 version = "0.1.7" 923 1202 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 999 1278 version = "1.2.1" 1000 1279 source = "registry+https://github.com/rust-lang/crates.io-index" 1001 1280 checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" 1281 + 1282 + [[package]] 1283 + name = "strsim" 1284 + version = "0.11.1" 1285 + source = "registry+https://github.com/rust-lang/crates.io-index" 1286 + checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" 1002 1287 1003 1288 [[package]] 1004 1289 name = "syn" ··· 1230 1515 checksum = "537dd038a89878be9b64dd4bd1b260315c1bb94f4d784956b81e27a088d9a09e" 1231 1516 1232 1517 [[package]] 1518 + name = "unicode-width" 1519 + version = "0.2.2" 1520 + source = "registry+https://github.com/rust-lang/crates.io-index" 1521 + checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" 1522 + 1523 + [[package]] 1524 + name = "unsafe-libyaml" 1525 + version = "0.2.11" 1526 + source = "registry+https://github.com/rust-lang/crates.io-index" 1527 + checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" 1528 + 1529 + [[package]] 1233 1530 name = "url" 1234 1531 version = "2.5.8" 1235 1532 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1254 1551 checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" 1255 1552 1256 1553 [[package]] 1554 + name = "version_check" 1555 + version = "0.9.5" 1556 + source = "registry+https://github.com/rust-lang/crates.io-index" 1557 + checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" 1558 + 1559 + [[package]] 1257 1560 name = "want" 1258 1561 version = "0.3.1" 1259 1562 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1267 1570 version = "0.11.1+wasi-snapshot-preview1" 1268 1571 source = "registry+https://github.com/rust-lang/crates.io-index" 1269 1572 checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" 1573 + 1574 + [[package]] 1575 + name = "wasip2" 1576 + version = "1.0.2+wasi-0.2.9" 1577 + source = "registry+https://github.com/rust-lang/crates.io-index" 1578 + checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" 1579 + dependencies = [ 1580 + "wit-bindgen", 1581 + ] 1270 1582 1271 1583 [[package]] 1272 1584 name = "wasm-bindgen" ··· 1487 1799 checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" 1488 1800 1489 1801 [[package]] 1802 + name = "wit-bindgen" 1803 + version = "0.51.0" 1804 + source = "registry+https://github.com/rust-lang/crates.io-index" 1805 + checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" 1806 + 1807 + [[package]] 1490 1808 name = "writeable" 1491 1809 version = "0.6.2" 1492 1810 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1513 1831 "quote", 1514 1832 "syn 2.0.114", 1515 1833 "synstructure", 1834 + ] 1835 + 1836 + [[package]] 1837 + name = "zerocopy" 1838 + version = "0.8.39" 1839 + source = "registry+https://github.com/rust-lang/crates.io-index" 1840 + checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a" 1841 + dependencies = [ 1842 + "zerocopy-derive", 1843 + ] 1844 + 1845 + [[package]] 1846 + name = "zerocopy-derive" 1847 + version = "0.8.39" 1848 + source = "registry+https://github.com/rust-lang/crates.io-index" 1849 + checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517" 1850 + dependencies = [ 1851 + "proc-macro2", 1852 + "quote", 1853 + "syn 2.0.114", 1516 1854 ] 1517 1855 1518 1856 [[package]]
+2
packages/node/Cargo.toml
··· 17 17 "fs", 18 18 ] } 19 19 itertools = "0.14.0" 20 + docker-compose-types = "0.22.0" 21 + serde-saphyr = "0.0.19"
+18 -4
packages/node/src/core/project.rs
··· 1 1 use std::collections::HashMap; 2 2 3 3 use bollard::query_parameters::ListContainersOptionsBuilder; 4 - use color_eyre::eyre::{Ok, Result, WrapErr}; 4 + use color_eyre::eyre::{ContextCompat, Ok, Result, WrapErr}; 5 + use docker_compose_types::Compose; 5 6 use luminary_macros::wrap_err; 6 - use tokio::fs; 7 + use tokio::fs::{self, File}; 7 8 8 9 use crate::core::{ 9 10 LuminaryCore, ··· 16 17 const COMPOSE_SERVICE_LABEL: &str = "com.docker.compose.service"; 17 18 18 19 const ENV_PROJECT_DIRECTORY: &str = "LUMINARY_PROJECT_DIRECTORY"; 20 + const COMPOSE_FILENAME: &str = "compose.yml"; 19 21 20 22 impl LuminaryCore { 21 23 #[wrap_err("Failed to list projects from filesystem")] ··· 29 31 .await 30 32 .wrap_err("Failed to list project directory contents")?; 31 33 while let Some(entry) = entries.next_entry().await? { 32 - let path = entry.path(); 33 - // do something with path 34 + let mut path = entry.path(); 35 + if path.is_dir() { 36 + let project_name = path 37 + .file_name() 38 + .wrap_err("Failed to get project directory name")? 39 + .to_str() 40 + .wrap_err("Failed to read project directory name")? 41 + .to_owned(); 42 + path.push(COMPOSE_FILENAME); 43 + if path.exists() { 44 + let file = File::open(path).await.wrap_err("Failed to open compose file")?; 45 + let compose: Compose = serde_saphyr::from_reader(file.into_std().await)?; 46 + } 47 + } 34 48 } 35 49 36 50 return Ok(projects);