diff --git a/.gitignore b/.gitignore index f1540820..ad07ae01 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,5 @@ src/bin/stack/app/node_modules somefile.md .idea ecosystem.config.js +tester.zip +unzipped diff --git a/Cargo.lock b/Cargo.lock index c53bde5c..bda837b4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,12 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + [[package]] name = "aead" version = "0.5.1" @@ -14,9 +20,9 @@ dependencies = [ [[package]] name = "aes" -version = "0.8.1" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfe0133578c0986e1fe3dfcd4af1cc5b2dd6c3dbf534d69916ce16a2701d40ba" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", "cipher", @@ -37,6 +43,24 @@ dependencies = [ "subtle", ] +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -85,7 +109,7 @@ checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.101", ] [[package]] @@ -96,7 +120,7 @@ checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.101", ] [[package]] @@ -125,6 +149,380 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "aws-config" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2368fb843e9eec932f7789d64d0e05850f4a79067188c657e572f1f5a7589df0" +dependencies = [ + "aws-credential-types", + "aws-runtime", + "aws-sdk-sso", + "aws-sdk-ssooidc", + "aws-sdk-sts", + "aws-smithy-async", + "aws-smithy-http", + "aws-smithy-json", + "aws-smithy-runtime", + "aws-smithy-runtime-api", + "aws-smithy-types", + "aws-types", + "bytes", + "fastrand 2.1.0", + "hex", + "http 0.2.12", + "hyper", + "ring 0.17.8", + "time", + "tokio", + "tracing", + "url", + "zeroize", +] + +[[package]] +name = "aws-credential-types" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e16838e6c9e12125face1c1eff1343c75e3ff540de98ff7ebd61874a89bcfeb9" +dependencies = [ + "aws-smithy-async", + "aws-smithy-runtime-api", + "aws-smithy-types", + "zeroize", +] + +[[package]] +name = "aws-runtime" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a4a5e448145999d7de17bf44a886900ecb834953408dae8aaf90465ce91c1dd" +dependencies = [ + "aws-credential-types", + "aws-sigv4", + "aws-smithy-async", + "aws-smithy-eventstream", + "aws-smithy-http", + "aws-smithy-runtime-api", + "aws-smithy-types", + "aws-types", + "bytes", + "fastrand 2.1.0", + "http 0.2.12", + "http-body 0.4.5", + "percent-encoding", + "pin-project-lite", + "tracing", + "uuid", +] + +[[package]] +name = "aws-sdk-s3" +version = "1.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ecec5514e9d9c76c5e9489ca65ab9055ae0b3c49da3a1afd452c57cb68734fb" +dependencies = [ + "ahash", + "aws-credential-types", + "aws-runtime", + "aws-sigv4", + "aws-smithy-async", + "aws-smithy-checksums", + "aws-smithy-eventstream", + "aws-smithy-http", + "aws-smithy-json", + "aws-smithy-runtime", + "aws-smithy-runtime-api", + "aws-smithy-types", + "aws-smithy-xml", + "aws-types", + "bytes", + "fastrand 2.1.0", + "hex", + "hmac", + "http 0.2.12", + "http-body 0.4.5", + "lru", + "once_cell", + "percent-encoding", + "regex-lite", + "sha2", + "tracing", + "url", +] + +[[package]] +name = "aws-sdk-sso" +version = "1.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8aee358b755b2738b3ffb8a5b54ee991b28c8a07483a0ff7d49a58305cc2609" +dependencies = [ + "aws-credential-types", + "aws-runtime", + "aws-smithy-async", + "aws-smithy-http", + "aws-smithy-json", + "aws-smithy-runtime", + "aws-smithy-runtime-api", + "aws-smithy-types", + "aws-types", + "bytes", + "http 0.2.12", + "once_cell", + "regex-lite", + "tracing", +] + +[[package]] +name = "aws-sdk-ssooidc" +version = "1.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d5ce026f0ae73e06b20be5932150dd0e9b063417fd7c3acf5ca97018b9cbd64" +dependencies = [ + "aws-credential-types", + "aws-runtime", + "aws-smithy-async", + "aws-smithy-http", + "aws-smithy-json", + "aws-smithy-runtime", + "aws-smithy-runtime-api", + "aws-smithy-types", + "aws-types", + "bytes", + "http 0.2.12", + "once_cell", + "regex-lite", + "tracing", +] + +[[package]] +name = "aws-sdk-sts" +version = "1.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c820248cb02e4ea83630ad2e43d0721cdbccedba5ac902cd0b6fb84d7271f205" +dependencies = [ + "aws-credential-types", + "aws-runtime", + "aws-smithy-async", + "aws-smithy-http", + "aws-smithy-json", + "aws-smithy-query", + "aws-smithy-runtime", + "aws-smithy-runtime-api", + "aws-smithy-types", + "aws-smithy-xml", + "aws-types", + "http 0.2.12", + "once_cell", + "regex-lite", + "tracing", +] + +[[package]] +name = "aws-sigv4" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31eed8d45759b2c5fe7fd304dd70739060e9e0de509209036eabea14d0720cce" +dependencies = [ + "aws-credential-types", + "aws-smithy-eventstream", + "aws-smithy-http", + "aws-smithy-runtime-api", + "aws-smithy-types", + "bytes", + "crypto-bigint 0.5.5", + "form_urlencoded", + "hex", + "hmac", + "http 0.2.12", + "http 1.1.0", + "once_cell", + "p256", + "percent-encoding", + "ring 0.17.8", + "sha2", + "subtle", + "time", + "tracing", + "zeroize", +] + +[[package]] +name = "aws-smithy-async" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62220bc6e97f946ddd51b5f1361f78996e704677afc518a4ff66b7a72ea1378c" +dependencies = [ + "futures-util", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "aws-smithy-checksums" +version = "0.60.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5b30ea96823b8b25fb6471643a516e1bd475fd5575304e6240aea179f213216" +dependencies = [ + "aws-smithy-http", + "aws-smithy-types", + "bytes", + "crc32c", + "crc32fast", + "hex", + "http 0.2.12", + "http-body 0.4.5", + "md-5", + "pin-project-lite", + "sha1", + "sha2", + "tracing", +] + +[[package]] +name = "aws-smithy-eventstream" +version = "0.60.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6363078f927f612b970edf9d1903ef5cef9a64d1e8423525ebb1f0a1633c858" +dependencies = [ + "aws-smithy-types", + "bytes", + "crc32fast", +] + +[[package]] +name = "aws-smithy-http" +version = "0.60.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a7de001a1b9a25601016d8057ea16e31a45fdca3751304c8edf4ad72e706c08" +dependencies = [ + "aws-smithy-eventstream", + "aws-smithy-runtime-api", + "aws-smithy-types", + "bytes", + "bytes-utils", + "futures-core", + "http 0.2.12", + "http-body 0.4.5", + "once_cell", + "percent-encoding", + "pin-project-lite", + "pin-utils", + "tracing", +] + +[[package]] +name = "aws-smithy-json" +version = "0.60.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4683df9469ef09468dad3473d129960119a0d3593617542b7d52086c8486f2d6" +dependencies = [ + "aws-smithy-types", +] + +[[package]] +name = "aws-smithy-query" +version = "0.60.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2fbd61ceb3fe8a1cb7352e42689cec5335833cd9f94103a61e98f9bb61c64bb" +dependencies = [ + "aws-smithy-types", + "urlencoding", +] + +[[package]] +name = "aws-smithy-runtime" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db83b08939838d18e33b5dbaf1a0f048f28c10bd28071ab7ce6f245451855414" +dependencies = [ + "aws-smithy-async", + "aws-smithy-http", + "aws-smithy-runtime-api", + "aws-smithy-types", + "bytes", + "fastrand 2.1.0", + "h2", + "http 0.2.12", + "http-body 0.4.5", + "http-body 1.0.0", + "httparse", + "hyper", + "hyper-rustls 0.24.2", + "once_cell", + "pin-project-lite", + "pin-utils", + "rustls 0.21.12", + "tokio", + "tracing", +] + +[[package]] +name = "aws-smithy-runtime-api" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b570ea39eb95bd32543f6e4032bce172cb6209b9bc8c83c770d08169e875afc" +dependencies = [ + "aws-smithy-async", + "aws-smithy-types", + "bytes", + "http 0.2.12", + "http 1.1.0", + "pin-project-lite", + "tokio", + "tracing", + "zeroize", +] + +[[package]] +name = "aws-smithy-types" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfe321a6b21f5d8eabd0ade9c55d3d0335f3c3157fc2b3e87f05f34b539e4df5" +dependencies = [ + "base64-simd", + "bytes", + "bytes-utils", + "futures-core", + "http 0.2.12", + "http 1.1.0", + "http-body 0.4.5", + "http-body 1.0.0", + "http-body-util", + "itoa", + "num-integer", + "pin-project-lite", + "pin-utils", + "ryu", + "serde", + "time", + "tokio", + "tokio-util 0.7.4", +] + +[[package]] +name = "aws-smithy-xml" +version = "0.60.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d123fbc2a4adc3c301652ba8e149bf4bc1d1725affb9784eb20c953ace06bf55" +dependencies = [ + "xmlparser", +] + +[[package]] +name = "aws-types" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2009a9733865d0ebf428a314440bbe357cc10d0c16d86a8e15d32e9b47c1e80e" +dependencies = [ + "aws-credential-types", + "aws-smithy-async", + "aws-smithy-runtime-api", + "aws-smithy-types", + "rustc_version", + "tracing", +] + [[package]] name = "axum" version = "0.6.7" @@ -136,8 +534,8 @@ dependencies = [ "bitflags", "bytes", "futures-util", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.5", "hyper", "itoa", "matchit", @@ -163,14 +561,20 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.5", "mime", "rustversion", "tower-layer", "tower-service", ] +[[package]] +name = "base16ct" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" + [[package]] name = "base58" version = "0.2.0" @@ -198,6 +602,16 @@ dependencies = [ "byteorder", ] +[[package]] +name = "base64-simd" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339abbe78e73178762e23bea9dfd08e697eb3f3301cd4be981c0f78ba5859195" +dependencies = [ + "outref", + "vsimd", +] + [[package]] name = "base64ct" version = "1.5.3" @@ -385,7 +799,7 @@ dependencies = [ "futures-core", "futures-util", "hex", - "http", + "http 0.2.12", "hyper", "hyperlocal", "log", @@ -425,15 +839,51 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.2.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" + +[[package]] +name = "bytes-utils" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dafe3a8757b027e2be6e4e5601ed563c55989fcf1546e933c66c8eb3a058d35" +dependencies = [ + "bytes", + "either", +] + +[[package]] +name = "bzip2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] [[package]] name = "cc" -version = "1.0.73" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "c891175c3fb232128f48de6590095e59198bbeb8620c310be349bfc3afd12c7b" +dependencies = [ + "jobserver", + "libc", + "once_cell", +] [[package]] name = "cfg-if" @@ -449,8 +899,10 @@ checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "android-tzdata", "iana-time-zone", + "js-sys", "num-traits", - "windows-targets", + "wasm-bindgen", + "windows-targets 0.48.5", ] [[package]] @@ -505,6 +957,12 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cec318a675afcb6a1ea1d4340e2d377e56e47c266f28043ceccbf4412ddfdd3b" +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + [[package]] name = "cookie" version = "0.16.1" @@ -523,6 +981,16 @@ dependencies = [ "version_check", ] +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.4" @@ -538,6 +1006,24 @@ dependencies = [ "libc", ] +[[package]] +name = "crc32c" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a47af21622d091a8f0fb295b88bc886ac74efcc613efc19f5d0b21de5c89e47" +dependencies = [ + "rustc_version", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + [[package]] name = "cron" version = "0.12.0" @@ -549,6 +1035,34 @@ dependencies = [ "once_cell", ] +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crypto-bigint" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -593,7 +1107,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn", + "syn 1.0.101", ] [[package]] @@ -610,7 +1124,7 @@ checksum = "0b75aed41bb2e6367cae39e6326ef817a851db13c13e4f3263714ca3cfb8de56" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.101", ] [[package]] @@ -634,7 +1148,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn", + "syn 1.0.101", ] [[package]] @@ -645,7 +1159,7 @@ checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" dependencies = [ "darling_core", "quote", - "syn", + "syn 1.0.101", ] [[package]] @@ -689,14 +1203,14 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn", + "syn 1.0.101", ] [[package]] name = "digest" -version = "0.10.5" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "const-oid", @@ -704,34 +1218,99 @@ dependencies = [ "subtle", ] +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + [[package]] name = "dotenv" version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" +[[package]] +name = "ecdsa" +version = "0.14.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" +dependencies = [ + "der", + "elliptic-curve", + "rfc6979", + "signature", +] + [[package]] name = "either" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +[[package]] +name = "elliptic-curve" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" +dependencies = [ + "base16ct", + "crypto-bigint 0.4.9", + "der", + "digest", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "encoding_rs" version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" dependencies = [ - "cfg-if", + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "fastrand" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +dependencies = [ + "instant", ] [[package]] name = "fastrand" -version = "1.8.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" + +[[package]] +name = "ff" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" dependencies = [ - "instant", + "rand_core 0.6.4", + "subtle", ] [[package]] @@ -772,6 +1351,16 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" +[[package]] +name = "flate2" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "fnv" version = "1.0.7" @@ -780,9 +1369,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] @@ -803,9 +1392,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.24" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -813,44 +1402,44 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.24" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-io" -version = "0.3.24" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-macro" -version = "0.3.24" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.68", ] [[package]] name = "futures-sink" -version = "0.3.24" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.24" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.24" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -889,9 +1478,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.7" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -914,19 +1503,30 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +[[package]] +name = "group" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "h2" -version = "0.3.14" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" dependencies = [ "bytes", "fnv", "futures-core", "futures-sink", "futures-util", - "http", - "indexmap", + "http 0.2.12", + "indexmap 2.2.6", "slab", "tokio", "tokio-util 0.7.4", @@ -939,6 +1539,16 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "allocator-api2", +] + [[package]] name = "heck" version = "0.3.3" @@ -995,9 +1605,20 @@ dependencies = [ [[package]] name = "http" -version = "0.2.8" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -1011,7 +1632,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", - "http", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", "pin-project-lite", ] @@ -1035,17 +1679,17 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "hyper" -version = "0.14.20" +version = "0.14.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" +checksum = "f361cde2f109281a220d4307746cdfd5ee3f410da58a70377762396775634b33" dependencies = [ "bytes", "futures-channel", "futures-core", "futures-util", "h2", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.5", "httparse", "httpdate", "itoa", @@ -1063,13 +1707,29 @@ version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" dependencies = [ - "http", + "http 0.2.12", "hyper", "rustls 0.20.8", "tokio", "tokio-rustls 0.23.4", ] +[[package]] +name = "hyper-rustls" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +dependencies = [ + "futures-util", + "http 0.2.12", + "hyper", + "log", + "rustls 0.21.12", + "rustls-native-certs", + "tokio", + "tokio-rustls 0.24.1", +] + [[package]] name = "hyper-timeout" version = "0.4.1" @@ -1119,6 +1779,124 @@ dependencies = [ "cxx-build", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec 1.13.2", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -1127,13 +1905,14 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.2.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de910d521f7cc3135c4de8db1cb910e0b5ed1dc6f57c381cd07e8e661ce10094" +checksum = "44a986806a1cc899952ba462bc1f28afbfd5850ab6cb030ccb20dd02cc527a24" dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", + "icu_normalizer", + "icu_properties", + "smallvec 1.13.2", + "utf8_iter", ] [[package]] @@ -1143,10 +1922,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", "serde", ] +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown 0.14.5", +] + [[package]] name = "inlinable_string" version = "0.1.15" @@ -1192,6 +1981,15 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" +[[package]] +name = "jobserver" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.60" @@ -1239,9 +2037,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.133" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0f80d65747a3e43d1596c7c5492d95d5edddaabd45a7fcdb02b95f644164966" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -1258,6 +2056,12 @@ dependencies = [ "cc", ] +[[package]] +name = "litemap" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" + [[package]] name = "lock_api" version = "0.4.9" @@ -1292,6 +2096,15 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "lru" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" +dependencies = [ + "hashbrown 0.14.5", +] + [[package]] name = "matchers" version = "0.1.0" @@ -1301,12 +2114,6 @@ dependencies = [ "regex-automata", ] -[[package]] -name = "matches" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" - [[package]] name = "matchit" version = "0.7.0" @@ -1319,6 +2126,16 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest", +] + [[package]] name = "memchr" version = "2.5.0" @@ -1337,6 +2154,15 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +[[package]] +name = "miniz_oxide" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +dependencies = [ + "adler", +] + [[package]] name = "mio" version = "0.8.4" @@ -1358,12 +2184,12 @@ dependencies = [ "bytes", "encoding_rs", "futures-util", - "http", + "http 0.2.12", "httparse", "log", "memchr", "mime", - "spin 0.9.4", + "spin 0.9.8", "tokio", "tokio-util 0.7.4", "version_check", @@ -1398,7 +2224,7 @@ dependencies = [ "num-iter", "num-traits", "rand", - "smallvec 1.10.0", + "smallvec 1.13.2", "zeroize", ] @@ -1410,7 +2236,7 @@ checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.101", ] [[package]] @@ -1465,9 +2291,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.15.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "opaque-debug" @@ -1475,6 +2301,29 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "outref" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4030760ffd992bef45b0ae3f10ce1aba99e33464c90d14dd7c039884963ddc7a" + +[[package]] +name = "p256" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51f44edd08f51e2ade572f141051021c5af22677e42b7dd28a88155151c33594" +dependencies = [ + "ecdsa", + "elliptic-curve", + "sha2", +] + [[package]] name = "parking_lot" version = "0.12.1" @@ -1494,10 +2343,33 @@ dependencies = [ "cfg-if", "libc", "redox_syscall", - "smallvec 1.10.0", + "smallvec 1.13.2", "windows-sys 0.36.1", ] +[[package]] +name = "password-hash" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" +dependencies = [ + "base64ct", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest", + "hmac", + "password-hash", + "sha2", +] + [[package]] name = "pear" version = "0.2.3" @@ -1518,7 +2390,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn", + "syn 1.0.101", ] [[package]] @@ -1532,9 +2404,9 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "petgraph" @@ -1543,7 +2415,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7" dependencies = [ "fixedbitset 0.2.0", - "indexmap", + "indexmap 1.9.1", ] [[package]] @@ -1553,7 +2425,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" dependencies = [ "fixedbitset 0.4.2", - "indexmap", + "indexmap 1.9.1", ] [[package]] @@ -1573,7 +2445,7 @@ checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.101", ] [[package]] @@ -1610,6 +2482,12 @@ dependencies = [ "spki", ] +[[package]] +name = "pkg-config" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + [[package]] name = "polyval" version = "0.6.0" @@ -1635,14 +2513,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" dependencies = [ "proc-macro2", - "syn", + "syn 1.0.101", ] [[package]] name = "proc-macro2" -version = "1.0.44" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd7356a8122b6c4a24a82b278680c73357984ca2fc79a0f9fa6dea7dced7c58" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -1655,7 +2533,7 @@ checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.101", "version_check", "yansi", ] @@ -1725,7 +2603,7 @@ dependencies = [ "prost 0.11.0", "prost-types 0.11.2", "regex", - "syn", + "syn 1.0.101", "tempfile", "which", ] @@ -1740,7 +2618,7 @@ dependencies = [ "itertools", "proc-macro2", "quote", - "syn", + "syn 1.0.101", ] [[package]] @@ -1753,7 +2631,7 @@ dependencies = [ "itertools", "proc-macro2", "quote", - "syn", + "syn 1.0.101", ] [[package]] @@ -1766,7 +2644,7 @@ dependencies = [ "itertools", "proc-macro2", "quote", - "syn", + "syn 1.0.101", ] [[package]] @@ -1791,9 +2669,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.21" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -1860,7 +2738,7 @@ checksum = "5234cd6063258a5e32903b53b1b6ac043a0541c8adc1f610f67b0326c7a578fa" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.101", ] [[package]] @@ -1881,6 +2759,12 @@ dependencies = [ "regex-syntax", ] +[[package]] +name = "regex-lite" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53a49587ad06b26609c52e423de037e7f57f20d53535d66e08c695f347df952a" + [[package]] name = "regex-syntax" version = "0.6.27" @@ -1908,10 +2792,10 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.5", "hyper", - "hyper-rustls", + "hyper-rustls 0.23.2", "ipnet", "js-sys", "log", @@ -1935,6 +2819,17 @@ dependencies = [ "winreg", ] +[[package]] +name = "rfc6979" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" +dependencies = [ + "crypto-bigint 0.4.9", + "hmac", + "zeroize", +] + [[package]] name = "ring" version = "0.16.20" @@ -1945,11 +2840,26 @@ dependencies = [ "libc", "once_cell", "spin 0.5.2", - "untrusted", + "untrusted 0.7.1", "web-sys", "winapi", ] +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin 0.9.8", + "untrusted 0.9.0", + "windows-sys 0.52.0", +] + [[package]] name = "rocket" version = "0.5.0-rc.2" @@ -1965,7 +2875,7 @@ dependencies = [ "either", "figment", "futures", - "indexmap", + "indexmap 1.9.1", "log", "memchr", "multer", @@ -1997,11 +2907,11 @@ checksum = "d6aeb6bb9c61e9cd2c00d70ea267bf36f76a4cc615e5908b349c2f9d93999b47" dependencies = [ "devise", "glob", - "indexmap", + "indexmap 1.9.1", "proc-macro2", "quote", "rocket_http", - "syn", + "syn 1.0.101", "unicode-xid", ] @@ -2014,9 +2924,9 @@ dependencies = [ "cookie", "either", "futures", - "http", + "http 0.2.12", "hyper", - "indexmap", + "indexmap 1.9.1", "log", "memchr", "pear", @@ -2024,7 +2934,7 @@ dependencies = [ "pin-project-lite", "ref-cast", "serde", - "smallvec 1.10.0", + "smallvec 1.13.2", "stable-pattern", "state", "time", @@ -2048,11 +2958,20 @@ dependencies = [ "pkcs8", "rand_core 0.6.4", "signature", - "smallvec 1.10.0", + "smallvec 1.13.2", "subtle", "zeroize", ] +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + [[package]] name = "rustls" version = "0.19.1" @@ -2061,7 +2980,7 @@ checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" dependencies = [ "base64 0.13.0", "log", - "ring", + "ring 0.16.20", "sct 0.6.1", "webpki 0.21.4", ] @@ -2073,18 +2992,52 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" dependencies = [ "log", - "ring", + "ring 0.16.20", "sct 0.7.0", "webpki 0.22.0", ] [[package]] -name = "rustls-pemfile" -version = "1.0.1" +name = "rustls" +version = "0.21.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" +dependencies = [ + "log", + "ring 0.17.8", + "rustls-webpki", + "sct 0.7.0", +] + +[[package]] +name = "rustls-native-certs" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" +dependencies = [ + "base64 0.13.0", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "base64 0.13.0", + "ring 0.17.8", + "untrusted 0.9.0", ] [[package]] @@ -2108,6 +3061,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "schannel" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "scoped-tls" version = "1.0.0" @@ -2132,8 +3094,8 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" dependencies = [ - "ring", - "untrusted", + "ring 0.16.20", + "untrusted 0.7.1", ] [[package]] @@ -2142,8 +3104,22 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" dependencies = [ - "ring", - "untrusted", + "ring 0.16.20", + "untrusted 0.7.1", +] + +[[package]] +name = "sec1" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", ] [[package]] @@ -2206,6 +3182,35 @@ dependencies = [ "cc", ] +[[package]] +name = "security-framework" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + [[package]] name = "serde" version = "1.0.145" @@ -2223,7 +3228,7 @@ checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.101", ] [[package]] @@ -2268,7 +3273,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn", + "syn 1.0.101", ] [[package]] @@ -2277,13 +3282,24 @@ version = "0.9.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f82e6c8c047aa50a7328632d067bcae6ef38772a79e28daf32f735e0e4f3dd10" dependencies = [ - "indexmap", + "indexmap 1.9.1", "itoa", "ryu", "serde", "unsafe-libyaml", ] +[[package]] +name = "sha1" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha2" version = "0.10.6" @@ -2356,9 +3372,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.10.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" @@ -2388,6 +3404,8 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", + "aws-config", + "aws-sdk-s3", "base58", "base64 0.13.0", "bcrypt", @@ -2397,6 +3415,7 @@ dependencies = [ "bitcoincore-rpc-json", "bollard", "bollard-stubs", + "chrono", "cln-grpc", "dotenv", "futures-core", @@ -2421,11 +3440,13 @@ dependencies = [ "sphinx-auther", "tar", "thiserror", + "tokio", "tokio-cron-scheduler", "tonic 0.8.3", "tonic_lnd", "url", "walkdir", + "zip", ] [[package]] @@ -2436,9 +3457,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "spin" -version = "0.9.4" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "spki" @@ -2459,6 +3480,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "state" version = "0.5.3" @@ -2476,9 +3503,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "subtle" -version = "2.4.1" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -2491,12 +3518,34 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "2.0.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "sync_wrapper" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + [[package]] name = "tar" version = "0.4.38" @@ -2515,7 +3564,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ "cfg-if", - "fastrand", + "fastrand 1.8.0", "libc", "redox_syscall", "remove_dir_all", @@ -2548,7 +3597,7 @@ checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.101", ] [[package]] @@ -2578,11 +3627,21 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792" +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tokio" -version = "1.21.2" +version = "1.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" +checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64" dependencies = [ "autocfg", "bytes", @@ -2590,11 +3649,12 @@ dependencies = [ "memchr", "mio", "num_cpus", + "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "winapi", + "windows-sys 0.45.0", ] [[package]] @@ -2630,7 +3690,7 @@ checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.101", ] [[package]] @@ -2655,6 +3715,16 @@ dependencies = [ "webpki 0.22.0", ] +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls 0.21.12", + "tokio", +] + [[package]] name = "tokio-stream" version = "0.1.10" @@ -2716,8 +3786,8 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.5", "hyper", "hyper-timeout", "percent-encoding", @@ -2749,8 +3819,8 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.5", "hyper", "hyper-timeout", "percent-encoding", @@ -2778,7 +3848,7 @@ dependencies = [ "proc-macro2", "prost-build 0.8.0", "quote", - "syn", + "syn 1.0.101", ] [[package]] @@ -2791,7 +3861,7 @@ dependencies = [ "proc-macro2", "prost-build 0.11.4", "quote", - "syn", + "syn 1.0.101", ] [[package]] @@ -2818,7 +3888,7 @@ checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ "futures-core", "futures-util", - "indexmap", + "indexmap 1.9.1", "pin-project", "pin-project-lite", "rand", @@ -2840,8 +3910,8 @@ dependencies = [ "bytes", "futures-core", "futures-util", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.5", "http-range-header", "pin-project-lite", "tower", @@ -2863,11 +3933,10 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.36" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "log", "pin-project-lite", "tracing-attributes", @@ -2876,20 +3945,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.22" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.68", ] [[package]] name = "tracing-core" -version = "0.1.29" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -2927,7 +3996,7 @@ dependencies = [ "once_cell", "regex", "sharded-slab", - "smallvec 1.10.0", + "smallvec 1.13.2", "thread_local", "tracing", "tracing-core", @@ -2965,12 +4034,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "unicode-bidi" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" - [[package]] name = "unicode-ident" version = "1.0.4" @@ -3006,9 +4069,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "universal-hash" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d3160b73c9a19f7e2939a2fdad446c57c1bbbbf4d919d3213ff1267a580d8b5" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" dependencies = [ "crypto-common", "subtle", @@ -3026,17 +4089,41 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" -version = "2.3.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22fe195a4f217c25b25cb5058ced57059824a678474874038dc88d211bf508d3" +checksum = "f7c25da092f0a868cdf09e8674cd3b7ef3a7d92a24253e663a2fb85e2496de56" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "uuid" version = "1.4.1" @@ -3058,6 +4145,12 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "vsimd" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" + [[package]] name = "walkdir" version = "2.3.2" @@ -3106,7 +4199,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 1.0.101", "wasm-bindgen-shared", ] @@ -3140,7 +4233,7 @@ checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.101", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3167,8 +4260,8 @@ version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" dependencies = [ - "ring", - "untrusted", + "ring 0.16.20", + "untrusted 0.7.1", ] [[package]] @@ -3177,8 +4270,8 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" dependencies = [ - "ring", - "untrusted", + "ring 0.16.20", + "untrusted 0.7.1", ] [[package]] @@ -3251,7 +4344,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -3273,13 +4366,46 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ - "windows_aarch64_gnullvm 0.42.1", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", - "windows_x86_64_gnullvm 0.42.1", - "windows_x86_64_msvc 0.42.1", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.5", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", ] [[package]] @@ -3297,11 +4423,27 @@ dependencies = [ "windows_x86_64_msvc 0.48.5", ] +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", +] + [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" @@ -3309,6 +4451,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + [[package]] name = "windows_aarch64_msvc" version = "0.32.0" @@ -3323,9 +4471,9 @@ checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" [[package]] name = "windows_aarch64_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" @@ -3333,6 +4481,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + [[package]] name = "windows_i686_gnu" version = "0.32.0" @@ -3347,9 +4501,9 @@ checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" [[package]] name = "windows_i686_gnu" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" @@ -3357,6 +4511,18 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + [[package]] name = "windows_i686_msvc" version = "0.32.0" @@ -3371,9 +4537,9 @@ checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" [[package]] name = "windows_i686_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" @@ -3381,6 +4547,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + [[package]] name = "windows_x86_64_gnu" version = "0.32.0" @@ -3395,9 +4567,9 @@ checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" [[package]] name = "windows_x86_64_gnu" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" @@ -3405,11 +4577,17 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" @@ -3417,6 +4595,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + [[package]] name = "windows_x86_64_msvc" version = "0.32.0" @@ -3431,9 +4615,9 @@ checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" [[package]] name = "windows_x86_64_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" @@ -3441,6 +4625,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" + [[package]] name = "winreg" version = "0.10.1" @@ -3450,6 +4640,18 @@ dependencies = [ "winapi", ] +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "xattr" version = "0.2.3" @@ -3459,14 +4661,156 @@ dependencies = [ "libc", ] +[[package]] +name = "xmlparser" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66fee0b777b0f5ac1c69bb06d361268faafa61cd4682ae064a171c16c433e9e4" + [[package]] name = "yansi" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" +[[package]] +name = "yoke" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "zerofrom" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", + "synstructure", +] + [[package]] name = "zeroize" version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" + +[[package]] +name = "zerovec" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d7fce6acea41ceb5b97f7aee91a5d876d5fbca1f847cb60e13afecd7093cad0" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "zip" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +dependencies = [ + "aes", + "byteorder", + "bzip2", + "constant_time_eq", + "crc32fast", + "crossbeam-utils", + "flate2", + "hmac", + "pbkdf2", + "sha1", + "time", + "zstd", +] + +[[package]] +name = "zstd" +version = "0.11.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "5.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.11+zstd.1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75652c55c0b6f3e6f12eb786fe1bc960396bf05a1eb3bf1f3691c3610ac2e6d4" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/Cargo.toml b/Cargo.toml index 052007be..1402d93c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,6 +52,11 @@ cln-grpc = { git = "https://github.com/stakwork/lightning", rev = "ba0d317e751ee serde_yaml = "0.9" tokio-cron-scheduler = "*" sphinx-auther = { git = "https://github.com/stakwork/sphinx-rs.git", branch = "master" } +zip = "0.6.5" +tokio = { version = "1", features = ["full"] } +aws-config = { version = "1.1.7", features = ["behavior-version-latest"] } +aws-sdk-s3 = "1.38.0" +chrono = "0.4" [lib] name = "sphinx_swarm" diff --git a/second-brain.yml b/second-brain.yml index f7e5530f..937a7997 100644 --- a/second-brain.yml +++ b/second-brain.yml @@ -89,6 +89,7 @@ services: - NAV_BOLTWALL_SHARED_HOST=$NAV_BOLTWALL_SHARED_HOST - SWARM_UPDATER_PASSWORD=$SWARM_UPDATER_PASSWORD - JARVIS_FEATURE_FLAG_SCHEMA=$JARVIS_FEATURE_FLAG_SCHEMA + - BACKUP_KEY=$BACKUP_KEY networks: sphinx-swarm: diff --git a/src/backup.rs b/src/backup.rs index 4bf85a4a..482c976c 100644 --- a/src/backup.rs +++ b/src/backup.rs @@ -1,174 +1,334 @@ -use chrono::Local; -use rocket::tokio::fs; -use rusoto_core::Region; -use rusoto_s3::{ - DeleteObjectsRequest, ListObjectsV2Request, ObjectIdentifier, PutObjectRequest, S3Client, -}; -use std::error::Error; -use std::fs::File; -use std::io::Read; +use crate::config::STATE; +use crate::images::DockerHubImage; +use crate::utils::{domain, getenv}; +use anyhow::{Context, Result}; +use aws_config::meta::region::RegionProviderChain; +use aws_config::Region; +use aws_sdk_s3::primitives::ByteStream; +use aws_sdk_s3::types::{Delete, ObjectIdentifier}; +use aws_sdk_s3::Client; +use bollard::container::DownloadFromContainerOptions; +use bollard::Docker; +use chrono::{DateTime, Duration, Local, NaiveDateTime, Utc}; +use futures_util::stream::TryStreamExt; +use std::fs::{self, File}; +use std::io::Cursor; +use std::io::{Read, Write}; use std::path::PathBuf; +use std::sync::atomic::{AtomicBool, Ordering}; +use tokio::fs::remove_dir_all; +use tokio_cron_scheduler::{Job, JobScheduler}; +use walkdir::WalkDir; +use zip::write::FileOptions; +use zip::CompressionMethod; +use zip::ZipWriter; + +pub static BACK_AND_DELETE: AtomicBool = AtomicBool::new(false); + +pub fn bucket_name() -> String { + getenv("AWS_S3_BUCKET_NAME").unwrap_or("sphinx-swarm".to_string()) +} -pub async fn backup_to_s3( - proxy_path: &str, - relay_path: &str, - bucket: &str, -) -> Result<(), Box> { - let docker = Docker::connect_with_local_defaults()?; - - // Download and zip proxy volume - let proxy_zip_data = - download_and_zip_from_container(&docker, "proxy_container_id", proxy_path).await?; - let proxy_zip_file_name = format!("proxy_data_{}_{}.zip", Local::now().format("%Y%m%d_%H%M%S")); - let proxy_zip_file = PathBuf::from(&proxy_zip_file_name); - fs::write(&proxy_zip_file, proxy_zip_data).await?; +fn backup_retention_days() -> i64 { + match getenv("BACKUP_RETENTION_DAYS") + .unwrap_or("10".to_string()) + .parse() + { + Ok(float_value) => return float_value, + Err(e) => { + log::error!("Unable to parse BACKUP_RETENTION_DAYS: {}", e); + return 10; + } + } +} - // Download and zip relay volume - let relay_zip_data = - download_and_zip_from_container(&docker, "relay_container_id", relay_path).await?; - let relay_zip_file_name = format!("relay_data_{}_{}.zip", Local::now().format("%Y%m%d_%H%M%S")); - let relay_zip_file = PathBuf::from(&relay_zip_file_name); - fs::write(&relay_zip_file, relay_zip_data).await?; +pub async fn backup_containers() -> Result<()> { + let state = STATE.lock().await; + let nodes = state.stack.nodes.clone(); + drop(state); + + let mut containers: Vec<(String, String, String)> = Vec::new(); + + for node in nodes.iter() { + let node_name = node.name(); + let hostname = domain(&node_name); + match node.as_internal() { + Ok(img) => { + let to_backup = vec!["relay", "proxy", "neo4j", "boltwall"]; + if to_backup.contains(&node_name.as_str()) { + containers.push((hostname.clone(), img.repo().root_volume, node_name.clone())) + } + } + Err(_) => (), + } + } - // Upload proxy zip file to S3 - upload_to_s3(&bucket, &proxy_zip_file_name, proxy_zip_file).await?; + let (parent_directory, parent_zip) = download_and_zip_from_container(containers).await?; - // Upload relay zip file to S3 - upload_to_s3(&bucket, &relay_zip_file_name, relay_zip_file).await?; + upload_final_zip_to_s3(parent_directory, parent_zip).await?; Ok(()) } -async fn download_and_zip_from_container( - docker: &Docker, - id: &str, - path: &str, -) -> Result, Box> { - let tar_stream = docker - .download_from_container(id, Some(DownloadFromContainerOptions { path: path.into() })) - .await?; - let mut zip_data = Vec::new(); - let mut zip = zip::ZipWriter::new(std::io::Cursor::new(&mut zip_data)); - - let mut tar = tar::Archive::new(tar_stream); - for entry in tar.entries()? { - let mut entry = entry?; - let path = entry.path()?; - let mut data = Vec::new(); - entry.read_to_end(&mut data)?; - - zip.start_file( - path.to_string_lossy().into_owned(), - zip::write::FileOptions::default(), - )?; - zip.write_all(&data)?; +pub async fn download_and_zip_from_container( + containers: Vec<(String, String, String)>, +) -> Result<(String, String)> { + // Initialize the Docker client + let docker = Docker::connect_with_local_defaults()?; + + // Define the parent directory where all the container volumes will be saved + let parent_directory = getenv("HOST")?; + + // Create the parent directory if it doesn't exist + fs::create_dir_all(&parent_directory)?; + + // Iterate over each container and download its volume + for (container_id, volume_path, sub_directory) in containers { + // Options for downloading the volume + let options = DownloadFromContainerOptions { path: &volume_path }; + + // Stream the tar content from the container + let mut stream = docker.download_from_container(&container_id, Some(options)); + + // Collect the streamed data into a vector + let mut tar_data = Vec::new(); + while let Some(chunk) = stream.try_next().await? { + tar_data.extend(&chunk); + } + + // Create a cursor for the tar data + let tar_cursor = Cursor::new(tar_data); + + // Create a tar archive from the cursor + let mut archive = tar::Archive::new(tar_cursor); + + // Define the subdirectory for the current container + let subdirectory = format!("{}/{}", &parent_directory, &sub_directory); + + // Create the subdirectory if it doesn't exist + fs::create_dir_all(&subdirectory)?; + + // Create a ZIP file to save the content + let zip_file_path = format!("{}/{}.zip", subdirectory, &sub_directory); + let zip_file = File::create(zip_file_path)?; + let mut zip_writer = ZipWriter::new(zip_file); + let options = FileOptions::default().compression_method(zip::CompressionMethod::Stored); + + // Iterate over the entries in the tar archive and write them to the ZIP file + for entry in archive.entries()? { + let mut entry = entry?; + let path = entry.path()?.to_owned(); + + if path.is_dir() { + zip_writer.add_directory(path.to_string_lossy(), options)?; + } else { + zip_writer.start_file(path.to_string_lossy(), options)?; + let mut buffer = Vec::new(); + entry.read_to_end(&mut buffer)?; + zip_writer.write_all(&buffer)?; + } + } + + zip_writer.finish()?; + + log::info!( + "Volume from container {} downloaded and saved as a ZIP file in directory {}", + container_id, + subdirectory + ); } - zip.finish()?; - Ok(zip_data) -} + let current_timestamp = Local::now().format("%Y-%m-%d_%H-%M-%S").to_string(); + let parent_zip = format!("{}_{}.zip", &parent_directory, current_timestamp); -async fn zip_data(data: Vec, name: &str) -> Result> { - let current_time = Local::now(); - let zip_file_name = format!("{}_{}.zip", name, current_time.format("%Y%m%d_%H%M%S")); + zip_directory(&parent_directory, &parent_zip)?; - let mut zip_file = zip::ZipWriter::new(File::create(&zip_file_name)?); - let options = - zip::write::FileOptions::default().compression_method(zip::CompressionMethod::Deflated); + Ok((parent_directory, parent_zip)) +} - zip_file.start_file(name, options)?; - zip_file.write_all(&data)?; +async fn upload_final_zip_to_s3(parent_directory: String, parent_zip: String) -> Result<()> { + let parent_zip_file = PathBuf::from(&parent_zip); + let status = upload_to_s3(&bucket_name(), &parent_zip, parent_zip_file).await?; - Ok(PathBuf::from(zip_file_name)) + if status == true { + let _ = fs::remove_file(parent_zip); + let _ = remove_dir_all(parent_directory).await; + } + Ok(()) } -// Uploads the zip file to S3 -async fn upload_to_s3( - bucket: &str, - zip_file_name: &str, - zip_file: PathBuf, -) -> Result<(), Box> { - let s3_client = S3Client::new(Region::default()); - - let file = File::open(&zip_file)?; - let mut buffer = Vec::new(); - file.read_to_end(&mut buffer)?; - - let key = zip_file_name; - - let request = PutObjectRequest { - bucket: bucket.to_owned(), - key: key.to_owned(), - body: Some(buffer.into()), - ..Default::default() - }; +fn zip_directory(src_dir: &str, zip_file: &str) -> Result<()> { + let file = File::create(zip_file)?; + let mut zip = ZipWriter::new(file); + let options = zip::write::FileOptions::default().compression_method(CompressionMethod::Stored); + + for entry in WalkDir::new(src_dir) { + let entry = entry?; + let path = entry.path(); + let name = path + .strip_prefix(src_dir)? + .to_str() + .context("non-UTF-8 file name")?; + + if path.is_file() { + zip.start_file(name, options)?; + let mut f = File::open(path)?; + let mut buffer = Vec::new(); + f.read_to_end(&mut buffer)?; + zip.write_all(&buffer)?; + } else if path.is_dir() { + zip.add_directory(name, options)?; + } + } - s3_client.put_object(request).await?; + zip.finish()?; Ok(()) } -// Deletes old backups from the S3 bucket -async fn delete_old_backups( - bucket: &str, - prefix: &str, - retention_days: i64, -) -> Result<(), Box> { - let s3_client = S3Client::new(Region::default()); - - let current_time = Local::now(); - let cutoff_time = current_time - chrono::Duration::days(retention_days); - - let list_request = ListObjectsV2Request { - bucket: bucket.to_owned(), - prefix: Some(prefix.to_owned()), - ..Default::default() +// Uploads the zip file to S3 +async fn upload_to_s3(bucket: &str, zip_file_name: &str, zip_file: PathBuf) -> Result { + // Read the custom region environment variable + let region = getenv("AWS_S3_REGION_NAME")?; + + // Create a region provider chain + let region_provider = RegionProviderChain::first_try(Some(Region::new(region))); + + // Load the AWS configuration + let config = aws_config::from_env().region(region_provider).load().await; + let client = Client::new(&config); + + // Read the file into a ByteStream + match ByteStream::from_path(&zip_file).await { + Ok(body) => { + // Prepare the PutObjectRequest + let request = client + .put_object() + .bucket(bucket) + .key(zip_file_name) + .body(body); + + // Send the request + request.send().await?; + return Ok(true); + } + Err(_) => { + log::error!("Error streaming zip file"); + return Ok(false); + } }; +} - let objects = s3_client.list_objects_v2(list_request).await?; - - let objects_to_delete: Vec = objects - .contents - .unwrap_or_default() - .iter() - .filter(|obj| { - obj.last_modified - .as_ref() - .map_or(false, |lm| lm < &cutoff_time) - }) - .map(|obj| ObjectIdentifier { - key: obj.key.clone(), - ..Default::default() - }) - .collect(); - - if !objects_to_delete.is_empty() { - let delete_request = DeleteObjectsRequest { - bucket: bucket.to_owned(), - delete: rusoto_s3::Delete { - objects: objects_to_delete, - ..Default::default() - }, - ..Default::default() - }; - - s3_client.delete_objects(delete_request).await?; - } +// Deletes old backups from the S3 bucket +pub async fn delete_old_backups(bucket: &str, retention_days: i64) -> Result<()> { + // Read the custom region environment variable + let region = getenv("AWS_S3_REGION_NAME")?; - Ok(()) -} + // Create a region provider chain + let region_provider = RegionProviderChain::first_try(Some(Region::new(region))); -async fn test_backup() -> Result<(), Box> { - let bucket = "your-bucket-name"; - let zip_data = vec![1, 2, 3, 4, 5]; // Example data to be zipped + // Load the AWS configuration with the custom region + let config = aws_config::from_env().region(region_provider).load().await; + let client = Client::new(&config); - let zip_file = zip_data(zip_data, "backup_data").await?; - println!("Zip file created: {:?}", zip_file); + let object_prefix = getenv("HOST")?; - upload_to_s3(bucket, "backup_data.zip", zip_file.clone()).await?; - println!("Zip file uploaded to S3"); + // List objects in the bucket + let resp = client + .list_objects_v2() + .bucket(bucket) + .prefix(object_prefix) + .send() + .await?; - delete_old_backups(bucket, "backup_prefix", 30).await?; - println!("Old backups deleted from S3"); + let objects = resp.contents(); + + if objects.len() > 3 { + // Filter objects older than retention_days + let retention_date = Utc::now() - Duration::days(retention_days); + let mut objects_to_delete = Vec::new(); + + for obj in objects { + if let Some(last_modified) = obj.last_modified { + let last_modified_timestamp = last_modified.secs(); + let naive_datetime = NaiveDateTime::from_timestamp_opt(last_modified_timestamp, 0) + .context("Invalid timestamp")?; + let last_modified_chrono: DateTime = + DateTime::from_naive_utc_and_offset(naive_datetime, Utc); + + if last_modified_chrono < retention_date { + if let Some(key) = &obj.key { + let object_identifier_result = ObjectIdentifier::builder().key(key).build(); + match object_identifier_result { + Ok(object_identifier) => { + objects_to_delete.push(object_identifier); + } + Err(_) => { + print!("Could not build object correctly") + } + } + } + } + } + } + + if !objects_to_delete.is_empty() { + // Delete old objects + let delete_request = client + .delete_objects() + .bucket(bucket) + .delete( + Delete::builder() + .set_objects(Some(objects_to_delete)) + .build()?, + ) + .send() + .await?; + + log::info!( + "Deleted {} old objects from bucket {}", + delete_request.deleted().len(), + bucket + ); + } else { + log::info!("No old objects to delete in bucket {}", bucket); + } + } Ok(()) } + +pub async fn backup_and_delete_volumes_cron() -> Result { + log::info!(":backup and delete volumes"); + let sched = JobScheduler::new().await?; + + sched + .add(Job::new_async("@daily", |_uuid, _l| { + Box::pin(async move { + if !BACK_AND_DELETE.load(Ordering::Relaxed) { + BACK_AND_DELETE.store(true, Ordering::Relaxed); + } + }) + })?) + .await?; + + sched.start().await?; + + tokio::spawn(async move { + loop { + let go = BACK_AND_DELETE.load(Ordering::Relaxed); + if go { + if let Err(e) = backup_containers().await { + log::error!("Backup Volumes: {:?}", e); + } + if let Err(e) = delete_old_backups(&bucket_name(), backup_retention_days()).await { + log::error!("Delete Old backup volumes: {:?}", e); + } + + BACK_AND_DELETE.store(false, Ordering::Relaxed); + } + tokio::time::sleep(std::time::Duration::from_secs(10)).await; + } + }); + + Ok(sched) +} diff --git a/src/bin/stack/mod.rs b/src/bin/stack/mod.rs index b8be48fb..593f453d 100644 --- a/src/bin/stack/mod.rs +++ b/src/bin/stack/mod.rs @@ -1,8 +1,10 @@ use anyhow::Result; use rocket::tokio; +use sphinx_swarm::backup::backup_and_delete_volumes_cron; use sphinx_swarm::builder; use sphinx_swarm::config::{load_config_file, put_config_file, Stack}; use sphinx_swarm::handler; +use sphinx_swarm::mount_backedup_volume::delete_zip_and_upzipped_files; use sphinx_swarm::routes; use sphinx_swarm::{dock::*, events, logs, rocket_utils::CmdRequest}; use std::sync::Arc; @@ -46,6 +48,9 @@ async fn main() -> Result<()> { let clients = builder::build_stack(proj, &docker, &stack).await?; put_config_file(proj, &stack).await; + //delete downloaded backup file and folder + let _ = delete_zip_and_upzipped_files().await; + println!("hydrate clients now!"); handler::hydrate_clients(clients).await; @@ -56,6 +61,8 @@ async fn main() -> Result<()> { } } + backup_and_delete_volumes_cron().await?; + tokio::signal::ctrl_c().await?; builder::shutdown_now(); diff --git a/src/builder.rs b/src/builder.rs index 287d4df5..d80ad9e8 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -1,6 +1,8 @@ use crate::config::{self, Clients, Node, Stack, State, STATE}; use crate::dock::*; -use crate::dock::{prune_images, pull_image, stop_and_remove}; +use crate::dock::{ + prune_images, pull_image, restart_container, restore_backup_if_exist, stop_and_remove, +}; use crate::images::{DockerConfig, Image}; use crate::utils::domain; use anyhow::{anyhow, Context, Result}; @@ -52,7 +54,6 @@ pub async fn auto_updater( docker: Docker, node_names: Vec, ) -> Result { - use rocket::tokio; log::info!(":auto_updater"); let sched = JobScheduler::new().await?; // every day at 2 am @@ -160,13 +161,29 @@ pub async fn add_node( // create config let node_config = img.make_config(nodes, docker).await?; // start container - let (new_id, need_to_start) = create_and_init(docker, node_config, skip).await?; + let (new_id, need_to_start, created_new_volume) = + create_and_init(docker, node_config, skip).await?; if need_to_start { let id = new_id.context("new container should have an id")?; if let Err(e) = img.pre_startup(docker).await { log::warn!("pre_startup failed {} {:?}", id, e); } start_container(docker, &id).await?; + if created_new_volume { + // download from s3 if it does not exist already, unzip and copy to volume + let result = restore_backup_if_exist(docker, &node.name()).await; + //restart container + match result { + Ok(status) => { + if status == true { + restart_container(&docker, &id).await?; + } + } + Err(error) => { + log::error!("Error restoring Backup: {}", error) + } + } + } } // post-startup steps (LND unlock) img.post_startup(proj, docker).await?; diff --git a/src/dock.rs b/src/dock.rs index 7474182f..a9a1f424 100644 --- a/src/dock.rs +++ b/src/dock.rs @@ -1,5 +1,6 @@ use std::collections::HashMap; use std::env; +use std::path::Path; // use crate::utils::user; use anyhow::{anyhow, Context, Result}; @@ -19,8 +20,16 @@ use rocket::tokio; use serde::Deserialize; use serde::Serialize; use std::default::Default; +use std::error::Error; +use tokio::io::AsyncReadExt; -use crate::utils::{domain, sleep_ms}; +use crate::backup::bucket_name; +use crate::builder::find_img; +use crate::config::STATE; +use crate::images::DockerHubImage; +use crate::mount_backedup_volume::{create_tar, download_from_s3, unzip_file}; +use crate::utils::{domain, getenv, sleep_ms}; +use tokio::fs::File; pub fn dockr() -> Docker { Docker::connect_with_unix_defaults().unwrap() @@ -34,16 +43,16 @@ pub async fn create_and_init( docker: &Docker, c: Config, skip: bool, -) -> Result<(Option, bool)> { +) -> Result<(Option, bool, bool)> { let hostname = c.hostname.clone().context("expected hostname")?; let current_id = id_by_name(docker, &hostname).await; if skip { log::info!("=> skip {}", &hostname); if let Some(id) = current_id { - return Ok((Some(id), false)); + return Ok((Some(id), false, false)); } else { // dont make the client - return Ok((None, false)); + return Ok((None, false, false)); } } @@ -51,10 +60,10 @@ pub async fn create_and_init( if let Some(id) = current_id { log::info!("=> {} already exists", &hostname); - return Ok((Some(id), false)); + return Ok((Some(id), false, false)); } - create_volume(&docker, &hostname).await?; + let created_new_volume = create_volume(&docker, &hostname).await?; let img_tag = c.image.clone().context("expected image")?; // if it contains a "/" its from the registry @@ -64,7 +73,7 @@ pub async fn create_and_init( } let id = create_container(&docker, c.clone()).await?; log::info!("=> created {}", &hostname); - Ok((Some(id), true)) + Ok((Some(id), true, created_new_volume)) } pub async fn pull_image(docker: &Docker, c: Config) -> Result { @@ -84,10 +93,17 @@ pub async fn create_and_start( c: Config, skip: bool, ) -> Result> { - let (id_opt, need_to_start) = create_and_init(docker, c, skip).await?; + let (id_opt, need_to_start, created_new_volume) = create_and_init(docker, c, skip).await?; if need_to_start { let id = id_opt.clone().unwrap_or("".to_string()); start_container(&docker, &id).await?; + + if created_new_volume { + // download from s3 if it does not exist already, unzip and copy to volume + restore_backup_if_exist(docker, &id).await?; + //restart container + restart_container(&docker, &id).await?; + } } Ok(id_opt) } @@ -134,6 +150,12 @@ pub async fn start_container(docker: &Docker, id: &str) -> Result<()> { Ok(docker.start_container::(id, None).await?) } +pub async fn restart_container(docker: &Docker, id: &str) -> Result<()> { + docker.restart_container(&id, None).await?; + + Ok(()) +} + pub async fn list_containers(docker: &Docker) -> Result> { Ok(docker .list_containers::(Some(ListContainersOptions { @@ -339,9 +361,9 @@ pub async fn sleep(millis: u64) { tokio::time::sleep(tokio::time::Duration::from_millis(millis)).await; } -pub async fn create_volume(docker: &Docker, name: &str) -> Result<()> { +pub async fn create_volume(docker: &Docker, name: &str) -> Result { if let Ok(_v) = docker.inspect_volume(name).await { - return Ok(()); + return Ok(false); } let vconf = CreateVolumeOptions { name: name.to_string(), @@ -354,7 +376,7 @@ pub async fn create_volume(docker: &Docker, name: &str) -> Result<()> { // vconf.driver_opts = driver_opts; // } docker.create_volume(vconf).await?; - Ok(()) + Ok(true) } pub async fn remove_volume(docker: &Docker, name: &str) -> Result<()> { @@ -450,7 +472,7 @@ pub async fn get_container_statistics( } } - println!("==> {:?}", container_stats); + log::info!("==> {:?}", container_stats); Ok(container_stats) } } @@ -514,10 +536,10 @@ pub async fn prune_images(docker: &Docker) { match docker.prune_images(Some(prune_options)).await { Ok(prune_result) => { - println!("Pruned images: {:?}", prune_result); + log::info!("Pruned images: {:?}", prune_result); } Err(e) => { - eprintln!("Error pruning images: {}", e); + log::error!("Error pruning images: {}", e); } } } @@ -551,3 +573,151 @@ impl ContainerStat { } } } + +async fn copy_data_to_volume( + docker: &Docker, + name: &str, + root_volume: &str, + data_path: &str, +) -> Result<(), Box> { + let host = domain(name); + + let temp_root = format!("/temp_{}", &name); + + exec(docker, &host, &format!("mkdir -p {}", &temp_root)).await?; + + // Create a tar file of the data_path + let tar_path = create_tar(data_path)?; + + // Open the tar file + let mut tar_file = File::open(tar_path).await?; + + // Read the tar file into a buffer + let mut buffer = Vec::new(); + tar_file.read_to_end(&mut buffer).await?; + + // Upload the tar file to the container + docker + .upload_to_container( + &host, + Some(UploadToContainerOptions { + path: temp_root.clone(), + ..Default::default() + }), + buffer.into(), + ) + .await?; + + new_exec( + &docker, + &host, + &format!( + "rm -rf {}/* && mv -f {}/* {}", + root_volume, temp_root, root_volume + ), + ) + .await?; + + Ok(()) +} + +fn directory_exists(path: &str) -> bool { + let path = Path::new(path); + path.is_dir() +} + +pub async fn restore_backup_if_exist(docker: &Docker, name: &str) -> Result { + let to_backup = vec!["relay", "proxy", "neo4j", "boltwall"]; + + if to_backup.contains(&name) { + //check if backup s3 link is passed + let state = STATE.lock().await; + + let nodes = state.stack.nodes.clone(); + + drop(state); + + let img = find_img(&name, &nodes)?; + + if let Ok(backup_link) = getenv("BACKUP_KEY") { + let parent_directory = "unzipped"; + let zip_path = format!("{}", &backup_link); + if !directory_exists(&parent_directory) { + let _ = download_from_s3(&bucket_name(), &backup_link, &zip_path).await; + let _ = unzip_file(&zip_path, &parent_directory); + // let _ = unzip_file("tester.zip", &parent_directory); + } else { + log::info!("Directory exist"); + } + + let root_volume = img.repo().root_volume.clone(); + + let outer_dir = get_last_segment(&root_volume); + let data_path = format!("{}/{}/{}", &parent_directory, &name, &outer_dir); + + log::info!("Current Output path: {}", &data_path); + + if directory_exists(&data_path) { + //create temporary container + match copy_data_to_volume(&docker, &name, &root_volume, &data_path).await { + Ok(_) => { + log::info!("Copied data to volume successfully"); + return Ok(true); + } + Err(error) => { + log::error!("Error details: {:?}", error); + log::error!("Error copying data to volume"); + return Ok(false); + } + } + } + } + return Ok(false); + } + return Ok(false); +} + +pub async fn new_exec( + docker: &Docker, + id: &str, + cmd: &str, +) -> Result> { + let txts: Vec<&str> = vec!["sh", "-c", cmd]; + + let exec = docker + .create_exec( + id, + CreateExecOptions { + attach_stdout: Some(true), + attach_stderr: Some(true), + cmd: Some(txts), + ..Default::default() + }, + ) + .await? + .id; + + let started = docker.start_exec(&exec, None).await?; + let mut ret = Vec::new(); + sleep(400).await; + + if let StartExecResults::Attached { mut output, .. } = started { + while let Some(Ok(msg)) = output.next().await { + ret.push(msg.to_string()); + } + } else { + return Err("Failed to attach to the exec instance".into()); + } + + let output = ret.join("\n"); + log::info!("Command output: {}", output); + + Ok(output) +} + +fn get_last_segment(path: &str) -> &str { + match path.rfind('/') { + Some(pos) => &path[pos + 1..], + None => path, + } +} diff --git a/src/images/boltwall.rs b/src/images/boltwall.rs index cd141135..8a44a77e 100644 --- a/src/images/boltwall.rs +++ b/src/images/boltwall.rs @@ -113,6 +113,7 @@ impl DockerHubImage for BoltwallImage { Repository { org: "sphinxlightning".to_string(), repo: "sphinx-boltwall".to_string(), + root_volume: "/boltwall".to_string(), } } } @@ -153,7 +154,7 @@ fn boltwall( let repo = node.repo(); let img = format!("{}/{}", repo.org, repo.repo); let ports = vec![node.port.clone()]; - let root_vol = "/boltwall"; + let root_vol = &repo.root_volume; let mut env = vec![ format!("PORT={}", node.port), diff --git a/src/images/broker.rs b/src/images/broker.rs index 436d9dc8..5883e848 100644 --- a/src/images/broker.rs +++ b/src/images/broker.rs @@ -68,6 +68,7 @@ impl DockerHubImage for BrokerImage { Repository { org: "sphinxlightning".to_string(), repo: "sphinx-broker".to_string(), + root_volume: "/root/.broker".to_string(), } } } @@ -76,7 +77,7 @@ fn broker(img: &BrokerImage) -> Config { let repo = img.repo(); let image = format!("{}/{}", repo.org, repo.repo); - let root_vol = "/root/.broker"; + let root_vol = &repo.root_volume; let mut env = vec![format!("SEED={}", img.seed)]; diff --git a/src/images/btc.rs b/src/images/btc.rs index 0bd1cee7..9105610e 100644 --- a/src/images/btc.rs +++ b/src/images/btc.rs @@ -76,6 +76,7 @@ impl DockerHubImage for BtcImage { Repository { org: "lncm".to_string(), repo: "bitcoind".to_string(), + root_volume: "/data/.bitcoin".to_string(), } } } @@ -91,7 +92,7 @@ pub fn btc(node: &BtcImage) -> Config { // let image = "ruimarinho/bitcoin-core"; let repo = node.repo(); let image = format!("{}/{}", repo.org, repo.repo); - let root_vol = "/data/.bitcoin"; + let root_vol = &repo.root_volume; let mut cmd = vec![ format!("-rpcbind={}", domain(&node.name)), "-rpcallowip=0.0.0.0/0".to_string(), diff --git a/src/images/cache.rs b/src/images/cache.rs index e39782fc..c0659e56 100644 --- a/src/images/cache.rs +++ b/src/images/cache.rs @@ -71,6 +71,7 @@ impl DockerHubImage for CacheImage { Repository { org: "sphinxlightning".to_string(), repo: "sphinx-cache".to_string(), + root_volume: "/cache/data".to_string(), } } } @@ -79,7 +80,7 @@ fn cache(node: &CacheImage, meme_host: &str, mqtt_host: &str, mqtt_port: &str) - let name = node.name.clone(); let repo = node.repo(); let img = format!("{}/{}", repo.org, repo.repo); - let root_vol = "/cache/data"; + let root_vol = &repo.root_volume; let ports = vec![node.port.clone()]; Config { image: Some(format!("{}:{}", img, node.version)), diff --git a/src/images/cln.rs b/src/images/cln.rs index 98fe58ad..64029da2 100644 --- a/src/images/cln.rs +++ b/src/images/cln.rs @@ -162,6 +162,7 @@ impl DockerHubImage for ClnImage { Repository { org: "sphinxlightning".to_string(), repo: "cln-sphinx".to_string(), + root_volume: "/root/.lightning".to_string(), } } } @@ -255,9 +256,9 @@ pub fn hsmd_broker_ports(peer_port: &str) -> Result { fn cln(img: &ClnImage, btc: ClnBtcArgs, lss: Option) -> Config { let mut ports = vec![img.peer_port.clone(), img.grpc_port.clone()]; - let root_vol = "/root/.lightning"; - // let version = "0.2.3"; let repo = img.repo(); + let root_vol = &repo.root_volume; + // let version = "0.2.3"; let image = format!("{}/{}", repo.org, repo.repo); let mut environ = vec![ diff --git a/src/images/config_server.rs b/src/images/config_server.rs index 526f2b1c..03664857 100644 --- a/src/images/config_server.rs +++ b/src/images/config_server.rs @@ -43,6 +43,7 @@ impl DockerHubImage for ConfigImage { Repository { org: "sphinxlightning".to_string(), repo: "sphinx-config".to_string(), + root_volume: "/home".to_string(), } } } @@ -55,7 +56,7 @@ fn config_server(img: &ConfigImage) -> Result> { let repo = img.repo(); let image = format!("{}/{}", repo.org, repo.repo); - let root_vol = "/home"; + let root_vol = &repo.root_volume; let ports = vec![img.port.clone()]; diff --git a/src/images/elastic.rs b/src/images/elastic.rs index 810978b1..54ec9a7c 100644 --- a/src/images/elastic.rs +++ b/src/images/elastic.rs @@ -59,6 +59,7 @@ impl DockerHubImage for ElasticImage { Repository { org: "library".to_string(), repo: "elasticsearch".to_string(), + root_volume: "/data".to_string(), } } } @@ -67,7 +68,7 @@ fn elastic(node: &ElasticImage) -> Config { let name = node.name.clone(); let repo = node.repo(); let img = format!("{}", repo.repo); - let root_vol = "/data"; + let root_vol = &repo.root_volume; let ports = vec![node.http_port.clone()]; let c = Config { diff --git a/src/images/jarvis.rs b/src/images/jarvis.rs index 9748c1a5..ef413774 100644 --- a/src/images/jarvis.rs +++ b/src/images/jarvis.rs @@ -48,6 +48,7 @@ impl DockerHubImage for JarvisImage { Repository { org: "sphinxlightning".to_string(), repo: "sphinx-jarvis-backend".to_string(), + root_volume: "/data/jarvis".to_string(), } } } @@ -61,7 +62,7 @@ fn jarvis( let name = node.name.clone(); let repo = node.repo(); let img = format!("{}/{}", repo.org, repo.repo); - let root_vol = "/data/jarvis"; + let root_vol = &repo.root_volume; let ports = vec![node.port.clone()]; let mut env = vec![ diff --git a/src/images/lnd.rs b/src/images/lnd.rs index 3bccc8e6..4250fa05 100644 --- a/src/images/lnd.rs +++ b/src/images/lnd.rs @@ -92,6 +92,7 @@ impl DockerHubImage for LndImage { Repository { org: "lightninglabs".to_string(), repo: "lnd".to_string(), + root_volume: "/home/.lnd".to_string(), } } } @@ -111,7 +112,7 @@ fn lnd(lnd: &LndImage, btc: &btc::BtcImage) -> Config { let img = format!("{}/{}", repo.org, repo.repo); let mut ports = vec![lnd.peer_port.to_string(), lnd.rpc_port.clone()]; // let home_dir = std::env::var("HOME").unwrap_or("/home".to_string()); - let root_vol = "/home/.lnd"; + let root_vol = &repo.root_volume; // println!("LND LINKS {:?}", links); let btc_domain = domain(&btc.name); let mut cmd = vec![ diff --git a/src/images/lss.rs b/src/images/lss.rs index 94da5fb4..baeb930c 100644 --- a/src/images/lss.rs +++ b/src/images/lss.rs @@ -39,6 +39,7 @@ impl DockerHubImage for LssImage { Repository { org: "sphinxlightning".to_string(), repo: "sphinx-lss".to_string(), + root_volume: "/root/".to_string(), } } } @@ -47,7 +48,7 @@ fn lss(node: &LssImage) -> Config { let name = node.name.clone(); let repo = node.repo(); let img = format!("{}/{}", repo.org, repo.repo); - let root_vol = "/root/"; + let root_vol = &repo.root_volume; let ports = vec![node.port.clone()]; let cmd = vec![ format!("./lssd"), diff --git a/src/images/mixer.rs b/src/images/mixer.rs index d153aaa1..93096aeb 100644 --- a/src/images/mixer.rs +++ b/src/images/mixer.rs @@ -99,6 +99,7 @@ impl DockerHubImage for MixerImage { Repository { org: "sphinxlightning".to_string(), repo: "sphinx-mixer".to_string(), + root_volume: "/home".to_string(), } } } @@ -107,7 +108,7 @@ fn mixer(img: &MixerImage, broker: &BrokerImage, cln: &Option) -> Resu let repo = img.repo(); let image = format!("{}/{}", repo.org, repo.repo); - let root_vol = "/home"; + let root_vol = &repo.root_volume; let ports = vec![img.port.clone()]; diff --git a/src/images/mod.rs b/src/images/mod.rs index d344386e..a9db1b8a 100644 --- a/src/images/mod.rs +++ b/src/images/mod.rs @@ -48,6 +48,7 @@ pub enum Image { pub struct Repository { pub org: String, pub repo: String, + pub root_volume: String, } pub trait DockerHubImage { diff --git a/src/images/navfiber.rs b/src/images/navfiber.rs index a29b6105..43a85a8f 100644 --- a/src/images/navfiber.rs +++ b/src/images/navfiber.rs @@ -48,6 +48,7 @@ impl DockerHubImage for NavFiberImage { Repository { org: "sphinxlightning".to_string(), repo: "sphinx-nav-fiber".to_string(), + root_volume: "/usr/src/app/".to_string(), } } } @@ -56,14 +57,14 @@ fn navfiber(node: &NavFiberImage) -> Config { let name = node.name.clone(); let repo = node.repo(); let img = format!("{}/{}", repo.org, repo.repo); - let root_vol = "/usr/src/app/"; + let root_vol = repo.root_volume; let ports = vec![node.port.clone()]; let mut c = Config { image: Some(format!("{}:{}", img, node.version)), hostname: Some(domain(&name)), exposed_ports: exposed_ports(ports.clone()), - host_config: host_config(&name, ports, root_vol, None, None), + host_config: host_config(&name, ports, &root_vol, None, None), env: None, ..Default::default() }; diff --git a/src/images/neo4j.rs b/src/images/neo4j.rs index 0db23a39..85041f5d 100644 --- a/src/images/neo4j.rs +++ b/src/images/neo4j.rs @@ -90,6 +90,7 @@ impl DockerHubImage for Neo4jImage { Repository { org: "library".to_string(), repo: "neo4j".to_string(), + root_volume: "/data".to_string(), } } } @@ -98,7 +99,7 @@ fn neo4j(node: &Neo4jImage) -> Config { let name = node.name.clone(); let repo = node.repo(); let img = format!("{}", repo.repo); - let root_vol = "/data"; + let root_vol = &repo.root_volume; let ports = vec![node.http_port.clone(), node.bolt_port.clone()]; let c = Config { diff --git a/src/images/proxy.rs b/src/images/proxy.rs index 441e5854..324a642e 100644 --- a/src/images/proxy.rs +++ b/src/images/proxy.rs @@ -84,6 +84,7 @@ impl DockerHubImage for ProxyImage { Repository { org: "sphinxlightning".to_string(), repo: "sphinx-proxy".to_string(), + root_volume: "/app/proxy".to_string(), } } } @@ -98,7 +99,7 @@ fn proxy( let version = proxy.version.clone(); // let img = "sphinx-proxy"; // let version = "latest"; - let root_vol = "/app/proxy"; + let root_vol = &repo.root_volume; let ports = vec![proxy.port.clone(), proxy.admin_port.clone()]; // lnd or proxy uses "mainnet" instead of "bitcoin" diff --git a/src/images/relay.rs b/src/images/relay.rs index a259cc98..732698f2 100644 --- a/src/images/relay.rs +++ b/src/images/relay.rs @@ -85,6 +85,7 @@ impl DockerHubImage for RelayImage { Repository { org: "sphinxlightning".to_string(), repo: "sphinx-relay-swarm".to_string(), + root_volume: "/relay/data".to_string(), } } } @@ -100,7 +101,7 @@ fn relay( let repo = relay.repo(); let img = format!("{}/{}", repo.org, repo.repo); let version = relay.version.clone(); - let root_vol = "/relay/data"; + let root_vol = &repo.root_volume; let mut conf = RelayConfig::new(&relay.name, &relay.port); if let Some(b) = relay.dont_ping_hub { if b { diff --git a/src/images/traefik.rs b/src/images/traefik.rs index 80f7f1a8..c2a86407 100644 --- a/src/images/traefik.rs +++ b/src/images/traefik.rs @@ -25,6 +25,7 @@ impl DockerHubImage for TraefikImage { Repository { org: "".to_string(), repo: "traefik".to_string(), + root_volume: "/data".to_string(), } } } diff --git a/src/images/tribes.rs b/src/images/tribes.rs index 5cd24dea..ffd51649 100644 --- a/src/images/tribes.rs +++ b/src/images/tribes.rs @@ -66,6 +66,7 @@ impl DockerHubImage for TribesImage { Repository { org: "sphinxlightning".to_string(), repo: "sphinx-tribes-v2".to_string(), + root_volume: "/home".to_string(), } } } @@ -74,7 +75,7 @@ fn tribes(img: &TribesImage, broker: &BrokerImage) -> Result> { let repo = img.repo(); let image = format!("{}/{}", repo.org, repo.repo); - let root_vol = "/home"; + let root_vol = &repo.root_volume; let ports = vec![img.port.clone()]; diff --git a/src/lib.rs b/src/lib.rs index acac1e07..126d16f4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,6 @@ pub mod app_login; pub mod auth; -// pub mod backup; +pub mod backup; pub mod builder; pub mod cmd; pub mod config; @@ -12,6 +12,7 @@ pub mod events; pub mod handler; pub mod images; pub mod logs; +pub mod mount_backedup_volume; pub mod rocket_utils; pub mod routes; pub mod rsa; diff --git a/src/mount_backedup_volume.rs b/src/mount_backedup_volume.rs new file mode 100644 index 00000000..50c355a2 --- /dev/null +++ b/src/mount_backedup_volume.rs @@ -0,0 +1,98 @@ +use aws_config::meta::region::RegionProviderChain; +use aws_sdk_s3::config::Region; +use aws_sdk_s3::Client; +use std::error::Error; +use std::fs; +use std::fs::File; +use std::io::Write; +use std::path::Path; +use tar::Builder; +use tokio::fs::remove_dir_all; +use zip::ZipArchive; + +use crate::utils::getenv; + +pub async fn download_from_s3( + bucket: &str, + key: &str, + output_path: &str, +) -> Result<(), Box> { + let region = getenv("AWS_S3_REGION_NAME")?; + + // Create a region provider chain + let region_provider = RegionProviderChain::first_try(Some(Region::new(region))); + + let config = aws_config::from_env().region(region_provider).load().await; + let client = Client::new(&config); + + let resp = client.get_object().bucket(bucket).key(key).send().await?; + + let mut file = File::create(output_path)?; + let data = resp.body.collect().await?; + file.write_all(&data.into_bytes())?; + + Ok(()) +} + +pub fn unzip_file(zip_path: &str, output_dir: &str) -> Result<(), Box> { + let file = File::open(zip_path)?; + let mut archive = ZipArchive::new(file)?; + + for i in 0..archive.len() { + let mut file = archive.by_index(i)?; + let outpath = Path::new(output_dir).join(file.name()); + + if file.name().ends_with('/') { + std::fs::create_dir_all(&outpath)?; + } else { + if let Some(p) = outpath.parent() { + if !p.exists() { + std::fs::create_dir_all(&p)?; + } + } + let mut outfile = File::create(&outpath)?; + std::io::copy(&mut file, &mut outfile)?; + + // Check if the extracted file is a zip file + if outpath.extension().and_then(|e| e.to_str()) == Some("zip") { + // Recursively unzip the nested zip file + unzip_file( + outpath.to_str().unwrap(), + outpath.parent().unwrap().to_str().unwrap(), + )?; + // Optionally, delete the nested zip file after extraction + std::fs::remove_file(outpath)?; + } + } + } + + Ok(()) +} + +pub fn create_tar(data_path: &str) -> Result> { + let tar_path = format!("{}.tar", data_path); + let tar_file = File::create(&tar_path)?; + + let mut tar = Builder::new(tar_file); + + tar.append_dir_all(".", data_path)?; + tar.finish()?; + + Ok(tar_path) +} + +pub async fn delete_zip_and_upzipped_files() -> Result<(), Box> { + let backup_link = getenv("BACKUP_KEY")?; + let unzipped_directory = "unzipped"; + + if Path::new(&backup_link).exists() { + fs::remove_file(&backup_link)?; + } + + // Check if the directory exists before trying to remove it + if Path::new(&unzipped_directory).exists() { + remove_dir_all(unzipped_directory).await?; + } + + Ok(()) +}