diff --git a/.gitignore b/.gitignore index a49c6fc83d..67fc57dcc9 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,8 @@ lib/**/Cargo.lock **/node_modules/ tests/basic-game/.env + + +# Added by cargo + +/target diff --git a/svc/Cargo.lock b/Cargo.lock similarity index 86% rename from svc/Cargo.lock rename to Cargo.lock index c487593289..1458d70afe 100644 --- a/svc/Cargo.lock +++ b/Cargo.lock @@ -20,18 +20,18 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.22.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "ahash" @@ -87,11 +87,79 @@ dependencies = [ "libc", ] +[[package]] +name = "ansi-str" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cf4578926a981ab0ca955dc023541d19de37112bc24c1a197bd806d3d86ad1d" +dependencies = [ + "ansitok", +] + +[[package]] +name = "ansitok" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "220044e6a1bb31ddee4e3db724d29767f352de47445a6cd75e1a173142136c83" +dependencies = [ + "nom", + "vte", +] + +[[package]] +name = "anstream" +version = "0.6.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" + +[[package]] +name = "anstyle-parse" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" [[package]] name = "api-admin" @@ -447,6 +515,7 @@ dependencies = [ "api-helper-macros", "async-trait", "chirp-client", + "chirp-worker", "chirp-workflow", "chrono", "formatted-error", @@ -458,6 +527,7 @@ dependencies = [ "lazy_static", "prost 0.10.4", "regex", + "reqwest 0.11.27", "rivet-api", "rivet-cache", "rivet-claims", @@ -1012,15 +1082,27 @@ checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236" [[package]] name = "arrayref" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "ascii" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" [[package]] name = "async-nats" @@ -1042,7 +1124,7 @@ dependencies = [ "rustls 0.21.12", "rustls-native-certs 0.6.3", "rustls-pemfile 1.0.4", - "rustls-webpki 0.101.7", + "rustls-webpki", "serde", "serde_json", "serde_nanos", @@ -1069,15 +1151,26 @@ dependencies = [ "tokio", ] +[[package]] +name = "async-recursion" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7d78656ba01f1b93024b7c3a0467f1608e4be67d725749fdcd7d2c7678fd7a2" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "async-trait" -version = "0.1.81" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.79", ] [[package]] @@ -1101,11 +1194,31 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "autotools" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef941527c41b0fc0dd48511a8154cd5fc7e29200a0ff8b7203c5d777dbc795cf" +dependencies = [ + "cc", +] [[package]] name = "aws-endpoint" @@ -1193,12 +1306,12 @@ dependencies = [ "bytes", "form_urlencoded", "hex", - "hmac", + "hmac 0.12.1", "http 0.2.12", "once_cell", "percent-encoding", "regex", - "sha2", + "sha2 0.10.8", "time 0.3.36", "tracing", ] @@ -1244,7 +1357,7 @@ dependencies = [ "md-5", "pin-project-lite", "sha1", - "sha2", + "sha2 0.10.8", "tracing", ] @@ -1264,6 +1377,7 @@ dependencies = [ "http-body 0.4.6", "hyper 0.14.30", "hyper-rustls 0.22.1", + "hyper-tls 0.5.0", "lazy_static", "pin-project", "pin-project-lite", @@ -1346,7 +1460,7 @@ dependencies = [ "pin-project-lite", "pin-utils", "tokio", - "tokio-util 0.7.11", + "tokio-util 0.7.12", "tracing", ] @@ -1462,7 +1576,7 @@ dependencies = [ "pin-project-lite", "rustversion", "serde", - "sync_wrapper 0.1.2", + "sync_wrapper", "tower", "tower-layer", "tower-service", @@ -1487,17 +1601,17 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -1574,17 +1688,26 @@ dependencies = [ [[package]] name = "blake3" -version = "1.5.3" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9ec96fe9a81b5e365f9db71fe00edc4fe4ca2cc7dcb7861f0603012a7caa210" +checksum = "d82033247fd8e890df8f740e407ad4d038debb9eb1f40533fffb32e7d17dc6f7" dependencies = [ "arrayref", - "arrayvec", + "arrayvec 0.7.6", "cc", "cfg-if", "constant_time_eq", ] +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + [[package]] name = "block-buffer" version = "0.10.4" @@ -1604,6 +1727,29 @@ dependencies = [ "cipher", ] +[[package]] +name = "bolt" +version = "0.1.0" +dependencies = [ + "anyhow", + "atty", + "bolt-core", + "chrono", + "clap", + "duct", + "json-patch", + "rivet-api", + "rivet-term", + "serde_json", + "serde_plain", + "tabled", + "tempfile", + "tokio", + "toml 0.7.8", + "toml_edit", + "uuid", +] + [[package]] name = "bolt-config" version = "0.1.0" @@ -1617,6 +1763,59 @@ dependencies = [ "uuid", ] +[[package]] +name = "bolt-core" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-posthog", + "async-recursion", + "async-trait", + "base64 0.13.1", + "bolt-config", + "chrono", + "cjson", + "clap", + "colored_json", + "derive_builder", + "duct", + "futures-util", + "handlebars", + "heck 0.3.3", + "hex", + "indexmap 2.6.0", + "indicatif", + "indoc 1.0.9", + "ipnet", + "json-patch", + "lazy_static", + "maplit", + "portpicker", + "prost 0.10.4", + "rand", + "regex", + "reqwest 0.11.27", + "rivet-api", + "rivet-term", + "s3-util", + "serde", + "serde_json", + "serde_yaml", + "sha2 0.10.8", + "sqlx", + "strum 0.26.3", + "tabled", + "tempfile", + "thiserror", + "tokio", + "toml 0.7.8", + "toml_edit", + "url", + "urlencoding", + "uuid", + "wildmatch", +] + [[package]] name = "bstr" version = "1.10.0" @@ -1753,6 +1952,12 @@ version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +[[package]] +name = "bytecount" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce" + [[package]] name = "byteorder" version = "1.5.0" @@ -1761,9 +1966,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.1" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" dependencies = [ "serde", ] @@ -1780,9 +1985,9 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.8" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3054fea8a20d8ff3968d5b22cc27501d2b08dc4decdb31b184323f00c5ef23bb" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" [[package]] name = "captcha-hcaptcha-config-get" @@ -1863,9 +2068,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.12" +version = "1.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68064e60dbf1f17005c2fde4d07c16d8baa506fd7ffed8ccab702d93617975c7" +checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" dependencies = [ "shlex", ] @@ -2173,12 +2378,15 @@ dependencies = [ "rand", "rivet-metrics", "rivet-pools", + "rivet-test-images", "rivet-util", "serde", + "testcontainers", "thiserror", "tokio", - "tokio-util 0.7.11", + "tokio-util 0.7.12", "tracing", + "tracing-subscriber", "types-proto", "urlencoding", "uuid", @@ -2238,8 +2446,10 @@ dependencies = [ "rivet-operation", "rivet-pools", "rivet-runtime", + "rivet-test-images", "rivet-util", "serde_json", + "testcontainers", "thiserror", "tokio", "tracing", @@ -2252,15 +2462,18 @@ dependencies = [ name = "chirp-worker-attributes" version = "0.1.0" dependencies = [ + "chirp-worker", "proc-macro2", + "prost 0.10.4", "quote", - "syn 2.0.74", + "syn 2.0.79", ] [[package]] name = "chirp-workflow" version = "0.1.0" dependencies = [ + "anyhow", "async-trait", "chirp-client", "chirp-workflow-macros", @@ -2286,7 +2499,7 @@ dependencies = [ "strum 0.26.3", "thiserror", "tokio", - "tokio-util 0.7.11", + "tokio-util 0.7.12", "tracing", "tracing-subscriber", "uuid", @@ -2298,7 +2511,7 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.79", ] [[package]] @@ -2316,6 +2529,12 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "chunked_transfer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e4de3bc4ea267985becf712dc6d9eed8b04c953b3fcfb339ebc87acd9804901" + [[package]] name = "cipher" version = "0.4.4" @@ -2338,6 +2557,46 @@ dependencies = [ "serde_json", ] +[[package]] +name = "clap" +version = "4.5.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim 0.11.1", +] + +[[package]] +name = "clap_derive" +version = "4.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "clap_lex" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" + [[package]] name = "clickhouse" version = "0.11.6" @@ -2708,6 +2967,23 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "colorchoice" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" + +[[package]] +name = "colored_json" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35980a1b846f8e3e359fd18099172a0857140ba9230affc4f71348081e039b6" +dependencies = [ + "serde", + "serde_json", + "yansi", +] + [[package]] name = "combine" version = "4.6.7" @@ -2719,7 +2995,20 @@ dependencies = [ "memchr", "pin-project-lite", "tokio", - "tokio-util 0.7.11", + "tokio-util 0.7.12", +] + +[[package]] +name = "console" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" +dependencies = [ + "encode_unicode", + "lazy_static", + "libc", + "unicode-width", + "windows-sys 0.52.0", ] [[package]] @@ -2776,9 +3065,22 @@ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "constant_time_eq" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" + +[[package]] +name = "container-runner" +version = "0.1.0" +dependencies = [ + "anyhow", + "portpicker", + "serde", + "serde_json", + "signal-hook", + "tempfile", + "uuid", +] [[package]] name = "core-foundation" @@ -2798,9 +3100,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] @@ -2903,6 +3205,16 @@ dependencies = [ "typenum", ] +[[package]] +name = "crypto-mac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" +dependencies = [ + "generic-array", + "subtle", +] + [[package]] name = "csv" version = "1.3.0" @@ -2942,7 +3254,7 @@ dependencies = [ "cfg-if", "cpufeatures", "curve25519-dalek-derive", - "digest", + "digest 0.10.7", "fiat-crypto", "rustc_version", "subtle", @@ -2956,7 +3268,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.79", ] [[package]] @@ -2989,14 +3301,38 @@ dependencies = [ "upload-prepare", ] +[[package]] +name = "darling" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" +dependencies = [ + "darling_core 0.14.4", + "darling_macro 0.14.4", +] + [[package]] name = "darling" version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.20.10", + "darling_macro 0.20.10", +] + +[[package]] +name = "darling_core" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.10.0", + "syn 1.0.109", ] [[package]] @@ -3009,8 +3345,19 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim", - "syn 2.0.74", + "strsim 0.11.1", + "syn 2.0.79", +] + +[[package]] +name = "darling_macro" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" +dependencies = [ + "darling_core 0.14.4", + "quote", + "syn 1.0.109", ] [[package]] @@ -3019,9 +3366,9 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "darling_core", + "darling_core 0.20.10", "quote", - "syn 2.0.74", + "syn 2.0.79", ] [[package]] @@ -3079,23 +3426,63 @@ dependencies = [ ] [[package]] -name = "digest" -version = "0.10.7" +name = "derive_builder" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +checksum = "8d67778784b508018359cbc8696edb3db78160bab2c2a28ba7f56ef6932997f8" dependencies = [ - "block-buffer", - "const-oid", - "crypto-common", - "subtle", + "derive_builder_macro", ] [[package]] -name = "dotenvy" -version = "0.15.7" +name = "derive_builder_core" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" - +checksum = "c11bdc11a0c47bc7d37d582b5285da6849c96681023680b906673c5707af7b0f" +dependencies = [ + "darling 0.14.4", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive_builder_macro" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e" +dependencies = [ + "derive_builder_core", + "syn 1.0.109", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "dotenvy" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" + [[package]] name = "ds" version = "0.0.1" @@ -3130,7 +3517,7 @@ dependencies = [ "rand", "regex", "region-get", - "reqwest 0.12.5", + "reqwest 0.12.4", "rivet-api", "rivet-convert", "rivet-health-checks", @@ -3143,7 +3530,7 @@ dependencies = [ "s3-util", "serde", "serde_json", - "sha2", + "sha2 0.10.8", "sqlx", "strum 0.24.1", "tier", @@ -3181,6 +3568,18 @@ dependencies = [ "serde", ] +[[package]] +name = "duct" +version = "0.13.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4ab5718d1224b63252cd0c6f74f6480f9ffeb117438a2e0f5cf6d9a4798929c" +dependencies = [ + "libc", + "once_cell", + "os_pipe", + "shared_child", +] + [[package]] name = "ecdsa" version = "0.16.9" @@ -3188,13 +3587,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der", - "digest", + "digest 0.10.7", "elliptic-curve", "rfc6979", "signature", "spki", ] +[[package]] +name = "echo-server" +version = "0.1.0" +dependencies = [ + "tiny_http", +] + [[package]] name = "ed25519" version = "2.2.3" @@ -3212,7 +3618,7 @@ checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" dependencies = [ "curve25519-dalek", "ed25519", - "sha2", + "sha2 0.10.8", "signature", "subtle", ] @@ -3234,7 +3640,7 @@ checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct", "crypto-bigint", - "digest", + "digest 0.10.7", "ff", "generic-array", "group", @@ -3308,6 +3714,12 @@ dependencies = [ "upload-prepare", ] +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + [[package]] name = "encoding_rs" version = "0.8.34" @@ -3319,14 +3731,14 @@ dependencies = [ [[package]] name = "enum-as-inner" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" dependencies = [ - "heck 0.4.1", + "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.79", ] [[package]] @@ -3580,9 +3992,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "ff" @@ -3600,6 +4012,18 @@ version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" +[[package]] +name = "filetime" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586" +dependencies = [ + "cfg-if", + "libc", + "libredox", + "windows-sys 0.59.0", +] + [[package]] name = "fixedbitset" version = "0.4.2" @@ -3608,9 +4032,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.31" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f211bbe8e69bbd0cfdea405084f128ae8b4aaa6b0b522fc8f2b009084797920" +checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" dependencies = [ "crc32fast", "miniz_oxide", @@ -3677,9 +4101,9 @@ checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -3692,9 +4116,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -3702,15 +4126,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -3730,32 +4154,32 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.79", ] [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-timer" @@ -3765,9 +4189,9 @@ checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -4259,9 +4683,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.29.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "global-error" @@ -4332,18 +4756,18 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.4.0", + "indexmap 2.6.0", "slab", "tokio", - "tokio-util 0.7.11", + "tokio-util 0.7.12", "tracing", ] [[package]] name = "h2" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" dependencies = [ "atomic-waker", "bytes", @@ -4351,13 +4775,27 @@ dependencies = [ "futures-core", "futures-sink", "http 1.1.0", - "indexmap 2.4.0", + "indexmap 2.6.0", "slab", "tokio", - "tokio-util 0.7.11", + "tokio-util 0.7.12", "tracing", ] +[[package]] +name = "handlebars" +version = "4.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faa67bab9ff362228eb3d00bd024a4965d8231bbb7921167f0cfa66c6626b225" +dependencies = [ + "log", + "pest", + "pest_derive", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -4377,6 +4815,12 @@ dependencies = [ "allocator-api2", ] +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" + [[package]] name = "hashlink" version = "0.8.4" @@ -4447,6 +4891,15 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + [[package]] name = "hermit-abi" version = "0.3.9" @@ -4465,7 +4918,17 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" dependencies = [ - "hmac", + "hmac 0.12.1", +] + +[[package]] +name = "hmac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" +dependencies = [ + "crypto-mac", + "digest 0.9.0", ] [[package]] @@ -4474,7 +4937,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] @@ -4555,9 +5018,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.4" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "httpdate" @@ -4604,7 +5067,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.5", + "h2 0.4.6", "http 1.1.0", "http-body 1.0.1", "httparse", @@ -4662,23 +5125,6 @@ dependencies = [ "tokio-rustls 0.24.1", ] -[[package]] -name = "hyper-rustls" -version = "0.27.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" -dependencies = [ - "futures-util", - "http 1.1.0", - "hyper 1.4.1", - "hyper-util", - "rustls 0.23.12", - "rustls-pki-types", - "tokio", - "tokio-rustls 0.26.0", - "tower-service", -] - [[package]] name = "hyper-timeout" version = "0.4.1" @@ -4722,9 +5168,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.7" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" +checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" dependencies = [ "bytes", "futures-channel", @@ -4735,23 +5181,22 @@ dependencies = [ "pin-project-lite", "socket2 0.5.7", "tokio", - "tower", "tower-service", "tracing", ] [[package]] name = "iana-time-zone" -version = "0.1.60" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core", + "windows-core 0.52.0", ] [[package]] @@ -4881,15 +5326,27 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.4.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown 0.15.0", "serde", ] +[[package]] +name = "indicatif" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d207dc617c7a380ab07ff572a6e52fa202a2a8f355860ac9c38e23f8196be1b" +dependencies = [ + "console", + "lazy_static", + "number_prefix", + "regex", +] + [[package]] name = "indoc" version = "1.0.9" @@ -4902,6 +5359,26 @@ version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" +[[package]] +name = "inotify" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" +dependencies = [ + "bitflags 1.3.2", + "inotify-sys", + "libc", +] + +[[package]] +name = "inotify-sys" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" +dependencies = [ + "libc", +] + [[package]] name = "inout" version = "0.1.3" @@ -4949,9 +5426,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.9.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" dependencies = [ "serde", ] @@ -4965,6 +5442,12 @@ dependencies = [ "serde", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + [[package]] name = "itertools" version = "0.10.5" @@ -5087,7 +5570,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sha2", + "sha2 0.10.8", "sqlx", "token-create", "webpki 0.22.4", @@ -5103,6 +5586,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "json-patch" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec9ad60d674508f3ca8f380a928cfe7b096bc729c4e2dbfe3852bc45da3ab30b" +dependencies = [ + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "jsonwebtoken" version = "8.3.0" @@ -5117,6 +5611,26 @@ dependencies = [ "simple_asn1", ] +[[package]] +name = "kqueue" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7447f1ca1b7b563588a205fe93dea8df60fd981423a768bc1c0ded35ed147d0c" +dependencies = [ + "kqueue-sys", + "libc", +] + +[[package]] +name = "kqueue-sys" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b" +dependencies = [ + "bitflags 1.3.2", + "libc", +] + [[package]] name = "kv-config-namespace-create" version = "0.0.1" @@ -5223,9 +5737,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.156" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5f43f184355eefb8d17fc948dbecf6c13be3c141f20d834ae842193a448c72a" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "libm" @@ -5233,6 +5747,17 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags 2.6.0", + "libc", + "redox_syscall 0.5.7", +] + [[package]] name = "libsqlite3-sys" version = "0.27.0" @@ -5260,9 +5785,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.19" +version = "1.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc53a7799a7496ebc9fd29f31f7df80e83c9bda5299768af5f9e59eeea74647" +checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" dependencies = [ "cc", "libc", @@ -5471,19 +5996,18 @@ dependencies = [ [[package]] name = "lz4" -version = "1.26.0" +version = "1.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "958b4caa893816eea05507c20cfe47574a43d9a697138a7872990bba8a0ece68" +checksum = "4d1febb2b4a79ddd1980eede06a8f7902197960aa0383ffcfdd62fe723036725" dependencies = [ - "libc", "lz4-sys", ] [[package]] name = "lz4-sys" -version = "1.10.0" +version = "1.11.1+lz4-1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109de74d5d2353660401699a4174a4ff23fcc649caf553df71933c7fb45ad868" +checksum = "6bd8c0d6c6ed0cd30b3652886bb8711dc4bb01d637a68105a3d5158039b418e6" dependencies = [ "cc", "libc", @@ -5523,7 +6047,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" dependencies = [ "cfg-if", - "digest", + "digest 0.10.7", ] [[package]] @@ -5573,11 +6097,23 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.4" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ - "adler", + "adler2", +] + +[[package]] +name = "mio" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +dependencies = [ + "libc", + "log", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.48.0", ] [[package]] @@ -5586,7 +6122,7 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.9", "libc", "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.52.0", @@ -6248,6 +6784,24 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21" +[[package]] +name = "notify" +version = "6.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d" +dependencies = [ + "bitflags 2.6.0", + "filetime", + "inotify", + "kqueue", + "libc", + "log", + "mio 0.8.11", + "serde", + "walkdir", + "windows-sys 0.48.0", +] + [[package]] name = "nsfw-image-score" version = "0.0.1" @@ -6260,6 +6814,15 @@ dependencies = [ "serde", ] +[[package]] +name = "ntapi" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4" +dependencies = [ + "winapi", +] + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -6342,20 +6905,32 @@ dependencies = [ "libm", ] +[[package]] +name = "number_prefix" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" + [[package]] name = "object" -version = "0.36.3" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "openssl" @@ -6380,7 +6955,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.79", ] [[package]] @@ -6401,6 +6976,16 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "os_pipe" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ffd2b0a5634335b135d5728d84c5e0fd726954b87111f7506a61c502280d982" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "outref" version = "0.1.0" @@ -6422,7 +7007,7 @@ dependencies = [ "ecdsa", "elliptic-curve", "primeorder", - "sha2", + "sha2 0.10.8", ] [[package]] @@ -6434,7 +7019,7 @@ dependencies = [ "ecdsa", "elliptic-curve", "primeorder", - "sha2", + "sha2 0.10.8", ] [[package]] @@ -6448,7 +7033,20 @@ dependencies = [ "elliptic-curve", "primeorder", "rand_core", - "sha2", + "sha2 0.10.8", +] + +[[package]] +name = "papergrid" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7419ad52a7de9b60d33e11085a0fe3df1fbd5926aa3f93d3dd53afbc9e86725" +dependencies = [ + "ansi-str", + "ansitok", + "bytecount", + "fnv", + "unicode-width", ] [[package]] @@ -6494,7 +7092,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.3", + "redox_syscall 0.5.7", "smallvec", "windows-targets 0.52.6", ] @@ -6557,6 +7155,37 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "pegboard-manager" +version = "0.1.0" +dependencies = [ + "anyhow", + "futures-util", + "hyper 0.14.30", + "indoc 2.0.5", + "lazy_static", + "nix", + "notify", + "pegboard", + "portpicker", + "prometheus", + "rand", + "reqwest 0.11.27", + "serde", + "serde_json", + "sqlx", + "sysinfo", + "tempfile", + "tokio", + "tokio-tungstenite 0.23.1", + "tokio-util 0.7.12", + "tracing", + "tracing-logfmt", + "tracing-subscriber", + "url", + "uuid", +] + [[package]] name = "pegboard-ws" version = "0.0.1" @@ -6610,9 +7239,9 @@ dependencies = [ [[package]] name = "pest" -version = "2.7.11" +version = "2.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd53dff83f26735fdc1ca837098ccf133605d794cdae66acfc2bfac3ec809d95" +checksum = "fdbef9d1d47087a895abd220ed25eb4ad973a5e26f6a4367b038c25e28dfc2d9" dependencies = [ "memchr", "thiserror", @@ -6621,9 +7250,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.11" +version = "2.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a548d2beca6773b1c244554d36fcf8548a8a58e74156968211567250e48e49a" +checksum = "4d3a6e3394ec80feb3b6393c725571754c6188490265c61aaf260810d6b95aa0" dependencies = [ "pest", "pest_generator", @@ -6631,26 +7260,26 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.11" +version = "2.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c93a82e8d145725dcbaf44e5ea887c8a869efdcc28706df2d08c69e17077183" +checksum = "94429506bde1ca69d1b5601962c73f4172ab4726571a59ea95931218cb0e930e" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.79", ] [[package]] name = "pest_meta" -version = "2.7.11" +version = "2.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a941429fea7e08bedec25e4f6785b6ffaacc6b755da98df5ef3e7dcf4a124c4f" +checksum = "ac8a071862e93690b6e34e9a5fb8e33ff3734473ac0245b27232222c4906a33f" dependencies = [ "once_cell", "pest", - "sha2", + "sha2 0.10.8", ] [[package]] @@ -6660,27 +7289,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.4.0", + "indexmap 2.6.0", ] [[package]] name = "pin-project" -version = "1.1.5" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +checksum = "baf123a161dde1e524adf36f90bc5d8d3462824a9c43553ad07a8183161189ec" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.5" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +checksum = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.79", ] [[package]] @@ -6718,19 +7347,28 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "portable-atomic" -version = "1.7.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" +checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" [[package]] -name = "posthog-core" -version = "0.1.0" +name = "portpicker" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be97d76faf1bfab666e1375477b23fde79eccf0276e9b63b92a39d676a889ba9" +dependencies = [ + "rand", +] + +[[package]] +name = "posthog-core" +version = "0.1.0" source = "git+https://github.com/rivet-gg/posthog-rs.git?rev=ef4e80e#ef4e80e57747ea7204794bce9a103bfeccefabf1" dependencies = [ "chrono", @@ -6799,9 +7437,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" dependencies = [ "unicode-ident", ] @@ -6921,7 +7559,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.79", ] [[package]] @@ -6958,6 +7596,15 @@ version = "2.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" +[[package]] +name = "protobuf-src" +version = "1.1.0+21.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7ac8852baeb3cc6fb83b93646fb93c0ffe5d14bf138c945ceb4b9948ee0e3c1" +dependencies = [ + "autotools", +] + [[package]] name = "quanta" version = "0.12.3" @@ -6990,9 +7637,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -7029,9 +7676,9 @@ dependencies = [ [[package]] name = "raw-cpuid" -version = "11.1.0" +version = "11.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb9ee317cfe3fbd54b36a511efc1edd42e216903c9cd575e686dd68a2ba90d8d" +checksum = "1ab240315c661615f2ee9f0f2cd32d5a7343a84d5ebcccb99d46e6637565e7b0" dependencies = [ "bitflags 2.6.0", ] @@ -7077,7 +7724,7 @@ dependencies = [ "tokio", "tokio-native-tls", "tokio-retry", - "tokio-util 0.7.11", + "tokio-util 0.7.12", "url", ] @@ -7101,32 +7748,23 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_syscall" -version = "0.5.3" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ "bitflags 2.6.0", ] [[package]] name = "regex" -version = "1.10.6" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", + "regex-automata 0.4.8", + "regex-syntax 0.8.5", ] [[package]] @@ -7140,13 +7778,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", ] [[package]] @@ -7157,9 +7795,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "region-get" @@ -7281,12 +7919,12 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper 0.1.2", + "sync_wrapper", "system-configuration", "tokio", "tokio-native-tls", "tokio-rustls 0.24.1", - "tokio-util 0.7.11", + "tokio-util 0.7.12", "tower-service", "url", "wasm-bindgen", @@ -7299,21 +7937,20 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.5" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" +checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" dependencies = [ "base64 0.22.1", "bytes", "encoding_rs", "futures-core", "futures-util", - "h2 0.4.5", + "h2 0.4.6", "http 1.1.0", "http-body 1.0.1", "http-body-util", "hyper 1.4.1", - "hyper-rustls 0.27.2", "hyper-tls 0.6.0", "hyper-util", "ipnet", @@ -7324,11 +7961,11 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls-pemfile 2.1.3", + "rustls-pemfile 2.2.0", "serde", "serde_json", "serde_urlencoded", - "sync_wrapper 1.0.1", + "sync_wrapper", "system-configuration", "tokio", "tokio-native-tls", @@ -7356,7 +7993,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" dependencies = [ - "hmac", + "hmac 0.12.1", "subtle", ] @@ -7390,6 +8027,43 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rivet" +version = "0.1.0" +dependencies = [ + "anyhow", + "api-internal-monolith", + "api-monolith", + "build-default-create", + "clap", + "cluster-datacenter-tls-renew", + "cluster-default-update", + "cluster-gc", + "cluster-metrics-publish", + "cluster-workflow-backfill", + "global-error", + "job-gc", + "linode-gc", + "load-test-api-cloud", + "load-test-mm", + "load-test-mm-sustain", + "load-test-sqlx", + "load-test-watch-requests", + "mm-gc", + "monolith-worker", + "monolith-workflow-worker", + "nomad-monitor", + "pegboard-dc-init", + "pegboard-gc", + "pegboard-ws", + "telemetry-beacon", + "tokio", + "tracing", + "user-delete-pending", + "workflow-gc", + "workflow-metrics-publish", +] + [[package]] name = "rivet-api" version = "0.0.1" @@ -7434,6 +8108,7 @@ dependencies = [ "lazy_static", "prost 0.10.4", "prost-types 0.10.1", + "rand", "redis", "rivet-cache-result", "rivet-metrics", @@ -7701,7 +8376,7 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.79", ] [[package]] @@ -7722,7 +8397,7 @@ dependencies = [ "sqlx", "thiserror", "tokio", - "tokio-util 0.7.11", + "tokio-util 0.7.12", "tracing", "url", ] @@ -7798,6 +8473,26 @@ dependencies = [ "serde_json", ] +[[package]] +name = "rivet-term" +version = "0.1.0" +source = "git+https://github.com/rivet-gg/rivet-term.git?rev=d539a07d2920d47b88410f20e6d106b497cff1f5#d539a07d2920d47b88410f20e6d106b497cff1f5" +dependencies = [ + "console", + "derive_builder", + "tabled", + "term_size", + "thiserror", + "tokio", +] + +[[package]] +name = "rivet-test-images" +version = "0.1.0" +dependencies = [ + "testcontainers", +] + [[package]] name = "rivet-util" version = "0.1.0" @@ -7805,9 +8500,10 @@ dependencies = [ "async-trait", "bcrypt", "chrono", + "formatted-error", "futures-util", "global-error", - "indexmap 2.4.0", + "indexmap 2.6.0", "ipnet", "lazy_static", "rand", @@ -7907,6 +8603,13 @@ dependencies = [ name = "rivet-util-nsfw" version = "0.1.0" +[[package]] +name = "rivet-util-search" +version = "0.1.0" +dependencies = [ + "uuid", +] + [[package]] name = "rivet-util-team" version = "0.1.0" @@ -7921,14 +8624,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" dependencies = [ "const-oid", - "digest", + "digest 0.10.7", "num-bigint-dig", "num-integer", "num-traits", "pkcs1", "pkcs8", "rand_core", - "sha2", + "sha2 0.10.8", "signature", "spki", "subtle", @@ -7943,18 +8646,18 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ "bitflags 2.6.0", "errno", @@ -7996,25 +8699,10 @@ checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", "ring 0.17.8", - "rustls-webpki 0.101.7", + "rustls-webpki", "sct 0.7.1", ] -[[package]] -name = "rustls" -version = "0.23.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" -dependencies = [ - "log", - "once_cell", - "ring 0.17.8", - "rustls-pki-types", - "rustls-webpki 0.102.6", - "subtle", - "zeroize", -] - [[package]] name = "rustls-native-certs" version = "0.5.0" @@ -8050,19 +8738,18 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" dependencies = [ - "base64 0.22.1", "rustls-pki-types", ] [[package]] name = "rustls-pki-types" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" +checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55" [[package]] name = "rustls-webpki" @@ -8074,17 +8761,6 @@ dependencies = [ "untrusted 0.9.0", ] -[[package]] -name = "rustls-webpki" -version = "0.102.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" -dependencies = [ - "ring 0.17.8", - "rustls-pki-types", - "untrusted 0.9.0", -] - [[package]] name = "rustversion" version = "1.0.17" @@ -8111,13 +8787,22 @@ dependencies = [ "tracing", ] +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + [[package]] name = "schannel" -version = "0.1.23" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -8197,9 +8882,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.1" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" +checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" dependencies = [ "core-foundation-sys", "libc", @@ -8213,9 +8898,9 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.208" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] @@ -8231,13 +8916,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.208" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.79", ] [[package]] @@ -8253,11 +8938,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.125" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ - "indexmap 2.4.0", + "indexmap 2.6.0", "itoa 1.0.11", "memchr", "ryu", @@ -8273,6 +8958,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_plain" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1fc6db65a611022b23a0dec6975d63fb80a302cb3388835ff02c097258d50" +dependencies = [ + "serde", +] + [[package]] name = "serde_repr" version = "0.1.19" @@ -8281,14 +8975,14 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.79", ] [[package]] name = "serde_spanned" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -8327,10 +9021,23 @@ version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" dependencies = [ - "darling", + "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.79", +] + +[[package]] +name = "serde_yaml" +version = "0.9.34+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" +dependencies = [ + "indexmap 2.6.0", + "itoa 1.0.11", + "ryu", + "serde", + "unsafe-libyaml", ] [[package]] @@ -8341,7 +9048,7 @@ checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.7", ] [[package]] @@ -8350,6 +9057,19 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d" +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + [[package]] name = "sha2" version = "0.10.8" @@ -8358,7 +9078,7 @@ checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.7", ] [[package]] @@ -8370,12 +9090,32 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shared_child" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09fa9338aed9a1df411814a5b2252f7cd206c55ae9bf2fa763f8de84603aa60c" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "signal-hook" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" +dependencies = [ + "libc", + "signal-hook-registry", +] + [[package]] name = "signal-hook-registry" version = "1.4.2" @@ -8403,7 +9143,7 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ - "digest", + "digest 0.10.7", "rand_core", ] @@ -8499,9 +9239,9 @@ dependencies = [ [[package]] name = "sqlformat" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f895e3734318cc55f1fe66258926c9b910c124d47520339efecbb6c59cec7c1f" +checksum = "7bba3a93db0cc4f7bdece8bb09e77e2e785c20bfebf79eb8340ed80708048790" dependencies = [ "nom", "unicode_categories", @@ -8540,7 +9280,7 @@ dependencies = [ "futures-util", "hashlink", "hex", - "indexmap 2.4.0", + "indexmap 2.6.0", "ipnetwork", "log", "memchr", @@ -8551,7 +9291,7 @@ dependencies = [ "rand", "serde", "serde_json", - "sha2", + "sha2 0.10.8", "smallvec", "sqlformat", "thiserror", @@ -8588,7 +9328,7 @@ dependencies = [ "quote", "serde", "serde_json", - "sha2", + "sha2 0.10.8", "sqlx-core", "sqlx-mysql", "sqlx-postgres", @@ -8610,7 +9350,7 @@ dependencies = [ "byteorder", "bytes", "crc", - "digest", + "digest 0.10.7", "dotenvy", "either", "futures-channel", @@ -8620,7 +9360,7 @@ dependencies = [ "generic-array", "hex", "hkdf", - "hmac", + "hmac 0.12.1", "itoa 1.0.11", "log", "md-5", @@ -8631,7 +9371,7 @@ dependencies = [ "rsa", "serde", "sha1", - "sha2", + "sha2 0.10.8", "smallvec", "sqlx-core", "stringprep", @@ -8660,7 +9400,7 @@ dependencies = [ "futures-util", "hex", "hkdf", - "hmac", + "hmac 0.12.1", "home", "ipnetwork", "itoa 1.0.11", @@ -8671,7 +9411,7 @@ dependencies = [ "rand", "serde", "serde_json", - "sha2", + "sha2 0.10.8", "smallvec", "sqlx-core", "stringprep", @@ -8722,7 +9462,7 @@ checksum = "eb9242b9ef4108a78e8cd1a2c98e193ef372437f8c22be363075233321dd4a15" dependencies = [ "base64ct", "pem-rfc7468", - "sha2", + "sha2 0.10.8", ] [[package]] @@ -8737,7 +9477,7 @@ dependencies = [ "rand_core", "rsa", "sec1", - "sha2", + "sha2 0.10.8", "signature", "ssh-cipher", "ssh-encoding", @@ -8774,6 +9514,12 @@ dependencies = [ "unicode-properties", ] +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "strsim" version = "0.11.1" @@ -8827,7 +9573,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.74", + "syn 2.0.79", ] [[package]] @@ -8840,14 +9586,14 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.74", + "syn 2.0.79", ] [[package]] name = "subtle" -version = "2.6.1" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" @@ -8862,9 +9608,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.74" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fceb41e3d546d0bd83421d3409b1460cc7444cd389341a4c880fe7a042cb3d7" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -8878,10 +9624,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] -name = "sync_wrapper" -version = "1.0.1" +name = "sysinfo" +version = "0.31.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +checksum = "355dbe4f8799b304b05e1b0f05fc59b2a18d36645cf169607da45bde2f69a1be" +dependencies = [ + "core-foundation-sys", + "libc", + "memchr", + "ntapi", + "rayon", + "windows", +] [[package]] name = "system-configuration" @@ -8904,6 +9658,31 @@ dependencies = [ "libc", ] +[[package]] +name = "tabled" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c9303ee60b9bedf722012ea29ae3711ba13a67c9b9ae28993838b63057cb1b" +dependencies = [ + "ansi-str", + "ansitok", + "papergrid", + "tabled_derive", +] + +[[package]] +name = "tabled_derive" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf0fb8bfdc709786c154e24a66777493fb63ae97e3036d914c8666774c477069" +dependencies = [ + "heck 0.4.1", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "team-avatar-upload-complete" version = "0.0.1" @@ -9151,35 +9930,60 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" dependencies = [ "cfg-if", - "fastrand 2.1.0", + "fastrand 2.1.1", "once_cell", "rustix", "windows-sys 0.59.0", ] +[[package]] +name = "term_size" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "testcontainers" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5e3ed6e3598dbf32cba8cb356b881c085e0adea57597f387723430dd94b4084" +dependencies = [ + "hex", + "hmac 0.10.1", + "log", + "rand", + "serde", + "serde_json", + "sha2 0.9.9", +] + [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.79", ] [[package]] @@ -9244,6 +10048,18 @@ dependencies = [ "time-core", ] +[[package]] +name = "tiny_http" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389915df6413a2e74fb181895f933386023c71110878cd0825588928e64cdc82" +dependencies = [ + "ascii", + "chunked_transfer", + "httpdate", + "log", +] + [[package]] name = "tinyvec" version = "1.8.0" @@ -9316,14 +10132,14 @@ dependencies = [ [[package]] name = "tokio" -version = "1.39.2" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" dependencies = [ "backtrace", "bytes", "libc", - "mio", + "mio 1.0.2", "parking_lot 0.12.3", "pin-project-lite", "signal-hook-registry", @@ -9351,7 +10167,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.79", ] [[package]] @@ -9407,22 +10223,11 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-rustls" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" -dependencies = [ - "rustls 0.23.12", - "rustls-pki-types", - "tokio", -] - [[package]] name = "tokio-stream" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" dependencies = [ "futures-core", "pin-project-lite", @@ -9471,9 +10276,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", @@ -9518,7 +10323,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.4.0", + "indexmap 2.6.0", "serde", "serde_spanned", "toml_datetime", @@ -9567,7 +10372,7 @@ dependencies = [ "rand", "slab", "tokio", - "tokio-util 0.7.11", + "tokio-util 0.7.12", "tower-layer", "tower-service", "tracing", @@ -9605,7 +10410,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.79", ] [[package]] @@ -9804,6 +10609,7 @@ dependencies = [ "heck 0.3.3", "indoc 1.0.9", "prost-build", + "protobuf-src", "regex", "schemac", "serde", @@ -9812,9 +10618,9 @@ dependencies = [ [[package]] name = "ucd-trie" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] name = "unicase" @@ -9827,36 +10633,42 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] [[package]] name = "unicode-properties" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4259d9d4425d9f0661581b804cb85fe66a4c631cadd8f490d1c13a35d5d9291" +checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" [[package]] name = "unicode-segmentation" -version = "1.11.0" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[package]] +name = "unicode-width" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] name = "unicode_categories" @@ -9864,6 +10676,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + [[package]] name = "untrusted" version = "0.7.1" @@ -9960,27 +10778,6 @@ dependencies = [ "upload-get", ] -[[package]] -name = "upload-provider-fill" -version = "0.0.1" -dependencies = [ - "chirp-client", - "chirp-worker", - "futures-util", - "indoc 1.0.9", - "prost 0.10.4", - "reqwest 0.11.27", - "rivet-connection", - "rivet-operation", - "rivet-pools", - "s3-util", - "sqlx", - "tokio", - "tracing", - "tracing-logfmt", - "tracing-subscriber", -] - [[package]] name = "upload-worker" version = "0.0.1" @@ -9998,18 +10795,18 @@ dependencies = [ [[package]] name = "ureq" -version = "2.10.1" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a" +checksum = "f8cdd25c339e200129fe4de81451814e5228c9b771d57378817d6117cc2b3f97" dependencies = [ - "base64 0.22.1", + "base64 0.21.7", "flate2", "log", "once_cell", - "rustls 0.23.12", - "rustls-pki-types", + "rustls 0.21.12", + "rustls-webpki", "url", - "webpki-roots 0.26.3", + "webpki-roots 0.25.4", ] [[package]] @@ -10302,28 +11099,6 @@ dependencies = [ "user-identity-create", ] -[[package]] -name = "user-search-user-gc" -version = "0.0.1" -dependencies = [ - "chirp-client", - "chirp-worker", - "chrono", - "futures-util", - "indoc 1.0.9", - "lazy_static", - "prost 0.10.4", - "rivet-connection", - "rivet-operation", - "rivet-runtime", - "tokio", - "tracing", - "tracing-logfmt", - "tracing-subscriber", - "user-follow-count", - "user-identity-get", -] - [[package]] name = "user-team-list" version = "0.0.1" @@ -10381,6 +11156,12 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "uuid" version = "1.10.0" @@ -10409,6 +11190,37 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "vte" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cbce692ab4ca2f1f3047fcf732430249c0e971bfdd2b234cf2c47ad93af5983" +dependencies = [ + "arrayvec 0.5.2", + "utf8parse", + "vte_generate_state_changes", +] + +[[package]] +name = "vte_generate_state_changes" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e369bee1b05d510a7b4ed645f5faa90619e05437111783ea5848f28d97d3c2e" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "want" version = "0.3.1" @@ -10458,7 +11270,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.79", "wasm-bindgen-shared", ] @@ -10492,7 +11304,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.79", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -10505,9 +11317,9 @@ checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" [[package]] name = "wasm-streams" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129" +checksum = "4e072d4e72f700fb3443d8fe94a39315df013eef1104903cdb0a2abd322bbecd" dependencies = [ "futures-util", "js-sys", @@ -10561,15 +11373,6 @@ version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" -[[package]] -name = "webpki-roots" -version = "0.26.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" -dependencies = [ - "rustls-pki-types", -] - [[package]] name = "which" version = "4.4.2" @@ -10584,11 +11387,11 @@ dependencies = [ [[package]] name = "whoami" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9" +checksum = "372d5b87f58ec45c384ba03563b03544dc5fadc3983e434b286913f5b4a9bb6d" dependencies = [ - "redox_syscall 0.4.1", + "redox_syscall 0.5.7", "wasite", ] @@ -10598,6 +11401,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" +[[package]] +name = "wildmatch" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68ce1ab1f8c62655ebe1350f589c61e505cf94d385bc6a12899442d9081e71fd" + [[package]] name = "winapi" version = "0.3.9" @@ -10614,12 +11423,31 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys 0.59.0", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143" +dependencies = [ + "windows-core 0.57.0", + "windows-targets 0.52.6", +] + [[package]] name = "windows-core" version = "0.52.0" @@ -10629,6 +11457,49 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-core" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-result", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-implement" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "windows-interface" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "windows-result" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -10856,6 +11727,12 @@ dependencies = [ "hashlink", ] +[[package]] +name = "yansi" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" + [[package]] name = "zerocopy" version = "0.7.35" @@ -10874,7 +11751,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.79", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000000..aa210e0d00 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,376 @@ +[package] +name = "rivet" +version = "0.1.0" +edition = "2021" +license = "Apache-2.0" + +[dependencies] +# Dependencies +anyhow = "1.0" +tokio = { version = "1.29", features = ["full", "tracing"] } +global-error = { path = "lib/global-error" } +tracing = "0.1" +clap = { version = "4.3", features = ["derive"] } + + # Standalone +cluster-datacenter-tls-renew = { path = "svc/pkg/cluster/standalone/datacenter-tls-renew", optional = true } +cluster-gc = { path = "svc/pkg/cluster/standalone/gc", optional = true } +cluster-metrics-publish = { path = "svc/pkg/cluster/standalone/metrics-publish", optional = true } +job-gc = { path = "svc/pkg/job/standalone/gc", optional = true } +linode-gc = { path = "svc/pkg/linode/standalone/gc", optional = true } +load-test-api-cloud = { path = "svc/pkg/load-test/standalone/api-cloud", optional = true } +load-test-mm = { path = "svc/pkg/load-test/standalone/mm", optional = true } +load-test-mm-sustain = { path = "svc/pkg/load-test/standalone/mm-sustain", optional = true } +load-test-sqlx = { path = "svc/pkg/load-test/standalone/sqlx", optional = true } +load-test-watch-requests = { path = "svc/pkg/load-test/standalone/watch-requests", optional = true } +mm-gc = { path = "svc/pkg/mm/standalone/gc", optional = true } +monolith-worker = { path = "svc/pkg/monolith/standalone/worker", optional = true } +monolith-workflow-worker = { path = "svc/pkg/monolith/standalone/workflow-worker", optional = true } +nomad-monitor = { path = "svc/pkg/nomad/standalone/monitor", optional = true } +pegboard-gc = { path = "svc/pkg/pegboard/standalone/gc", optional = true } +pegboard-ws = { path = "svc/pkg/pegboard/standalone/ws", optional = true } +workflow-gc = { path = "svc/pkg/workflow/standalone/gc", optional = true } +workflow-metrics-publish = { path = "svc/pkg/workflow/standalone/metrics-publish", optional = true } + +# Cron +telemetry-beacon = { path = "svc/pkg/telemetry/standalone/beacon", optional = true } +user-delete-pending = { path = "svc/pkg/user/standalone/delete-pending", optional = true } + +# API +api-internal-monolith = { path = "svc/api/internal-monolith", optional = true } +api-monolith = { path = "svc/api/monolith", optional = true } + +# Oneshot +build-default-create = { path = "svc/pkg/build/standalone/default-create", optional = true } +cluster-default-update = { path = "svc/pkg/cluster/standalone/default-update", optional = true } +cluster-workflow-backfill = { path = "svc/pkg/cluster/standalone/workflow-backfill", optional = true } +pegboard-dc-init = { path = "svc/pkg/pegboard/standalone/dc-init", optional = true } + +[features] +default = ["standalone", "cron", "api-internal", "api", "oneshot"] +standalone = [ + "cluster-datacenter-tls-renew", + "cluster-gc", + "cluster-metrics-publish", + "cluster-metrics-publish", + "job-gc", + "job-gc", + "linode-gc", + "load-test-api-cloud", + "load-test-mm", + "load-test-mm-sustain", + "load-test-sqlx", + "load-test-watch-requests", + "mm-gc", + "monolith-worker", + "monolith-workflow-worker", + "nomad-monitor", + "pegboard-gc", + "pegboard-ws", + "user-delete-pending", + "workflow-gc", + "workflow-metrics-publish", + "workflow-metrics-publish", +] +cron = [ + "user-delete-pending", + "telemetry-beacon", +] +api-internal = [ + "api-internal-monolith", +] +api = [ + "api-monolith" +] +oneshot = [ + "build-default-create", + "cluster-default-update", + "cluster-workflow-backfill", + "pegboard-dc-init", +] + +[workspace] +resolver = "2" +members = [ + # Services + "svc/api/admin", + "svc/api/auth", + "svc/api/cf-verification", + "svc/api/cloud", + "svc/api/games", + "svc/api/group", + "svc/api/identity", + "svc/api/internal-monolith", + "svc/api/job", + "svc/api/kv", + "svc/api/matchmaker", + "svc/api/monolith", + "svc/api/portal", + "svc/api/provision", + "svc/api/servers", + "svc/api/status", + "svc/api/traefik-provider", + "svc/pkg/build", + "svc/pkg/build/standalone/default-create", + "svc/pkg/captcha/ops/hcaptcha-config-get", + "svc/pkg/captcha/ops/hcaptcha-verify", + "svc/pkg/captcha/ops/request", + "svc/pkg/captcha/ops/turnstile-config-get", + "svc/pkg/captcha/ops/turnstile-verify", + "svc/pkg/captcha/ops/verify", + "svc/pkg/cdn/ops/namespace-auth-user-remove", + "svc/pkg/cdn/ops/namespace-auth-user-update", + "svc/pkg/cdn/ops/namespace-create", + "svc/pkg/cdn/ops/namespace-domain-create", + "svc/pkg/cdn/ops/namespace-domain-remove", + "svc/pkg/cdn/ops/namespace-get", + "svc/pkg/cdn/ops/namespace-resolve-domain", + "svc/pkg/cdn/ops/ns-auth-type-set", + "svc/pkg/cdn/ops/ns-enable-domain-public-auth-set", + "svc/pkg/cdn/ops/site-create", + "svc/pkg/cdn/ops/site-get", + "svc/pkg/cdn/ops/site-list-for-game", + "svc/pkg/cdn/ops/version-get", + "svc/pkg/cdn/ops/version-prepare", + "svc/pkg/cdn/ops/version-publish", + "svc/pkg/cdn/worker", + "svc/pkg/cf-custom-hostname/ops/get", + "svc/pkg/cf-custom-hostname/ops/list-for-namespace-id", + "svc/pkg/cf-custom-hostname/ops/resolve-hostname", + "svc/pkg/cf-custom-hostname/worker", + "svc/pkg/cloud/ops/device-link-create", + "svc/pkg/cloud/ops/game-config-create", + "svc/pkg/cloud/ops/game-config-get", + "svc/pkg/cloud/ops/game-token-create", + "svc/pkg/cloud/ops/namespace-create", + "svc/pkg/cloud/ops/namespace-get", + "svc/pkg/cloud/ops/namespace-token-development-create", + "svc/pkg/cloud/ops/namespace-token-public-create", + "svc/pkg/cloud/ops/version-get", + "svc/pkg/cloud/ops/version-publish", + "svc/pkg/cloud/worker", + "svc/pkg/cluster", + "svc/pkg/cluster/standalone/datacenter-tls-renew", + "svc/pkg/cluster/standalone/default-update", + "svc/pkg/cluster/standalone/gc", + "svc/pkg/cluster/standalone/metrics-publish", + "svc/pkg/cluster/standalone/workflow-backfill", + "svc/pkg/custom-user-avatar/ops/list-for-game", + "svc/pkg/custom-user-avatar/ops/upload-complete", + "svc/pkg/debug/ops/email-res", + "svc/pkg/ds", + "svc/pkg/ds-log/ops/export", + "svc/pkg/ds-log/ops/read", + "svc/pkg/email-verification/ops/complete", + "svc/pkg/email-verification/ops/create", + "svc/pkg/email/ops/send", + "svc/pkg/external/ops/request-validate", + "svc/pkg/external/worker", + "svc/pkg/faker/ops/build", + "svc/pkg/faker/ops/cdn-site", + "svc/pkg/faker/ops/game", + "svc/pkg/faker/ops/game-namespace", + "svc/pkg/faker/ops/game-version", + "svc/pkg/faker/ops/job-run", + "svc/pkg/faker/ops/job-template", + "svc/pkg/faker/ops/mm-lobby", + "svc/pkg/faker/ops/mm-lobby-row", + "svc/pkg/faker/ops/mm-player", + "svc/pkg/faker/ops/region", + "svc/pkg/faker/ops/team", + "svc/pkg/faker/ops/user", + "svc/pkg/game-node", + "svc/pkg/game-user/ops/create", + "svc/pkg/game-user/ops/get", + "svc/pkg/game-user/ops/link-create", + "svc/pkg/game-user/ops/link-get", + "svc/pkg/game-user/ops/list-for-user", + "svc/pkg/game-user/ops/recent-session-list", + "svc/pkg/game-user/ops/recommend", + "svc/pkg/game-user/worker", + "svc/pkg/game/ops/banner-upload-complete", + "svc/pkg/game/ops/create", + "svc/pkg/game/ops/get", + "svc/pkg/game/ops/list-all", + "svc/pkg/game/ops/list-for-team", + "svc/pkg/game/ops/logo-upload-complete", + "svc/pkg/game/ops/namespace-create", + "svc/pkg/game/ops/namespace-get", + "svc/pkg/game/ops/namespace-list", + "svc/pkg/game/ops/namespace-resolve-name-id", + "svc/pkg/game/ops/namespace-resolve-url", + "svc/pkg/game/ops/namespace-validate", + "svc/pkg/game/ops/namespace-version-history-list", + "svc/pkg/game/ops/namespace-version-set", + "svc/pkg/game/ops/recommend", + "svc/pkg/game/ops/resolve-name-id", + "svc/pkg/game/ops/resolve-namespace-id", + "svc/pkg/game/ops/token-development-validate", + "svc/pkg/game/ops/validate", + "svc/pkg/game/ops/version-create", + "svc/pkg/game/ops/version-get", + "svc/pkg/game/ops/version-list", + "svc/pkg/game/ops/version-validate", + "svc/pkg/identity-config/ops/namespace-create", + "svc/pkg/identity-config/ops/namespace-get", + "svc/pkg/identity-config/ops/version-get", + "svc/pkg/identity-config/ops/version-prepare", + "svc/pkg/identity-config/ops/version-publish", + "svc/pkg/ip/ops/info", + "svc/pkg/job-log/ops/read", + "svc/pkg/job-log/worker", + "svc/pkg/job-run", + "svc/pkg/job/standalone/gc", + "svc/pkg/kv-config/ops/namespace-create", + "svc/pkg/kv-config/ops/namespace-get", + "svc/pkg/kv-config/ops/version-get", + "svc/pkg/kv-config/ops/version-prepare", + "svc/pkg/kv-config/ops/version-publish", + "svc/pkg/kv/ops/get", + "svc/pkg/kv/ops/list", + "svc/pkg/kv/worker", + "svc/pkg/linode", + "svc/pkg/linode/standalone/gc", + "svc/pkg/load-test/standalone/api-cloud", + "svc/pkg/load-test/standalone/mm", + "svc/pkg/load-test/standalone/mm-sustain", + "svc/pkg/load-test/standalone/sqlx", + "svc/pkg/load-test/standalone/watch-requests", + "svc/pkg/mm-config/ops/game-get", + "svc/pkg/mm-config/ops/game-upsert", + "svc/pkg/mm-config/ops/lobby-group-get", + "svc/pkg/mm-config/ops/lobby-group-resolve-name-id", + "svc/pkg/mm-config/ops/lobby-group-resolve-version", + "svc/pkg/mm-config/ops/namespace-config-set", + "svc/pkg/mm-config/ops/namespace-config-validate", + "svc/pkg/mm-config/ops/namespace-create", + "svc/pkg/mm-config/ops/namespace-get", + "svc/pkg/mm-config/ops/version-get", + "svc/pkg/mm-config/ops/version-prepare", + "svc/pkg/mm-config/ops/version-publish", + "svc/pkg/mm/ops/dev-player-token-create", + "svc/pkg/mm/ops/lobby-find-fail", + "svc/pkg/mm/ops/lobby-find-lobby-query-list", + "svc/pkg/mm/ops/lobby-find-try-complete", + "svc/pkg/mm/ops/lobby-for-run-id", + "svc/pkg/mm/ops/lobby-get", + "svc/pkg/mm/ops/lobby-history", + "svc/pkg/mm/ops/lobby-idle-update", + "svc/pkg/mm/ops/lobby-list-for-namespace", + "svc/pkg/mm/ops/lobby-list-for-user-id", + "svc/pkg/mm/ops/lobby-player-count", + "svc/pkg/mm/ops/lobby-runtime-aggregate", + "svc/pkg/mm/ops/lobby-state-get", + "svc/pkg/mm/ops/player-count-for-namespace", + "svc/pkg/mm/ops/player-get", + "svc/pkg/mm/standalone/gc", + "svc/pkg/mm/worker", + "svc/pkg/monolith/standalone/worker", + "svc/pkg/monolith/standalone/workflow-worker", + "svc/pkg/nomad/standalone/monitor", + "svc/pkg/nsfw/ops/image-score", + "svc/pkg/pegboard", + "svc/pkg/pegboard/standalone/dc-init", + "svc/pkg/pegboard/standalone/gc", + "svc/pkg/pegboard/standalone/ws", + "svc/pkg/perf/ops/log-get", + "svc/pkg/profanity/ops/check", + "svc/pkg/region/ops/get", + "svc/pkg/region/ops/list", + "svc/pkg/region/ops/list-for-game", + "svc/pkg/region/ops/recommend", + "svc/pkg/region/ops/resolve", + "svc/pkg/region/ops/resolve-for-game", + "svc/pkg/team-invite/ops/get", + "svc/pkg/team-invite/worker", + "svc/pkg/team/ops/avatar-upload-complete", + "svc/pkg/team/ops/get", + "svc/pkg/team/ops/join-request-list", + "svc/pkg/team/ops/member-count", + "svc/pkg/team/ops/member-get", + "svc/pkg/team/ops/member-list", + "svc/pkg/team/ops/member-relationship-get", + "svc/pkg/team/ops/profile-validate", + "svc/pkg/team/ops/recommend", + "svc/pkg/team/ops/resolve-display-name", + "svc/pkg/team/ops/search", + "svc/pkg/team/ops/user-ban-get", + "svc/pkg/team/ops/user-ban-list", + "svc/pkg/team/ops/validate", + "svc/pkg/team/worker", + "svc/pkg/telemetry/standalone/beacon", + "svc/pkg/tier", + "svc/pkg/token/ops/create", + "svc/pkg/token/ops/exchange", + "svc/pkg/token/ops/get", + "svc/pkg/token/ops/revoke", + "svc/pkg/upload/ops/complete", + "svc/pkg/upload/ops/file-list", + "svc/pkg/upload/ops/get", + "svc/pkg/upload/ops/list-for-user", + "svc/pkg/upload/ops/prepare", + "svc/pkg/upload/worker", + "svc/pkg/user-dev/worker", + "svc/pkg/user-follow/ops/count", + "svc/pkg/user-follow/ops/get", + "svc/pkg/user-follow/ops/list", + "svc/pkg/user-follow/ops/relationship-get", + "svc/pkg/user-follow/ops/request-list", + "svc/pkg/user-follow/ops/toggle", + "svc/pkg/user-follow/worker", + "svc/pkg/user-identity/ops/create", + "svc/pkg/user-identity/ops/delete", + "svc/pkg/user-identity/ops/get", + "svc/pkg/user-report/worker", + "svc/pkg/user/ops/avatar-upload-complete", + "svc/pkg/user/ops/get", + "svc/pkg/user/ops/mutual-friend-list", + "svc/pkg/user/ops/pending-delete-toggle", + "svc/pkg/user/ops/profile-validate", + "svc/pkg/user/ops/resolve-access-token", + "svc/pkg/user/ops/resolve-email", + "svc/pkg/user/ops/search", + "svc/pkg/user/ops/team-list", + "svc/pkg/user/ops/token-create", + "svc/pkg/user/worker", + "svc/pkg/workflow/standalone/gc", + "svc/pkg/workflow/standalone/metrics-publish", + + # Libraries + "lib/operation/core", + "lib/operation/macros", + "lib/api-helper/build", + "lib/api-helper/macros", + "lib/chirp/client", + "lib/chirp/metrics", + "lib/chirp/perf", + "lib/chirp/types", + "lib/chirp/worker", + "lib/chirp/worker-attributes", + "lib/bolt/cli", + "lib/bolt/core", + "lib/bolt/config", + "lib/util/core", + "lib/util/env", + "lib/util/macros", + "lib/util/search", + "lib/types-proto/build", + "lib/types-proto/core", + "lib/cache/build", + "lib/cache/result", + "lib/pegboard/container-runner", + "lib/pegboard/manager", + "lib/pegboard/echo", +] + +# Speed up compilation +[profile.dev] +overflow-checks = false +debug = false +lto = "off" + +# Speed up proc macros. +# +# https://endler.dev/2020/rust-compile-times/#avoid-procedural-macro-crates +[profile.dev.build-override] +opt-level = 3 diff --git a/lib/api-helper/build/src/start.rs b/lib/api-helper/build/src/start.rs index 2dd1d77c04..1bb5afe28c 100644 --- a/lib/api-helper/build/src/start.rs +++ b/lib/api-helper/build/src/start.rs @@ -10,25 +10,7 @@ use tracing::Instrument; use uuid::Uuid; #[tracing::instrument(skip_all)] -pub fn start(handle: T) -where - T: Fn( - chirp_client::SharedClientHandle, - rivet_pools::Pools, - rivet_cache::Cache, - Uuid, - Request, - ) -> Fut - + Send - + Sync - + Copy, - Fut: Future, http::Error>> + Send, -{ - rivet_runtime::run(start_fut(handle)).unwrap() -} - -#[tracing::instrument(skip_all)] -async fn start_fut(handle: T) +pub async fn start(handle: T) where T: Fn( chirp_client::SharedClientHandle, diff --git a/lib/chirp-workflow/core/src/ctx/backfill.rs b/lib/chirp-workflow/core/src/ctx/backfill.rs index 7cae0a9f1e..a1953b837a 100644 --- a/lib/chirp-workflow/core/src/ctx/backfill.rs +++ b/lib/chirp-workflow/core/src/ctx/backfill.rs @@ -18,8 +18,9 @@ use crate::history::{cursor::Cursor, location::Location}; // Yes type Query = Box< dyn for<'a> FnOnce( - &'a mut sqlx::Transaction<'_, sqlx::Postgres>, - ) -> Pin> + Send + 'a>>, + &'a mut sqlx::Transaction<'_, sqlx::Postgres>, + ) -> Pin> + Send + 'a>> + + Send, >; pub struct BackfillCtx { diff --git a/lib/convert/src/convert/identity.rs b/lib/convert/src/convert/identity.rs index 2fe06a0279..1b954ee2ea 100644 --- a/lib/convert/src/convert/identity.rs +++ b/lib/convert/src/convert/identity.rs @@ -10,10 +10,8 @@ use crate::{convert, fetch, ApiTryInto}; pub fn handle( current_user_id: Uuid, user: &backend::user::User, - is_mutual_following: bool, ) -> GlobalResult { let user_id = unwrap_ref!(user.user_id).as_uuid(); - let is_self = user_id == current_user_id; Ok(models::IdentityHandle { identity_id: user_id, diff --git a/lib/convert/src/fetch/identity.rs b/lib/convert/src/fetch/identity.rs index ef296e0e3b..fbe333572f 100644 --- a/lib/convert/src/fetch/identity.rs +++ b/lib/convert/src/fetch/identity.rs @@ -30,7 +30,7 @@ pub async fn handles( .map(Into::into) .collect::>(); - let (users, mutual_follows) = tokio::try_join!( + let (users, mutual_follows) = tokio::try_join!( users(ctx, user_ids.clone()), mutual_follows(ctx, current_user_id, raw_user_ids), )?; @@ -41,15 +41,7 @@ pub async fn handles( users .users .iter() - .map(|user| { - let is_mutual_following = mutual_follows.follows.iter().any(|follow| { - follow.is_mutual - && follow.follower_user_id.as_ref() == user.user_id.as_ref() - && follow.following_user_id.as_ref() == Some(&raw_current_user_id) - }); - - convert::identity::handle(current_user_id, user, is_mutual_following) - }) + .map(|user| convert::identity::handle(current_user_id, user)) .collect::>>() } @@ -68,7 +60,7 @@ pub async fn summaries( .map(Into::into) .collect::>(); - let (users, mutual_follows) = tokio::try_join!( + let (users, mutual_follows) = tokio::try_join!( users(ctx, user_ids.clone()), mutual_follows(ctx, current_user_id, raw_user_ids), )?; @@ -77,13 +69,7 @@ pub async fn summaries( users .users .iter() - .map(|user| { - convert::identity::summary( - current_user_id, - user, - &mutual_follows.follows, - ) - }) + .map(|user| convert::identity::summary(current_user_id, user, &mutual_follows.follows)) .collect::>>() } diff --git a/src/commands/mod.rs b/src/commands/mod.rs new file mode 100644 index 0000000000..6d43dc7804 --- /dev/null +++ b/src/commands/mod.rs @@ -0,0 +1 @@ +pub mod start; diff --git a/src/commands/start.rs b/src/commands/start.rs new file mode 100644 index 0000000000..0acc14318a --- /dev/null +++ b/src/commands/start.rs @@ -0,0 +1,118 @@ +use anyhow::*; +use clap::Parser; +use std::{future::Future, time::Duration}; + +#[derive(Parser)] +pub struct Opts { + #[arg(long, value_enum)] + services: Vec, +} + +#[derive(clap::ValueEnum, Clone, PartialEq)] +enum ServiceType { + #[cfg(feature = "api")] + Api, + #[cfg(feature = "api-internal")] + ApiInternal, + #[cfg(feature = "standalone")] + Standalone, + #[cfg(feature = "oneshot")] + Oneshot, + #[cfg(feature = "cron")] + Cron, +} + +impl Opts { + pub async fn execute(&self) -> Result<()> { + let all_services = self.services.is_empty(); + + #[cfg(feature = "api")] + if all_services || self.services.contains(&ServiceType::Api) { + spawn_service("api_monolith", || api_monolith::start()); + } + + #[cfg(feature = "api-internal")] + if all_services || self.services.contains(&ServiceType::ApiInternal) { + spawn_service("api_internal_monolith", || api_internal_monolith::start()); + } + + #[cfg(feature = "standalone")] + if all_services || self.services.contains(&ServiceType::Standalone) { + spawn_service("pegboard_ws", || pegboard_ws::start()); + spawn_service("monolith_worker", || monolith_worker::start()); + spawn_service("monolith_workflow_worker", || { + monolith_workflow_worker::start() + }); + spawn_service("pegboard_gc", || pegboard_gc::start()); + spawn_service("nomad_monitor", || nomad_monitor::start()); + spawn_service("load_test_mm_sustain", || load_test_mm_sustain::start()); + spawn_service("cluster_metrics_publish", || { + cluster_metrics_publish::start() + }); + spawn_service("load_test_mm", || load_test_mm::start()); + spawn_service("cluster_gc", || cluster_gc::start()); + spawn_service("load_test_sqlx", || load_test_sqlx::start()); + spawn_service("cluster_datacenter_tls_renew", || { + cluster_datacenter_tls_renew::start() + }); + spawn_service("load_test_watch_requests", || { + load_test_watch_requests::start() + }); + spawn_service("load_test_api_cloud", || load_test_api_cloud::start()); + spawn_service("linode_gc", || linode_gc::start()); + spawn_service("workflow_metrics_publish", || { + workflow_metrics_publish::start() + }); + spawn_service("workflow_gc", || workflow_gc::start()); + spawn_service("mm_gc", || mm_gc::start()); + spawn_service("job_gc", || job_gc::start()); + spawn_service("user_delete_pending", || user_delete_pending::start()); + } + + #[cfg(feature = "oneshot")] + if all_services || self.services.contains(&ServiceType::Oneshot) { + spawn_service("build_default_create", || build_default_create::start()); + spawn_service("pegboard_dc_init", || pegboard_dc_init::start()); + spawn_service("cluster_default_update", || { + cluster_default_update::start(false) + }); + spawn_service("cluster_workflow_backfill", || { + cluster_workflow_backfill::start() + }); + } + + #[cfg(feature = "cron")] + if all_services || self.services.contains(&ServiceType::Cron) { + spawn_service("telemetry_beacon", || telemetry_beacon::start()); + spawn_service("user_delete_pending", || user_delete_pending::start()); + } + + Result::Ok(()) + } +} + +fn spawn_service(service: &'static str, cb: F) +where + F: Fn() -> Fut + Send + 'static, + Fut: Future> + Send + 'static, +{ + tokio::task::Builder::new() + .name(&format!("rivet::spawn_service::{service}")) + .spawn(async move { + loop { + tracing::info!(%service, "starting service"); + + match cb().await { + Result::Ok(_) => { + tracing::error!(%service, "service exited unexpectedly"); + } + Err(err) => { + tracing::error!(%service, ?err, "service crashed"); + } + } + + tokio::time::sleep(Duration::from_secs(1)).await; + } + }) + .expect("failed to spawn service"); +} diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000000..139597f9cb --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,2 @@ + + diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000000..79a5beebd1 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,38 @@ +use anyhow::*; +use clap::Parser; +use commands::*; + +mod commands; + +// Check that some services are enabled +#[cfg(not(any( + feature = "api", + feature = "api-internal", + feature = "standalone", + feature = "oneshot", + feature = "cron" +)))] +compile_error!( + "At least one feature must be enabled: api, api-internal, standalone, oneshot, or cron" +); + +#[derive(Parser)] +#[command(name = "Rivet", version, about)] +struct Cli { + #[command(subcommand)] + command: SubCommand, +} + +#[derive(Parser)] +enum SubCommand { + Start(start::Opts), +} + +#[tokio::main] +async fn main() -> Result<()> { + let cli = Cli::parse(); + + match cli.command { + SubCommand::Start(opts) => opts.execute().await, + } +} diff --git a/svc/Cargo.toml b/svc/Cargo.toml deleted file mode 100644 index 594ef989a7..0000000000 --- a/svc/Cargo.toml +++ /dev/null @@ -1,263 +0,0 @@ -# This is generated by Bolt. Do not modify. - -[workspace] -resolver = "2" -members = [ - "api/admin", - "api/auth", - "api/cf-verification", - "api/cloud", - "api/games", - "api/group", - "api/identity", - "api/internal-monolith", - "api/job", - "api/kv", - "api/matchmaker", - "api/monolith", - "api/portal", - "api/provision", - "api/servers", - "api/status", - "api/traefik-provider", - "pkg/build", - "pkg/build/standalone/default-create", - "pkg/captcha/ops/hcaptcha-config-get", - "pkg/captcha/ops/hcaptcha-verify", - "pkg/captcha/ops/request", - "pkg/captcha/ops/turnstile-config-get", - "pkg/captcha/ops/turnstile-verify", - "pkg/captcha/ops/verify", - "pkg/cdn/ops/namespace-auth-user-remove", - "pkg/cdn/ops/namespace-auth-user-update", - "pkg/cdn/ops/namespace-create", - "pkg/cdn/ops/namespace-domain-create", - "pkg/cdn/ops/namespace-domain-remove", - "pkg/cdn/ops/namespace-get", - "pkg/cdn/ops/namespace-resolve-domain", - "pkg/cdn/ops/ns-auth-type-set", - "pkg/cdn/ops/ns-enable-domain-public-auth-set", - "pkg/cdn/ops/site-create", - "pkg/cdn/ops/site-get", - "pkg/cdn/ops/site-list-for-game", - "pkg/cdn/ops/version-get", - "pkg/cdn/ops/version-prepare", - "pkg/cdn/ops/version-publish", - "pkg/cdn/worker", - "pkg/cf-custom-hostname/ops/get", - "pkg/cf-custom-hostname/ops/list-for-namespace-id", - "pkg/cf-custom-hostname/ops/resolve-hostname", - "pkg/cf-custom-hostname/worker", - "pkg/cloud/ops/device-link-create", - "pkg/cloud/ops/game-config-create", - "pkg/cloud/ops/game-config-get", - "pkg/cloud/ops/game-token-create", - "pkg/cloud/ops/namespace-create", - "pkg/cloud/ops/namespace-get", - "pkg/cloud/ops/namespace-token-development-create", - "pkg/cloud/ops/namespace-token-public-create", - "pkg/cloud/ops/version-get", - "pkg/cloud/ops/version-publish", - "pkg/cloud/worker", - "pkg/cluster", - "pkg/cluster/standalone/datacenter-tls-renew", - "pkg/cluster/standalone/default-update", - "pkg/cluster/standalone/gc", - "pkg/cluster/standalone/metrics-publish", - "pkg/cluster/standalone/workflow-backfill", - "pkg/custom-user-avatar/ops/list-for-game", - "pkg/custom-user-avatar/ops/upload-complete", - "pkg/debug/ops/email-res", - "pkg/ds", - "pkg/ds-log/ops/export", - "pkg/ds-log/ops/read", - "pkg/email-verification/ops/complete", - "pkg/email-verification/ops/create", - "pkg/email/ops/send", - "pkg/external/ops/request-validate", - "pkg/external/worker", - "pkg/faker/ops/build", - "pkg/faker/ops/cdn-site", - "pkg/faker/ops/game", - "pkg/faker/ops/game-namespace", - "pkg/faker/ops/game-version", - "pkg/faker/ops/job-run", - "pkg/faker/ops/job-template", - "pkg/faker/ops/mm-lobby", - "pkg/faker/ops/mm-lobby-row", - "pkg/faker/ops/mm-player", - "pkg/faker/ops/region", - "pkg/faker/ops/team", - "pkg/faker/ops/user", - "pkg/game-node", - "pkg/game-user/ops/create", - "pkg/game-user/ops/get", - "pkg/game-user/ops/link-create", - "pkg/game-user/ops/link-get", - "pkg/game-user/ops/list-for-user", - "pkg/game-user/ops/recent-session-list", - "pkg/game-user/ops/recommend", - "pkg/game-user/worker", - "pkg/game/ops/banner-upload-complete", - "pkg/game/ops/create", - "pkg/game/ops/get", - "pkg/game/ops/list-all", - "pkg/game/ops/list-for-team", - "pkg/game/ops/logo-upload-complete", - "pkg/game/ops/namespace-create", - "pkg/game/ops/namespace-get", - "pkg/game/ops/namespace-list", - "pkg/game/ops/namespace-resolve-name-id", - "pkg/game/ops/namespace-resolve-url", - "pkg/game/ops/namespace-validate", - "pkg/game/ops/namespace-version-history-list", - "pkg/game/ops/namespace-version-set", - "pkg/game/ops/recommend", - "pkg/game/ops/resolve-name-id", - "pkg/game/ops/resolve-namespace-id", - "pkg/game/ops/token-development-validate", - "pkg/game/ops/validate", - "pkg/game/ops/version-create", - "pkg/game/ops/version-get", - "pkg/game/ops/version-list", - "pkg/game/ops/version-validate", - "pkg/identity-config/ops/namespace-create", - "pkg/identity-config/ops/namespace-get", - "pkg/identity-config/ops/version-get", - "pkg/identity-config/ops/version-prepare", - "pkg/identity-config/ops/version-publish", - "pkg/ip/ops/info", - "pkg/job-log/ops/read", - "pkg/job-log/worker", - "pkg/job-run", - "pkg/job/standalone/gc", - "pkg/kv-config/ops/namespace-create", - "pkg/kv-config/ops/namespace-get", - "pkg/kv-config/ops/version-get", - "pkg/kv-config/ops/version-prepare", - "pkg/kv-config/ops/version-publish", - "pkg/kv/ops/get", - "pkg/kv/ops/list", - "pkg/kv/worker", - "pkg/linode", - "pkg/linode/standalone/gc", - "pkg/load-test/standalone/api-cloud", - "pkg/load-test/standalone/mm", - "pkg/load-test/standalone/mm-sustain", - "pkg/load-test/standalone/sqlx", - "pkg/load-test/standalone/watch-requests", - "pkg/mm-config/ops/game-get", - "pkg/mm-config/ops/game-upsert", - "pkg/mm-config/ops/lobby-group-get", - "pkg/mm-config/ops/lobby-group-resolve-name-id", - "pkg/mm-config/ops/lobby-group-resolve-version", - "pkg/mm-config/ops/namespace-config-set", - "pkg/mm-config/ops/namespace-config-validate", - "pkg/mm-config/ops/namespace-create", - "pkg/mm-config/ops/namespace-get", - "pkg/mm-config/ops/version-get", - "pkg/mm-config/ops/version-prepare", - "pkg/mm-config/ops/version-publish", - "pkg/mm/ops/dev-player-token-create", - "pkg/mm/ops/lobby-find-fail", - "pkg/mm/ops/lobby-find-lobby-query-list", - "pkg/mm/ops/lobby-find-try-complete", - "pkg/mm/ops/lobby-for-run-id", - "pkg/mm/ops/lobby-get", - "pkg/mm/ops/lobby-history", - "pkg/mm/ops/lobby-idle-update", - "pkg/mm/ops/lobby-list-for-namespace", - "pkg/mm/ops/lobby-list-for-user-id", - "pkg/mm/ops/lobby-player-count", - "pkg/mm/ops/lobby-runtime-aggregate", - "pkg/mm/ops/lobby-state-get", - "pkg/mm/ops/player-count-for-namespace", - "pkg/mm/ops/player-get", - "pkg/mm/standalone/gc", - "pkg/mm/worker", - "pkg/monolith/standalone/worker", - "pkg/monolith/standalone/workflow-worker", - "pkg/nomad/standalone/monitor", - "pkg/nsfw/ops/image-score", - "pkg/pegboard", - "pkg/pegboard/standalone/dc-init", - "pkg/pegboard/standalone/gc", - "pkg/pegboard/standalone/ws", - "pkg/perf/ops/log-get", - "pkg/profanity/ops/check", - "pkg/region/ops/get", - "pkg/region/ops/list", - "pkg/region/ops/list-for-game", - "pkg/region/ops/recommend", - "pkg/region/ops/resolve", - "pkg/region/ops/resolve-for-game", - "pkg/team-invite/ops/get", - "pkg/team-invite/worker", - "pkg/team/ops/avatar-upload-complete", - "pkg/team/ops/get", - "pkg/team/ops/join-request-list", - "pkg/team/ops/member-count", - "pkg/team/ops/member-get", - "pkg/team/ops/member-list", - "pkg/team/ops/member-relationship-get", - "pkg/team/ops/profile-validate", - "pkg/team/ops/recommend", - "pkg/team/ops/resolve-display-name", - "pkg/team/ops/search", - "pkg/team/ops/user-ban-get", - "pkg/team/ops/user-ban-list", - "pkg/team/ops/validate", - "pkg/team/worker", - "pkg/telemetry/standalone/beacon", - "pkg/tier", - "pkg/token/ops/create", - "pkg/token/ops/exchange", - "pkg/token/ops/get", - "pkg/token/ops/revoke", - "pkg/upload/ops/complete", - "pkg/upload/ops/file-list", - "pkg/upload/ops/get", - "pkg/upload/ops/list-for-user", - "pkg/upload/ops/prepare", - "pkg/upload/standalone/provider-fill", - "pkg/upload/worker", - "pkg/user-dev/worker", - "pkg/user-follow/ops/count", - "pkg/user-follow/ops/get", - "pkg/user-follow/ops/list", - "pkg/user-follow/ops/relationship-get", - "pkg/user-follow/ops/request-list", - "pkg/user-follow/ops/toggle", - "pkg/user-follow/worker", - "pkg/user-identity/ops/create", - "pkg/user-identity/ops/delete", - "pkg/user-identity/ops/get", - "pkg/user-report/worker", - "pkg/user/ops/avatar-upload-complete", - "pkg/user/ops/get", - "pkg/user/ops/mutual-friend-list", - "pkg/user/ops/pending-delete-toggle", - "pkg/user/ops/profile-validate", - "pkg/user/ops/resolve-access-token", - "pkg/user/ops/resolve-email", - "pkg/user/ops/search", - "pkg/user/ops/team-list", - "pkg/user/ops/token-create", - "pkg/user/standalone/delete-pending", - "pkg/user/standalone/search-user-gc", - "pkg/user/worker", - "pkg/workflow/standalone/gc", - "pkg/workflow/standalone/metrics-publish" -] - -# Speed up compilation -[profile.dev] -overflow-checks = false -debug = false -lto = "off" - -# Speed up proc macros. -# -# https://endler.dev/2020/rust-compile-times/#avoid-procedural-macro-crates -[profile.dev.build-override] -opt-level = 3 diff --git a/svc/api/admin/src/main.rs b/svc/api/admin/src/main.rs deleted file mode 100644 index f788cae720..0000000000 --- a/svc/api/admin/src/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -use api_helper::start; - -fn main() { - start(api_admin::route::handle); -} diff --git a/svc/api/auth/src/main.rs b/svc/api/auth/src/main.rs deleted file mode 100644 index e85c0c839d..0000000000 --- a/svc/api/auth/src/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -use api_helper::start; - -fn main() { - start(api_auth::route::handle); -} diff --git a/svc/api/cf-verification/src/main.rs b/svc/api/cf-verification/src/main.rs deleted file mode 100644 index fbafa706ed..0000000000 --- a/svc/api/cf-verification/src/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -use api_helper::start; - -fn main() { - start(api_cf_verification::route::handle); -} diff --git a/svc/api/cloud/src/main.rs b/svc/api/cloud/src/main.rs deleted file mode 100644 index 52a7342b16..0000000000 --- a/svc/api/cloud/src/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -use api_helper::start; - -fn main() { - start(api_cloud::route::handle); -} diff --git a/svc/api/games/src/main.rs b/svc/api/games/src/main.rs deleted file mode 100644 index 55bb3af13b..0000000000 --- a/svc/api/games/src/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -use api_helper::start; - -fn main() { - start(api_games::route::handle); -} diff --git a/svc/api/group/src/convert/identity.rs b/svc/api/group/src/convert/identity.rs index e2df5a1b61..c29ff9cabd 100644 --- a/svc/api/group/src/convert/identity.rs +++ b/svc/api/group/src/convert/identity.rs @@ -2,18 +2,13 @@ use proto::backend; use rivet_group_server::models; use rivet_operation::prelude::*; -use crate::{convert, fetch}; - pub fn handle( current_user_id: Uuid, user: &backend::user::User, - is_mutual_following: bool, ) -> GlobalResult { let raw_user_id = unwrap!(user.user_id); let user_id = raw_user_id.as_uuid(); - let is_self = user_id == current_user_id; - Ok(models::IdentityHandle { identity_id: user_id.to_string(), display_name: user.display_name.clone(), diff --git a/svc/api/group/src/main.rs b/svc/api/group/src/main.rs deleted file mode 100644 index 6e3b7a6bd2..0000000000 --- a/svc/api/group/src/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -use api_helper::start; - -fn main() { - start(api_group::route::handle); -} diff --git a/svc/api/group/src/route/groups.rs b/svc/api/group/src/route/groups.rs index ec6973bf3a..ad56dc4489 100644 --- a/svc/api/group/src/route/groups.rs +++ b/svc/api/group/src/route/groups.rs @@ -301,14 +301,8 @@ pub async fn members( .users .iter() .map(|user| { - let is_mutual_following = user_follows.follows.iter().any(|follow| { - follow.follower_user_id.as_ref() == user.user_id.as_ref() - && follow.following_user_id.as_ref() == Some(&raw_user_ent_id) - && follow.is_mutual - }); - Ok(models::GroupMember { - identity: convert::identity::handle(user_ent.user_id, user, is_mutual_following)?, + identity: convert::identity::handle(user_ent.user_id, user)?, }) }) .collect::>>()?; @@ -460,14 +454,8 @@ pub async fn join_requests( .find(|join_request| user.user_id == join_request.user_id) .map(|jr| jr.ts) .unwrap_or(update_ts); - let is_mutual_following = user_follows.follows.iter().any(|follow| { - follow.follower_user_id.as_ref() == user.user_id.as_ref() - && follow.following_user_id.as_ref() == Some(&raw_user_ent_id) - && follow.is_mutual - }); - Ok(models::GroupJoinRequest { - identity: convert::identity::handle(user_ent.user_id, user, is_mutual_following)?, + identity: convert::identity::handle(user_ent.user_id, user)?, ts: util::timestamp::to_chrono(join_request_ts)?, }) }) @@ -1359,14 +1347,8 @@ pub async fn bans( .ban_ts }; - let is_mutual_following = user_follows.follows.iter().any(|follow| { - follow.follower_user_id.as_ref() == user.user_id.as_ref() - && follow.following_user_id.as_ref() == Some(&raw_user_ent_id) - && follow.is_mutual - }); - Ok(models::GroupBannedIdentity { - identity: convert::identity::handle(user_ent.user_id, user, is_mutual_following)?, + identity: convert::identity::handle(user_ent.user_id, user)?, ban_ts: util::timestamp::to_chrono(ban_ts)?, }) }) diff --git a/svc/api/identity/src/main.rs b/svc/api/identity/src/main.rs deleted file mode 100644 index a8afa0bed9..0000000000 --- a/svc/api/identity/src/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -use api_helper::start; - -fn main() { - start(api_identity::route::handle); -} diff --git a/svc/api/internal-monolith/src/lib.rs b/svc/api/internal-monolith/src/lib.rs index b9bb57fef0..3e312e3592 100644 --- a/svc/api/internal-monolith/src/lib.rs +++ b/svc/api/internal-monolith/src/lib.rs @@ -1 +1,8 @@ +use rivet_operation::prelude::*; + pub mod route; + +pub async fn start() -> GlobalResult<()> { + api_helper::start(route::handle).await; + Ok(()) +} diff --git a/svc/api/internal-monolith/src/main.rs b/svc/api/internal-monolith/src/main.rs deleted file mode 100644 index a58e15a551..0000000000 --- a/svc/api/internal-monolith/src/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -use api_helper::start; - -fn main() { - start(api_internal_monolith::route::handle); -} diff --git a/svc/api/job/src/main.rs b/svc/api/job/src/main.rs deleted file mode 100644 index 2602f81bf0..0000000000 --- a/svc/api/job/src/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -use api_helper::start; - -fn main() { - start(api_job::route::handle); -} diff --git a/svc/api/kv/src/main.rs b/svc/api/kv/src/main.rs deleted file mode 100644 index fa4078df6e..0000000000 --- a/svc/api/kv/src/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -use api_helper::start; - -fn main() { - start(api_kv::route::handle); -} diff --git a/svc/api/matchmaker/src/main.rs b/svc/api/matchmaker/src/main.rs deleted file mode 100644 index 6e83080c23..0000000000 --- a/svc/api/matchmaker/src/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -use api_helper::start; - -fn main() { - start(api_matchmaker::route::handle); -} diff --git a/svc/api/monolith/src/lib.rs b/svc/api/monolith/src/lib.rs index b9bb57fef0..3e312e3592 100644 --- a/svc/api/monolith/src/lib.rs +++ b/svc/api/monolith/src/lib.rs @@ -1 +1,8 @@ +use rivet_operation::prelude::*; + pub mod route; + +pub async fn start() -> GlobalResult<()> { + api_helper::start(route::handle).await; + Ok(()) +} diff --git a/svc/api/monolith/src/main.rs b/svc/api/monolith/src/main.rs deleted file mode 100644 index f12807427f..0000000000 --- a/svc/api/monolith/src/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -use api_helper::start; - -fn main() { - start(api_monolith::route::handle); -} diff --git a/svc/api/portal/src/main.rs b/svc/api/portal/src/main.rs deleted file mode 100644 index 5000bec808..0000000000 --- a/svc/api/portal/src/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -use api_helper::start; - -fn main() { - start(api_portal::route::handle); -} diff --git a/svc/api/provision/src/main.rs b/svc/api/provision/src/main.rs deleted file mode 100644 index 4e48ceab13..0000000000 --- a/svc/api/provision/src/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -use api_helper::start; - -fn main() { - start(api_provision::route::handle); -} diff --git a/svc/api/servers/src/main.rs b/svc/api/servers/src/main.rs deleted file mode 100644 index 26c0bd45b7..0000000000 --- a/svc/api/servers/src/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -use api_helper::start; - -fn main() { - start(api_servers::route::handle); -} diff --git a/svc/api/status/src/main.rs b/svc/api/status/src/main.rs deleted file mode 100644 index c4f2148603..0000000000 --- a/svc/api/status/src/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -use api_helper::start; - -fn main() { - start(api_status::route::handle); -} diff --git a/svc/api/traefik-provider/src/main.rs b/svc/api/traefik-provider/src/main.rs deleted file mode 100644 index f19fd1dfb2..0000000000 --- a/svc/api/traefik-provider/src/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -use api_helper::start; - -fn main() { - start(api_traefik_provider::route::handle); -} diff --git a/svc/pkg/build/standalone/default-create/src/lib.rs b/svc/pkg/build/standalone/default-create/src/lib.rs index 18a64207f3..b8c2da19af 100644 --- a/svc/pkg/build/standalone/default-create/src/lib.rs +++ b/svc/pkg/build/standalone/default-create/src/lib.rs @@ -73,7 +73,7 @@ struct DefaultBuildConfig { } #[tracing::instrument] -pub async fn run_from_env() -> GlobalResult<()> { +pub async fn start() -> GlobalResult<()> { let pools = rivet_pools::from_env("build-default-create").await?; let client = chirp_client::SharedClient::from_env(pools.clone())?.wrap_new("build-default-create"); diff --git a/svc/pkg/build/standalone/default-create/src/main.rs b/svc/pkg/build/standalone/default-create/src/main.rs deleted file mode 100644 index b958b438bf..0000000000 --- a/svc/pkg/build/standalone/default-create/src/main.rs +++ /dev/null @@ -1,15 +0,0 @@ -use rivet_operation::prelude::*; -use tracing_subscriber::prelude::*; - -#[tokio::main] -async fn main() -> GlobalResult<()> { - tracing_subscriber::registry() - .with( - tracing_logfmt::builder() - .layer() - .with_filter(tracing_subscriber::filter::LevelFilter::INFO), - ) - .init(); - - build_default_create::run_from_env().await -} diff --git a/svc/pkg/cluster/standalone/datacenter-tls-renew/src/lib.rs b/svc/pkg/cluster/standalone/datacenter-tls-renew/src/lib.rs index e801136fd1..95f74bb63d 100644 --- a/svc/pkg/cluster/standalone/datacenter-tls-renew/src/lib.rs +++ b/svc/pkg/cluster/standalone/datacenter-tls-renew/src/lib.rs @@ -5,6 +5,12 @@ use cluster::types::TlsState; // How much time before the cert expires to renew it const EXPIRE_PADDING: i64 = util::duration::days(30); +pub async fn start() -> GlobalResult<()> { + let pools = rivet_pools::from_env("cluster-datacenter-tls-renew").await?; + + run_from_env(pools).await +} + #[tracing::instrument(skip_all)] pub async fn run_from_env(pools: rivet_pools::Pools) -> GlobalResult<()> { let client = chirp_client::SharedClient::from_env(pools.clone())? diff --git a/svc/pkg/cluster/standalone/datacenter-tls-renew/src/main.rs b/svc/pkg/cluster/standalone/datacenter-tls-renew/src/main.rs deleted file mode 100644 index e554bbdbf4..0000000000 --- a/svc/pkg/cluster/standalone/datacenter-tls-renew/src/main.rs +++ /dev/null @@ -1,30 +0,0 @@ -use std::time::Duration; - -use chirp_workflow::prelude::*; - -fn main() -> GlobalResult<()> { - rivet_runtime::run(start()).unwrap() -} - -async fn start() -> GlobalResult<()> { - let pools = rivet_pools::from_env("cluster-datacenter-tls-renew").await?; - - tokio::task::Builder::new() - .name("cluster_datacenter_tls_renew::health_checks") - .spawn(rivet_health_checks::run_standalone( - rivet_health_checks::Config { - pools: Some(pools.clone()), - }, - ))?; - - tokio::task::Builder::new() - .name("cluster_datacenter_tls_renew::metrics") - .spawn(rivet_metrics::run_standalone())?; - - let mut interval = tokio::time::interval(Duration::from_secs(60 * 60)); - loop { - interval.tick().await; - - cluster_datacenter_tls_renew::run_from_env(pools.clone()).await?; - } -} diff --git a/svc/pkg/cluster/standalone/default-update/src/lib.rs b/svc/pkg/cluster/standalone/default-update/src/lib.rs index de80312875..782b7c8e5b 100644 --- a/svc/pkg/cluster/standalone/default-update/src/lib.rs +++ b/svc/pkg/cluster/standalone/default-update/src/lib.rs @@ -95,8 +95,17 @@ impl From for cluster::types::BuildDeliveryMethod { } } +pub async fn start(use_autoscaler: bool) -> GlobalResult<()> { + // TODO: When running bolt up, this service gets created first before `cluster-worker` so the messages + // sent from here are received but effectively forgotten because `cluster-worker` gets restarted + // immediately afterwards. This server will be replaced with a bolt infra step + tokio::time::sleep(std::time::Duration::from_secs(3)).await; + + start_inner(use_autoscaler).await +} + #[tracing::instrument] -pub async fn run_from_env(use_autoscaler: bool) -> GlobalResult<()> { +pub async fn start_inner(use_autoscaler: bool) -> GlobalResult<()> { let pools = rivet_pools::from_env("cluster-default-update").await?; let client = chirp_client::SharedClient::from_env(pools.clone())?.wrap_new("cluster-default-update"); @@ -134,9 +143,11 @@ pub async fn run_from_env(use_autoscaler: bool) -> GlobalResult<()> { // Get all datacenters let cluster = unwrap!(datacenter_list_res.clusters.first()); - let datacenters_res = ctx.op(cluster::ops::datacenter::get::Input { - datacenter_ids: cluster.datacenter_ids.clone(), - }).await?; + let datacenters_res = ctx + .op(cluster::ops::datacenter::get::Input { + datacenter_ids: cluster.datacenter_ids.clone(), + }) + .await?; if cluster_res.clusters.is_empty() { tracing::warn!("creating default cluster"); @@ -145,7 +156,10 @@ pub async fn run_from_env(use_autoscaler: bool) -> GlobalResult<()> { cluster_id, name_id: config.name_id.clone(), owner_team_id: None, - }).tag("cluster_id", cluster_id,).dispatch().await?; + }) + .tag("cluster_id", cluster_id) + .dispatch() + .await?; } for existing_datacenter in &datacenters_res.datacenters { @@ -199,7 +213,10 @@ pub async fn run_from_env(use_autoscaler: bool) -> GlobalResult<()> { ctx.signal(cluster::workflows::datacenter::Update { pools: new_pools, prebakes_enabled: Some(datacenter.prebakes_enabled), - }).tag("datacenter_id", datacenter.datacenter_id,).send().await?; + }) + .tag("datacenter_id", datacenter.datacenter_id) + .send() + .await?; } // Create new datacenter else { @@ -207,25 +224,34 @@ pub async fn run_from_env(use_autoscaler: bool) -> GlobalResult<()> { datacenter_id: datacenter.datacenter_id, name_id, display_name: datacenter.display_name, - + provider: datacenter.provider.into(), provider_datacenter_id: datacenter.provider_datacenter_name, provider_api_token: None, - - pools: datacenter.pools.into_iter().map(|(pool_type, pool)| { - cluster::types::Pool { + + pools: datacenter + .pools + .into_iter() + .map(|(pool_type, pool)| cluster::types::Pool { pool_type: pool_type.into(), - hardware: pool.hardware.into_iter().map(Into::into).collect::>(), + hardware: pool + .hardware + .into_iter() + .map(Into::into) + .collect::>(), desired_count: pool.desired_count, min_count: pool.min_count, max_count: pool.max_count, drain_timeout: pool.drain_timeout, - } - }).collect::>(), - + }) + .collect::>(), + build_delivery_method: datacenter.build_delivery_method.into(), prebakes_enabled: datacenter.prebakes_enabled, - }).tag("cluster_id", cluster_id,).send().await?; + }) + .tag("cluster_id", cluster_id) + .send() + .await?; } } diff --git a/svc/pkg/cluster/standalone/default-update/src/main.rs b/svc/pkg/cluster/standalone/default-update/src/main.rs deleted file mode 100644 index 246ffb3e4c..0000000000 --- a/svc/pkg/cluster/standalone/default-update/src/main.rs +++ /dev/null @@ -1,20 +0,0 @@ -use tracing_subscriber::prelude::*; -use chirp_workflow::prelude::*; - -#[tokio::main] -async fn main() -> GlobalResult<()> { - tracing_subscriber::registry() - .with( - tracing_logfmt::builder() - .layer() - .with_filter(tracing_subscriber::filter::LevelFilter::INFO), - ) - .init(); - - // TODO: When running bolt up, this service gets created first before `cluster-worker` so the messages - // sent from here are received but effectively forgotten because `cluster-worker` gets restarted - // immediately afterwards. This server will be replaced with a bolt infra step - tokio::time::sleep(std::time::Duration::from_secs(3)).await; - - cluster_default_update::run_from_env(false).await -} diff --git a/svc/pkg/cluster/standalone/gc/src/lib.rs b/svc/pkg/cluster/standalone/gc/src/lib.rs index 4dd0cf9726..8689a34324 100644 --- a/svc/pkg/cluster/standalone/gc/src/lib.rs +++ b/svc/pkg/cluster/standalone/gc/src/lib.rs @@ -4,6 +4,30 @@ use chirp_workflow::prelude::*; use cluster::types::PoolType; use futures_util::FutureExt; +pub async fn start() -> GlobalResult<()> { + let pools = rivet_pools::from_env("cluster-gc").await?; + + tokio::task::Builder::new() + .name("cluster_gc::health_checks") + .spawn(rivet_health_checks::run_standalone( + rivet_health_checks::Config { + pools: Some(pools.clone()), + }, + ))?; + + tokio::task::Builder::new() + .name("cluster_gc::metrics") + .spawn(rivet_metrics::run_standalone())?; + + let mut interval = tokio::time::interval(std::time::Duration::from_secs(120)); + loop { + interval.tick().await; + + let ts = util::timestamp::now(); + run_from_env(ts, pools.clone()).await?; + } +} + #[derive(sqlx::FromRow)] struct ServerRow { server_id: Uuid, diff --git a/svc/pkg/cluster/standalone/gc/src/main.rs b/svc/pkg/cluster/standalone/gc/src/main.rs deleted file mode 100644 index 6657f98301..0000000000 --- a/svc/pkg/cluster/standalone/gc/src/main.rs +++ /dev/null @@ -1,31 +0,0 @@ -use std::time::Duration; - -use chirp_workflow::prelude::*; - -fn main() -> GlobalResult<()> { - rivet_runtime::run(start()).unwrap() -} - -async fn start() -> GlobalResult<()> { - let pools = rivet_pools::from_env("cluster-gc").await?; - - tokio::task::Builder::new() - .name("cluster_gc::health_checks") - .spawn(rivet_health_checks::run_standalone( - rivet_health_checks::Config { - pools: Some(pools.clone()), - }, - ))?; - - tokio::task::Builder::new() - .name("cluster_gc::metrics") - .spawn(rivet_metrics::run_standalone())?; - - let mut interval = tokio::time::interval(Duration::from_secs(120)); - loop { - interval.tick().await; - - let ts = util::timestamp::now(); - cluster_gc::run_from_env(ts, pools.clone()).await?; - } -} diff --git a/svc/pkg/cluster/standalone/metrics-publish/src/lib.rs b/svc/pkg/cluster/standalone/metrics-publish/src/lib.rs index 792b5270e2..8f753968f8 100644 --- a/svc/pkg/cluster/standalone/metrics-publish/src/lib.rs +++ b/svc/pkg/cluster/standalone/metrics-publish/src/lib.rs @@ -6,6 +6,17 @@ use cluster::{ util::metrics, }; +pub async fn start() -> GlobalResult<()> { + let pools = rivet_pools::from_env("cluster-metrics-publish").await?; + + let mut interval = tokio::time::interval(std::time::Duration::from_secs(7)); + loop { + interval.tick().await; + + run_from_env(pools.clone()).await?; + } +} + #[derive(sqlx::FromRow)] struct ServerRow { datacenter_id: Uuid, diff --git a/svc/pkg/cluster/standalone/metrics-publish/src/main.rs b/svc/pkg/cluster/standalone/metrics-publish/src/main.rs deleted file mode 100644 index 65475901a3..0000000000 --- a/svc/pkg/cluster/standalone/metrics-publish/src/main.rs +++ /dev/null @@ -1,30 +0,0 @@ -use std::time::Duration; - -use chirp_workflow::prelude::*; - -fn main() -> GlobalResult<()> { - rivet_runtime::run(start()).unwrap() -} - -async fn start() -> GlobalResult<()> { - let pools = rivet_pools::from_env("cluster-metrics-publish").await?; - - tokio::task::Builder::new() - .name("cluster_metrics_publish::health_checks") - .spawn(rivet_health_checks::run_standalone( - rivet_health_checks::Config { - pools: Some(pools.clone()), - }, - ))?; - - tokio::task::Builder::new() - .name("cluster_metrics_publish::metrics") - .spawn(rivet_metrics::run_standalone())?; - - let mut interval = tokio::time::interval(Duration::from_secs(7)); - loop { - interval.tick().await; - - cluster_metrics_publish::run_from_env(pools.clone()).await?; - } -} diff --git a/svc/pkg/cluster/standalone/workflow-backfill/src/lib.rs b/svc/pkg/cluster/standalone/workflow-backfill/src/lib.rs index 46f7d0dabc..94c0d75e5e 100644 --- a/svc/pkg/cluster/standalone/workflow-backfill/src/lib.rs +++ b/svc/pkg/cluster/standalone/workflow-backfill/src/lib.rs @@ -9,7 +9,7 @@ use serde::Serialize; use serde_json::json; #[tracing::instrument(skip_all)] -pub async fn run_from_env() -> GlobalResult<()> { +pub async fn start() -> GlobalResult<()> { let pools = rivet_pools::from_env("cluster-workflow-backfill").await?; let client = chirp_client::SharedClient::from_env(pools.clone())?.wrap_new("cluster-workflow-backfill"); @@ -22,1002 +22,1025 @@ pub async fn run_from_env() -> GlobalResult<()> { .await?; let crdb = ctx.crdb().await?; - let mut tx = crdb.begin().await?; - - // Delete invalid dns record rows - sql_execute!( - [ctx, @tx &mut tx] - " - DELETE FROM db_cluster.servers_cloudflare - WHERE dns_record_id IS NULL OR secondary_dns_record_id IS NULL - ", - ) - .await?; - - let mut bctx = BackfillCtx::new(); - - #[derive(sqlx::FromRow)] - struct ClusterRow { - cluster_id: Uuid, - name_id: String, - owner_team_id: Option, - } - - let cluster_rows = sql_fetch_all!( - [ctx, ClusterRow, @tx &mut tx] - " - SELECT - cluster_id, - name_id, - owner_team_id - FROM db_cluster.clusters - ", - ) - .await?; - for cluster in cluster_rows { - bctx.workflow("cluster", |wf| { - wf.tags(json!({ - "cluster_id": cluster.cluster_id, - }))?; - wf.input(cluster::workflows::cluster::Input { - cluster_id: cluster.cluster_id, - name_id: cluster.name_id.clone(), - owner_team_id: cluster.owner_team_id, - })?; - wf.finalize(); - - #[derive(Serialize, Hash)] - struct InsertDbInput { + rivet_pools::utils::crdb::tx(&crdb, |tx| { + let ctx = ctx.clone(); + Box::pin(async move { + // Delete invalid dns record rows + sql_execute!( + [ctx, @tx tx] + " + DELETE FROM db_cluster.servers_cloudflare + WHERE dns_record_id IS NULL OR secondary_dns_record_id IS NULL + ", + ) + .await?; + + let mut bctx = BackfillCtx::new(); + + #[derive(sqlx::FromRow)] + struct ClusterRow { cluster_id: Uuid, name_id: String, owner_team_id: Option, } - wf.activity( - "insert_db", - InsertDbInput { - cluster_id: cluster.cluster_id, - name_id: cluster.name_id.clone(), - owner_team_id: cluster.owner_team_id, - }, - serde_json::Value::Null, - )?; - - wf.message( - "cluster_create_complete", - json!({ - "cluster_id": cluster.cluster_id, - }), - cluster::workflows::cluster::CreateComplete {}, - )?; + let cluster_rows = sql_fetch_all!( + [ctx, ClusterRow, @tx tx] + " + SELECT + cluster_id, + name_id, + owner_team_id + FROM db_cluster.clusters + ", + ) + .await?; + + for cluster in cluster_rows { + bctx.workflow("cluster", |wf| { + wf.tags(json!({ + "cluster_id": cluster.cluster_id, + }))?; + wf.input(cluster::workflows::cluster::Input { + cluster_id: cluster.cluster_id, + name_id: cluster.name_id.clone(), + owner_team_id: cluster.owner_team_id, + })?; + wf.finalize(); - Ok(()) - })?; - } - - #[derive(sqlx::FromRow, Clone)] - struct DcRow { - datacenter_id: Uuid, - cluster_id: Uuid, - name_id: String, - display_name: String, - provider: i64, - provider_datacenter_id: String, - provider_api_token: Option, - pools: Vec, - build_delivery_method: i64, - } - #[derive(sqlx::FromRow)] - struct DcTlsRow { - datacenter_id: Uuid, - gg_cert_pem: Option, - gg_private_key_pem: Option, - job_cert_pem: Option, - job_private_key_pem: Option, - expire_ts: i64, - } - - let dc_rows = sql_fetch_all!( - [ctx, DcRow, @tx &mut tx] - " - SELECT - datacenter_id, - cluster_id, - name_id, - display_name, - provider_datacenter_id, - provider_api_token, - create_ts, - provider, - pools, - build_delivery_method - FROM db_cluster.datacenters - ", - ) - .await?; - let dc_tls_rows = sql_fetch_all!( - [ctx, DcTlsRow, @tx &mut tx] - " - SELECT - datacenter_id, - gg_cert_pem, - gg_private_key_pem, - job_cert_pem, - job_private_key_pem, - expire_ts - FROM db_cluster.datacenter_tls - ", - ) - .await?; + #[derive(Serialize, Hash)] + struct InsertDbInput { + cluster_id: Uuid, + name_id: String, + owner_team_id: Option, + } - for dc in dc_rows.clone() { - let tls = unwrap!(dc_tls_rows - .iter() - .find(|dc_tls| dc_tls.datacenter_id == dc.datacenter_id)); - - bctx.workflow("cluster_datacenter", |wf| { - wf.tags(json!({ - "datacenter_id": dc.datacenter_id, - }))?; - wf.input(json!({ - "cluster_id": dc.cluster_id, - "datacenter_id": dc.datacenter_id, - "name_id": dc.name_id.clone(), - "display_name": dc.display_name.clone(), - - "provider": unwrap!(cluster::types::Provider::from_repr(dc.provider.try_into()?)), - "provider_datacenter_id": dc.provider_datacenter_id.clone(), - "provider_api_token": dc.provider_api_token.clone(), - - "pools": ({ - let proto = backend::cluster::Pools::decode(dc.pools.as_slice())?.pools; + wf.activity( + "insert_db", + InsertDbInput { + cluster_id: cluster.cluster_id, + name_id: cluster.name_id.clone(), + owner_team_id: cluster.owner_team_id, + }, + serde_json::Value::Null, + )?; - proto - .into_iter() - .map(TryInto::::try_into) - .collect::>>()? - }), + wf.message( + "cluster_create_complete", + json!({ + "cluster_id": cluster.cluster_id, + }), + cluster::workflows::cluster::CreateComplete {}, + )?; - "build_delivery_method": unwrap!( - cluster::types::BuildDeliveryMethod::from_repr(dc.build_delivery_method.try_into()?) - ), - "prebakes_enabled": false, - }))?; - wf.finalize(); + Ok(()) + })?; + } - #[derive(Serialize, Hash)] - struct InsertDbInput { - cluster_id: Uuid, + #[derive(sqlx::FromRow, Clone)] + struct DcRow { datacenter_id: Uuid, + cluster_id: Uuid, name_id: String, display_name: String, - - provider: cluster::types::Provider, + provider: i64, provider_datacenter_id: String, provider_api_token: Option, + pools: Vec, + build_delivery_method: i64, + } + #[derive(sqlx::FromRow)] + struct DcTlsRow { + datacenter_id: Uuid, + gg_cert_pem: Option, + gg_private_key_pem: Option, + job_cert_pem: Option, + job_private_key_pem: Option, + expire_ts: i64, + } + + let dc_rows = sql_fetch_all!( + [ctx, DcRow, @tx tx] + " + SELECT + datacenter_id, + cluster_id, + name_id, + display_name, + provider_datacenter_id, + provider_api_token, + create_ts, + provider, + pools, + build_delivery_method + FROM db_cluster.datacenters + ", + ) + .await?; + let dc_tls_rows = sql_fetch_all!( + [ctx, DcTlsRow, @tx tx] + " + SELECT + datacenter_id, + gg_cert_pem, + gg_private_key_pem, + job_cert_pem, + job_private_key_pem, + expire_ts + FROM db_cluster.datacenter_tls + ", + ) + .await?; + + for dc in dc_rows.clone() { + let tls = unwrap!(dc_tls_rows + .iter() + .find(|dc_tls| dc_tls.datacenter_id == dc.datacenter_id)); + + bctx.workflow("cluster_datacenter", |wf| { + wf.tags(json!({ + "datacenter_id": dc.datacenter_id, + }))?; + wf.input(json!({ + "cluster_id": dc.cluster_id, + "datacenter_id": dc.datacenter_id, + "name_id": dc.name_id.clone(), + "display_name": dc.display_name.clone(), + + "provider": unwrap!(cluster::types::Provider::from_repr(dc.provider.try_into()?)), + "provider_datacenter_id": dc.provider_datacenter_id.clone(), + "provider_api_token": dc.provider_api_token.clone(), + + "pools": ({ + let proto = backend::cluster::Pools::decode(dc.pools.as_slice())?.pools; + + proto + .into_iter() + .map(TryInto::::try_into) + .collect::>>()? + }), + + "build_delivery_method": unwrap!( + cluster::types::BuildDeliveryMethod::from_repr(dc.build_delivery_method.try_into()?) + ), + "prebakes_enabled": false, + }))?; + wf.finalize(); + + #[derive(Serialize, Hash)] + struct InsertDbInput { + cluster_id: Uuid, + datacenter_id: Uuid, + name_id: String, + display_name: String, + + provider: cluster::types::Provider, + provider_datacenter_id: String, + provider_api_token: Option, + + pools: Vec, + + build_delivery_method: cluster::types::BuildDeliveryMethod, + prebakes_enabled: bool, + } + + wf.activity( + "insert_db", + InsertDbInput { + cluster_id: dc.cluster_id, + datacenter_id: dc.datacenter_id, + name_id: dc.name_id.clone(), + display_name: dc.display_name.clone(), + + provider: unwrap!(cluster::types::Provider::from_repr( + dc.provider.try_into()? + )), + provider_datacenter_id: dc.provider_datacenter_id.clone(), + provider_api_token: dc.provider_api_token.clone(), + + pools: { + let proto = + backend::cluster::Pools::decode(dc.pools.as_slice())?.pools; + + proto + .into_iter() + .map(TryInto::try_into) + .collect::>>()? + }, + + build_delivery_method: unwrap!( + cluster::types::BuildDeliveryMethod::from_repr( + dc.build_delivery_method.try_into()?, + ) + ), + prebakes_enabled: false, + }, + serde_json::Value::Null, + )?; - pools: Vec, + // Tls issue + if let ( + Some(gg_cert_pem), + Some(gg_private_key_pem), + Some(job_cert_pem), + Some(job_private_key_pem), + ) = ( + &tls.gg_cert_pem, + &tls.gg_private_key_pem, + &tls.job_cert_pem, + &tls.job_private_key_pem, + ) { + wf.sub_workflow(|swf| { + let base_zone_id = unwrap!( + util::env::cloudflare::zone::main::id(), + "dns not configured" + ); + let job_zone_id = unwrap!( + util::env::cloudflare::zone::job::id(), + "dns not configured" + ); + let domain_main = unwrap!(util::env::domain_main(), "dns not enabled"); + let domain_job = unwrap!(util::env::domain_job(), "dns not enabled"); - build_delivery_method: cluster::types::BuildDeliveryMethod, - prebakes_enabled: bool, + #[derive(Serialize, Hash)] + struct OrderInput { + renew: bool, + zone_id: String, + common_name: String, + subject_alternative_names: Vec, + } + + swf.activity( + "order", + OrderInput { + renew: false, + zone_id: base_zone_id.to_string(), + common_name: domain_main.to_string(), + subject_alternative_names: vec![format!( + "*.{}.{domain_main}", + dc.datacenter_id + )], + }, + json!({ + "cert": gg_cert_pem, + "private_key": gg_private_key_pem, + "expire_ts": tls.expire_ts, + }), + )?; + + swf.activity( + "order", + OrderInput { + renew: false, + zone_id: job_zone_id.to_string(), + common_name: domain_job.to_string(), + subject_alternative_names: vec![ + format!("*.lobby.{}.{domain_job}", dc.datacenter_id), + format!("*.{}.{domain_job}", dc.datacenter_id), + ], + }, + json!({ + "cert": job_cert_pem, + "private_key": job_private_key_pem, + "expire_ts": tls.expire_ts, + }), + )?; + + #[derive(Serialize, Hash)] + struct InsertDbInput { + datacenter_id: Uuid, + gg_cert: String, + gg_private_key: String, + job_cert: String, + job_private_key: String, + expire_ts: i64, + } + + swf.activity( + "insert_db", + InsertDbInput { + datacenter_id: dc.datacenter_id, + gg_cert: gg_cert_pem.clone(), + gg_private_key: gg_private_key_pem.clone(), + job_cert: job_cert_pem.clone(), + job_private_key: job_private_key_pem.clone(), + expire_ts: tls.expire_ts, + }, + serde_json::Value::Null, + )?; + + Ok(()) + })?; + } + + wf.message( + "cluster_datacenter_create_complete", + json!({ + "datacenter_id": dc.datacenter_id, + }), + cluster::workflows::datacenter::CreateComplete {}, + )?; + + // Scale + wf.sub_workflow(|swf| { + #[derive(Serialize, Hash)] + struct CalculateDiffInput { + datacenter_id: Uuid, + } + + swf.activity( + "calculate_diff", + CalculateDiffInput { + datacenter_id: dc.datacenter_id, + }, + json!({ + "actions": [], + }), + )?; + + Ok(()) + })?; + + Ok(()) + })?; + } + + #[derive(Debug, sqlx::FromRow)] + struct ServerRow { + server_id: Uuid, + datacenter_id: Uuid, + pool_type: i64, + provider_server_id: Option, + provider_hardware: Option, + vlan_ip: Option, + public_ip: Option, + is_provisioned: bool, + is_installed: bool, + is_draining: bool, + is_tainted: bool, + } + #[derive(Debug, sqlx::FromRow)] + struct ServerLinodeRow { + server_id: Uuid, + ssh_key_id: i64, + linode_id: Option, + firewall_id: Option, + } + #[derive(sqlx::FromRow)] + struct ServerCfRow { + server_id: Uuid, + dns_record_id: Option, + secondary_dns_record_id: Option, } - wf.activity( - "insert_db", - InsertDbInput { - cluster_id: dc.cluster_id, - datacenter_id: dc.datacenter_id, - name_id: dc.name_id.clone(), - display_name: dc.display_name.clone(), - - provider: unwrap!(cluster::types::Provider::from_repr(dc.provider.try_into()?)), - provider_datacenter_id: dc.provider_datacenter_id.clone(), - provider_api_token: dc.provider_api_token.clone(), - - pools: { - let proto = backend::cluster::Pools::decode(dc.pools.as_slice())?.pools; - - proto - .into_iter() - .map(TryInto::try_into) - .collect::>>()? - }, - - build_delivery_method: unwrap!(cluster::types::BuildDeliveryMethod::from_repr( - dc.build_delivery_method.try_into()?, - )), - prebakes_enabled: false, - }, - serde_json::Value::Null, - )?; - - // Tls issue - if let ( - Some(gg_cert_pem), - Some(gg_private_key_pem), - Some(job_cert_pem), - Some(job_private_key_pem), - ) = ( - &tls.gg_cert_pem, - &tls.gg_private_key_pem, - &tls.job_cert_pem, - &tls.job_private_key_pem, - ) { - wf.sub_workflow(|swf| { - let base_zone_id = unwrap!( - util::env::cloudflare::zone::main::id(), - "dns not configured" - ); - let job_zone_id = - unwrap!(util::env::cloudflare::zone::job::id(), "dns not configured"); - let domain_main = unwrap!(util::env::domain_main(), "dns not enabled"); - let domain_job = unwrap!(util::env::domain_job(), "dns not enabled"); + let server_rows = sql_fetch_all!( + [ctx, ServerRow, @tx tx] + " + SELECT + server_id, + datacenter_id, + pool_type, + provider_server_id, + provider_hardware, + vlan_ip, + public_ip, + (provision_complete_ts IS NOT NULL) AS is_provisioned, + (install_complete_ts IS NOT NULL) AS is_installed, + (drain_ts IS NOT NULL) AS is_draining, + (taint_ts IS NOT NULL) AS is_tainted + FROM db_cluster.servers + WHERE cloud_destroy_ts IS NULL + ", + ) + .await?; + let server_linode_rows = sql_fetch_all!( + [ctx, ServerLinodeRow, @tx tx] + " + SELECT + server_id, + ssh_key_id, + linode_id, + firewall_id + FROM db_cluster.servers_linode + WHERE destroy_ts IS NULL + ", + ) + .await?; + let server_cf_rows = sql_fetch_all!( + [ctx, ServerCfRow, @tx tx] + " + SELECT + server_id, + dns_record_id, + secondary_dns_record_id + FROM db_cluster.servers_cloudflare + ", + ) + .await?; + + for server in server_rows { + let dc = unwrap!(dc_rows + .iter() + .find(|dc| dc.datacenter_id == server.datacenter_id)); + let pools = { + let proto = backend::cluster::Pools::decode(dc.pools.as_slice())?.pools; + + proto + .into_iter() + .map(TryInto::::try_into) + .collect::>>()? + }; + let pool_type = unwrap!(cluster::types::PoolType::from_repr( + server.pool_type.try_into()? + )); + let pool = unwrap!(pools.iter().find(|p| p.pool_type == pool_type)); + + let linode = server_linode_rows + .iter() + .find(|s| s.server_id == server.server_id); + let cf = server_cf_rows + .iter() + .find(|s| s.server_id == server.server_id); + + let install_token = create_token(&ctx).await?; + + let firewall_preset = match pool_type { + cluster::types::PoolType::Job | cluster::types::PoolType::Pegboard => { + linode::types::FirewallPreset::Job + } + cluster::types::PoolType::Gg => linode::types::FirewallPreset::Gg, + cluster::types::PoolType::Ats => linode::types::FirewallPreset::Ats, + }; + + let linode_server_workflow_id = bctx.workflow("linode_server", |wf| { + wf.tags(json!({ + "server_id": server.server_id, + }))?; + wf.input(json!({ + "server_id": server.server_id, + "provider_datacenter_id": dc.provider_datacenter_id, + "custom_image": Option::::None, + "hardware": unwrap!(pool.hardware.first()).provider_hardware, + "api_token": dc.provider_api_token.clone(), + "firewall_preset": firewall_preset.clone(), + "vlan_ip": server.vlan_ip, + "tags": [], + }))?; + wf.finalize(); + + let Some(linode) = linode else { return Ok(()) }; + + let Some(linode_id) = linode.linode_id else { + return Ok(()); + }; + let linode_id = linode_id as u64; #[derive(Serialize, Hash)] - struct OrderInput { - renew: bool, - zone_id: String, - common_name: String, - subject_alternative_names: Vec, + struct CreateSshKeyInput { + server_id: Uuid, + api_token: Option, + is_test: bool, } - swf.activity( - "order", - OrderInput { - renew: false, - zone_id: base_zone_id.to_string(), - common_name: domain_main.to_string(), - subject_alternative_names: vec![format!( - "*.{}.{domain_main}", - dc.datacenter_id - )], + wf.activity( + "create_ssh_key", + CreateSshKeyInput { + server_id: server.server_id, + api_token: dc.provider_api_token.clone(), + is_test: false, }, json!({ - "cert": gg_cert_pem, - "private_key": gg_private_key_pem, - "expire_ts": tls.expire_ts, + "ssh_key_id": linode.ssh_key_id, + // Not the actual public key, but not required + "public_key": "", }), )?; - swf.activity( - "order", - OrderInput { - renew: false, - zone_id: job_zone_id.to_string(), - common_name: domain_job.to_string(), - subject_alternative_names: vec![ - format!("*.lobby.{}.{domain_job}", dc.datacenter_id), - format!("*.{}.{domain_job}", dc.datacenter_id), - ], + let ns = util::env::namespace(); + let tags = vec![ + // HACK: Linode requires tags to be > 3 characters. We extend the namespace to make sure it + // meets the minimum length requirement. + format!("rivet-{ns}"), + format!("{ns}-{}", dc.provider_datacenter_id), + format!("{ns}-{}", firewall_preset), + format!("{ns}-{}-{}", dc.provider_datacenter_id, firewall_preset), + ]; + + #[derive(Serialize, Hash)] + struct CreateInstanceInput { + api_token: Option, + ssh_public_key: String, + name: String, + datacenter: String, + hardware: String, + tags: Vec, + } + + wf.activity( + "create_instance", + CreateInstanceInput { + api_token: dc.provider_api_token.clone(), + // Not the actual public key, but not required + ssh_public_key: "".to_string(), + name: format!("{ns}-{}", server.server_id), + datacenter: dc.provider_datacenter_id.clone(), + hardware: unwrap!(pool.hardware.first()).provider_hardware.clone(), + tags: tags.clone(), }, json!({ - "cert": job_cert_pem, - "private_key": job_private_key_pem, - "expire_ts": tls.expire_ts, + "linode_id": linode_id, + // Not the actual server disk size, but not required + "server_disk_size": 0, }), )?; #[derive(Serialize, Hash)] - struct InsertDbInput { - datacenter_id: Uuid, - gg_cert: String, - gg_private_key: String, - job_cert: String, - job_private_key: String, - expire_ts: i64, + struct WaitInstanceReadyInput { + api_token: Option, + linode_id: u64, } - swf.activity( - "insert_db", - InsertDbInput { - datacenter_id: dc.datacenter_id, - gg_cert: gg_cert_pem.clone(), - gg_private_key: gg_private_key_pem.clone(), - job_cert: job_cert_pem.clone(), - job_private_key: job_private_key_pem.clone(), - expire_ts: tls.expire_ts, + wf.activity( + "wait_instance_ready", + WaitInstanceReadyInput { + api_token: dc.provider_api_token.clone(), + linode_id, }, serde_json::Value::Null, )?; - Ok(()) - })?; - } + #[derive(Serialize, Hash)] + struct CreateBootDiskInput { + api_token: Option, + image: String, + ssh_public_key: String, + linode_id: u64, + disk_size: u64, + } - wf.message( - "cluster_datacenter_create_complete", - json!({ - "datacenter_id": dc.datacenter_id, - }), - cluster::workflows::datacenter::CreateComplete {}, - )?; - - // Scale - wf.sub_workflow(|swf| { - #[derive(Serialize, Hash)] - struct CalculateDiffInput { - datacenter_id: Uuid, - } + wf.activity( + "create_boot_disk", + CreateBootDiskInput { + api_token: dc.provider_api_token.clone(), + image: "linode/debian11".to_string(), + // Not the actual public key, but not required + ssh_public_key: "".to_string(), + linode_id, + // Not the actual server disk size, but not required + disk_size: 0, + }, + // Not the actual boot id, but not required + 0, + )?; - swf.activity( - "calculate_diff", - CalculateDiffInput { - datacenter_id: dc.datacenter_id, - }, - json!({ - "actions": [], - }), - )?; + #[derive(Serialize, Hash)] + struct WaitDiskReadyInput { + api_token: Option, + linode_id: u64, + disk_id: u64, + } - Ok(()) - })?; + wf.activity( + "wait_disk_ready", + WaitDiskReadyInput { + api_token: dc.provider_api_token.clone(), + linode_id, + // Not the actual boot id, but not required + disk_id: 0, + }, + serde_json::Value::Null, + )?; - Ok(()) - })?; - } - - #[derive(Debug, sqlx::FromRow)] - struct ServerRow { - server_id: Uuid, - datacenter_id: Uuid, - pool_type: i64, - provider_server_id: Option, - provider_hardware: Option, - vlan_ip: Option, - public_ip: Option, - is_provisioned: bool, - is_installed: bool, - is_draining: bool, - is_tainted: bool, - } - #[derive(Debug, sqlx::FromRow)] - struct ServerLinodeRow { - server_id: Uuid, - ssh_key_id: i64, - linode_id: Option, - firewall_id: Option, - } - #[derive(sqlx::FromRow)] - struct ServerCfRow { - server_id: Uuid, - dns_record_id: Option, - secondary_dns_record_id: Option, - } - - let server_rows = sql_fetch_all!( - [ctx, ServerRow, @tx &mut tx] - " - SELECT - server_id, - datacenter_id, - pool_type, - provider_server_id, - provider_hardware, - vlan_ip, - public_ip, - (provision_complete_ts IS NOT NULL) AS is_provisioned, - (install_complete_ts IS NOT NULL) AS is_installed, - (drain_ts IS NOT NULL) AS is_draining, - (taint_ts IS NOT NULL) AS is_tainted - FROM db_cluster.servers - WHERE cloud_destroy_ts IS NULL - ", - ) - .await?; - let server_linode_rows = sql_fetch_all!( - [ctx, ServerLinodeRow, @tx &mut tx] - " - SELECT - server_id, - ssh_key_id, - linode_id, - firewall_id - FROM db_cluster.servers_linode - WHERE destroy_ts IS NULL - ", - ) - .await?; - let server_cf_rows = sql_fetch_all!( - [ctx, ServerCfRow, @tx &mut tx] - " - SELECT - server_id, - dns_record_id, - secondary_dns_record_id - FROM db_cluster.servers_cloudflare - ", - ) - .await?; + #[derive(Serialize, Hash)] + struct CreateSwapDiskInput { + api_token: Option, + linode_id: u64, + } - for server in server_rows { - let dc = unwrap!(dc_rows - .iter() - .find(|dc| dc.datacenter_id == server.datacenter_id)); - let pools = { - let proto = backend::cluster::Pools::decode(dc.pools.as_slice())?.pools; - - proto - .into_iter() - .map(TryInto::::try_into) - .collect::>>()? - }; - let pool_type = unwrap!(cluster::types::PoolType::from_repr( - server.pool_type.try_into()? - )); - let pool = unwrap!(pools.iter().find(|p| p.pool_type == pool_type)); - - let linode = server_linode_rows - .iter() - .find(|s| s.server_id == server.server_id); - let cf = server_cf_rows - .iter() - .find(|s| s.server_id == server.server_id); - - let install_token = create_token(&ctx).await?; - - let firewall_preset = match pool_type { - cluster::types::PoolType::Job | cluster::types::PoolType::Pegboard => { - linode::types::FirewallPreset::Job - } - cluster::types::PoolType::Gg => linode::types::FirewallPreset::Gg, - cluster::types::PoolType::Ats => linode::types::FirewallPreset::Ats, - }; - - let linode_server_workflow_id = bctx.workflow("linode_server", |wf| { - wf.tags(json!({ - "server_id": server.server_id, - }))?; - wf.input(json!({ - "server_id": server.server_id, - "provider_datacenter_id": dc.provider_datacenter_id, - "custom_image": Option::::None, - "hardware": unwrap!(pool.hardware.first()).provider_hardware, - "api_token": dc.provider_api_token.clone(), - "firewall_preset": firewall_preset.clone(), - "vlan_ip": server.vlan_ip, - "tags": [], - }))?; - wf.finalize(); - - let Some(linode) = linode else { return Ok(()) }; - - let Some(linode_id) = linode.linode_id else { - return Ok(()); - }; - let linode_id = linode_id as u64; - - #[derive(Serialize, Hash)] - struct CreateSshKeyInput { - server_id: Uuid, - api_token: Option, - is_test: bool, - } + wf.activity( + "create_swap_disk", + CreateSwapDiskInput { + api_token: dc.provider_api_token.clone(), + linode_id, + }, + // Not the actual boot id, but not required + 0, + )?; - wf.activity( - "create_ssh_key", - CreateSshKeyInput { - server_id: server.server_id, - api_token: dc.provider_api_token.clone(), - is_test: false, - }, - json!({ - "ssh_key_id": linode.ssh_key_id, - // Not the actual public key, but not required - "public_key": "", - }), - )?; - - let ns = util::env::namespace(); - let tags = vec![ - // HACK: Linode requires tags to be > 3 characters. We extend the namespace to make sure it - // meets the minimum length requirement. - format!("rivet-{ns}"), - format!("{ns}-{}", dc.provider_datacenter_id), - format!("{ns}-{}", firewall_preset), - format!("{ns}-{}-{}", dc.provider_datacenter_id, firewall_preset), - ]; - - #[derive(Serialize, Hash)] - struct CreateInstanceInput { - api_token: Option, - ssh_public_key: String, - name: String, - datacenter: String, - hardware: String, - tags: Vec, - } + #[derive(Serialize, Hash)] + struct CreateInstanceConfigInput { + api_token: Option, + vlan_ip: Option, + linode_id: u64, + boot_disk_id: u64, + swap_disk_id: u64, + } - wf.activity( - "create_instance", - CreateInstanceInput { - api_token: dc.provider_api_token.clone(), - // Not the actual public key, but not required - ssh_public_key: "".to_string(), - name: format!("{ns}-{}", server.server_id), - datacenter: dc.provider_datacenter_id.clone(), - hardware: unwrap!(pool.hardware.first()).provider_hardware.clone(), - tags: tags.clone(), - }, - json!({ - "linode_id": linode_id, - // Not the actual server disk size, but not required - "server_disk_size": 0, - }), - )?; - - #[derive(Serialize, Hash)] - struct WaitInstanceReadyInput { - api_token: Option, - linode_id: u64, - } + wf.activity( + "create_instance_config", + CreateInstanceConfigInput { + api_token: dc.provider_api_token.clone(), + vlan_ip: server + .vlan_ip + .map(|vlan_ip| { + if let IpAddr::V4(vlan_ip) = vlan_ip { + GlobalResult::Ok(vlan_ip) + } else { + bail!("unexpected ipv6"); + } + }) + .transpose()?, + linode_id, + // Not the actual boot id, but not required + boot_disk_id: 0, + // Not the actual swap id, but not required + swap_disk_id: 0, + }, + serde_json::Value::Null, + )?; - wf.activity( - "wait_instance_ready", - WaitInstanceReadyInput { - api_token: dc.provider_api_token.clone(), - linode_id, - }, - serde_json::Value::Null, - )?; - - #[derive(Serialize, Hash)] - struct CreateBootDiskInput { - api_token: Option, - image: String, - ssh_public_key: String, - linode_id: u64, - disk_size: u64, - } + let Some(firewall_id) = linode.firewall_id else { + return Ok(()); + }; + + #[derive(Debug, Serialize, Deserialize, Hash)] + struct CreateFirewallInput { + server_id: Uuid, + api_token: Option, + firewall_preset: linode::types::FirewallPreset, + tags: Vec, + linode_id: u64, + } - wf.activity( - "create_boot_disk", - CreateBootDiskInput { - api_token: dc.provider_api_token.clone(), - image: "linode/debian11".to_string(), - // Not the actual public key, but not required - ssh_public_key: "".to_string(), - linode_id, - // Not the actual server disk size, but not required - disk_size: 0, - }, - // Not the actual boot id, but not required - 0, - )?; - - #[derive(Serialize, Hash)] - struct WaitDiskReadyInput { - api_token: Option, - linode_id: u64, - disk_id: u64, - } + wf.activity( + "create_firewall", + CreateFirewallInput { + server_id: server.server_id, + api_token: dc.provider_api_token.clone(), + firewall_preset: firewall_preset.clone(), + tags, + linode_id, + }, + firewall_id, + )?; - wf.activity( - "wait_disk_ready", - WaitDiskReadyInput { - api_token: dc.provider_api_token.clone(), - linode_id, - // Not the actual boot id, but not required - disk_id: 0, - }, - serde_json::Value::Null, - )?; - - #[derive(Serialize, Hash)] - struct CreateSwapDiskInput { - api_token: Option, - linode_id: u64, - } + #[derive(Debug, Serialize, Deserialize, Hash)] + struct BootInstanceInput { + api_token: Option, + linode_id: u64, + } - wf.activity( - "create_swap_disk", - CreateSwapDiskInput { - api_token: dc.provider_api_token.clone(), - linode_id, - }, - // Not the actual boot id, but not required - 0, - )?; - - #[derive(Serialize, Hash)] - struct CreateInstanceConfigInput { - api_token: Option, - vlan_ip: Option, - linode_id: u64, - boot_disk_id: u64, - swap_disk_id: u64, - } + wf.activity( + "boot_instance", + BootInstanceInput { + api_token: dc.provider_api_token.clone(), + linode_id, + }, + serde_json::Value::Null, + )?; - wf.activity( - "create_instance_config", - CreateInstanceConfigInput { - api_token: dc.provider_api_token.clone(), - vlan_ip: server - .vlan_ip - .map(|vlan_ip| { - if let IpAddr::V4(vlan_ip) = vlan_ip { - GlobalResult::Ok(vlan_ip) - } else { - bail!("unexpected ipv6"); - } - }) - .transpose()?, - linode_id, - // Not the actual boot id, but not required - boot_disk_id: 0, - // Not the actual swap id, but not required - swap_disk_id: 0, - }, - serde_json::Value::Null, - )?; - - let Some(firewall_id) = linode.firewall_id else { - return Ok(()); - }; - - #[derive(Debug, Serialize, Deserialize, Hash)] - struct CreateFirewallInput { - server_id: Uuid, - api_token: Option, - firewall_preset: linode::types::FirewallPreset, - tags: Vec, - linode_id: u64, - } + let public_ip = if let Some(public_ip) = server.public_ip { + if let IpAddr::V4(public_ip) = public_ip { + public_ip + } else { + bail!("unexpected ipv6"); + } + } else { + return Ok(()); + }; - wf.activity( - "create_firewall", - CreateFirewallInput { - server_id: server.server_id, - api_token: dc.provider_api_token.clone(), - firewall_preset: firewall_preset.clone(), - tags, - linode_id, - }, - firewall_id, - )?; - - #[derive(Debug, Serialize, Deserialize, Hash)] - struct BootInstanceInput { - api_token: Option, - linode_id: u64, - } + #[derive(Serialize, Hash)] + struct GetPublicIpInput { + api_token: Option, + linode_id: u64, + } - wf.activity( - "boot_instance", - BootInstanceInput { - api_token: dc.provider_api_token.clone(), - linode_id, - }, - serde_json::Value::Null, - )?; - - let public_ip = if let Some(public_ip) = server.public_ip { - if let IpAddr::V4(public_ip) = public_ip { - public_ip - } else { - bail!("unexpected ipv6"); - } - } else { - return Ok(()); - }; - - #[derive(Serialize, Hash)] - struct GetPublicIpInput { - api_token: Option, - linode_id: u64, - } + wf.activity( + "get_public_ip", + GetPublicIpInput { + api_token: dc.provider_api_token.clone(), + linode_id, + }, + public_ip, + )?; - wf.activity( - "get_public_ip", - GetPublicIpInput { - api_token: dc.provider_api_token.clone(), - linode_id, - }, - public_ip, - )?; - - wf.signal( - "linode_server_provision_complete", - json!({ - "linode_id": linode_id, - "public_ip": public_ip, - // Not actual boot disk id, but not required - "boot_disk_id": 0, - }), - )?; + wf.signal( + "linode_server_provision_complete", + json!({ + "linode_id": linode_id, + "public_ip": public_ip, + // Not actual boot disk id, but not required + "boot_disk_id": 0, + }), + )?; - Ok(()) - })?; - - bctx.workflow("cluster_server", |wf| { - wf.tags(json!({ - "server_id": server.server_id, - }))?; - wf.input(json!({ - "datacenter_id": server.datacenter_id, - "server_id": server.server_id, - "pool_type": pool_type, - "tags": [], - }))?; - wf.finalize(); - - #[derive(Serialize, Hash)] - struct GetDcInput { - datacenter_id: Uuid, - } + Ok(()) + })?; - wf.activity( - "get_dc", - GetDcInput { - datacenter_id: server.datacenter_id, - }, - cluster::types::Datacenter { - cluster_id: dc.cluster_id, - datacenter_id: dc.datacenter_id, - name_id: dc.name_id.clone(), - display_name: dc.display_name.clone(), - - provider: unwrap!(cluster::types::Provider::from_repr(dc.provider.try_into()?)), - provider_datacenter_id: dc.provider_datacenter_id.clone(), - provider_api_token: dc.provider_api_token.clone(), - - pools: { - let proto = backend::cluster::Pools::decode(dc.pools.as_slice())?.pools; - - proto - .into_iter() - .map(TryInto::try_into) - .collect::>>()? - }, - - build_delivery_method: unwrap!(cluster::types::BuildDeliveryMethod::from_repr( - dc.build_delivery_method.try_into()?, - )), - prebakes_enabled: false, - create_ts: util::timestamp::now(), - }, - )?; - - let vlan_ip = if let Some(vlan_ip) = server.vlan_ip { - if let IpAddr::V4(vlan_ip) = vlan_ip { - vlan_ip - } else { - bail!("unexpected ipv6"); - } - } else { - return Ok(()); - }; + bctx.workflow("cluster_server", |wf| { + wf.tags(json!({ + "server_id": server.server_id, + }))?; + wf.input(json!({ + "datacenter_id": server.datacenter_id, + "server_id": server.server_id, + "pool_type": pool_type, + "tags": [], + }))?; + wf.finalize(); - #[derive(Serialize, Hash)] - struct GetVlanIpInput { - datacenter_id: Uuid, - server_id: Uuid, - pool_type: cluster::types::PoolType, - } + #[derive(Serialize, Hash)] + struct GetDcInput { + datacenter_id: Uuid, + } - wf.activity( - "get_vlan_ip", - GetVlanIpInput { - datacenter_id: server.datacenter_id, - server_id: server.server_id, - pool_type, - }, - vlan_ip, - )?; + wf.activity( + "get_dc", + GetDcInput { + datacenter_id: server.datacenter_id, + }, + cluster::types::Datacenter { + cluster_id: dc.cluster_id, + datacenter_id: dc.datacenter_id, + name_id: dc.name_id.clone(), + display_name: dc.display_name.clone(), + + provider: unwrap!(cluster::types::Provider::from_repr( + dc.provider.try_into()? + )), + provider_datacenter_id: dc.provider_datacenter_id.clone(), + provider_api_token: dc.provider_api_token.clone(), + + pools: { + let proto = + backend::cluster::Pools::decode(dc.pools.as_slice())?.pools; + + proto + .into_iter() + .map(TryInto::try_into) + .collect::>>()? + }, - wf.dispatch_sub_workflow(linode_server_workflow_id)?; + build_delivery_method: unwrap!( + cluster::types::BuildDeliveryMethod::from_repr( + dc.build_delivery_method.try_into()?, + ) + ), + prebakes_enabled: false, + create_ts: util::timestamp::now(), + }, + )?; - if !server.is_provisioned { - return Ok(()); - } + let vlan_ip = if let Some(vlan_ip) = server.vlan_ip { + if let IpAddr::V4(vlan_ip) = vlan_ip { + vlan_ip + } else { + bail!("unexpected ipv6"); + } + } else { + return Ok(()); + }; - let public_ip = if let IpAddr::V4(public_ip) = unwrap!(server.public_ip) { - public_ip - } else { - bail!("unexpected ipv6"); - }; - - wf.listen( - "linode_server_provision_complete", - json!({ - "linode_id": unwrap!(unwrap!(linode, "no linode row").linode_id, "no linode id"), - "public_ip": public_ip, - "boot_disk_id": 0, - }), - )?; - - #[derive(Serialize, Hash)] - struct UpdateDbInput { - server_id: Uuid, - pool_type: cluster::types::PoolType, - cluster_id: Uuid, - datacenter_id: Uuid, - provider_datacenter_id: String, - datacenter_name_id: String, - provider_server_id: String, - provider_hardware: String, - public_ip: Ipv4Addr, - already_installed: bool, - } + #[derive(Serialize, Hash)] + struct GetVlanIpInput { + datacenter_id: Uuid, + server_id: Uuid, + pool_type: cluster::types::PoolType, + } - wf.activity( - "update_db", - UpdateDbInput { - server_id: server.server_id, - pool_type, - cluster_id: dc.cluster_id, - datacenter_id: server.datacenter_id, - provider_datacenter_id: dc.provider_datacenter_id.clone(), - datacenter_name_id: dc.name_id.clone(), - provider_server_id: unwrap!(server.provider_server_id.clone()), - provider_hardware: unwrap!(server.provider_hardware.clone()), - public_ip, - already_installed: false, - }, - serde_json::Value::Null, - )?; + wf.activity( + "get_vlan_ip", + GetVlanIpInput { + datacenter_id: server.datacenter_id, + server_id: server.server_id, + pool_type, + }, + vlan_ip, + )?; - if !server.is_installed { - return Ok(()); - } + wf.dispatch_sub_workflow(linode_server_workflow_id)?; - // Install - wf.sub_workflow(|swf| { - #[derive(Serialize, Hash)] - struct CreateTokenInput {} + if !server.is_provisioned { + return Ok(()); + } - swf.activity("create_token", CreateTokenInput {}, install_token.clone())?; + let public_ip = if let IpAddr::V4(public_ip) = unwrap!(server.public_ip) { + public_ip + } else { + bail!("unexpected ipv6"); + }; - #[derive(Serialize, Hash)] - struct InstallOverSshInput { - datacenter_id: Uuid, - public_ip: Ipv4Addr, - pool_type: cluster::types::PoolType, - initialize_immediately: bool, - server_token: String, - } + wf.listen( + "linode_server_provision_complete", + json!({ + "linode_id": unwrap!(unwrap!(linode, "no linode row").linode_id, "no linode id"), + "public_ip": public_ip, + "boot_disk_id": 0, + }), + )?; - swf.activity( - "install_over_ssh", - InstallOverSshInput { - datacenter_id: server.datacenter_id, - public_ip, - pool_type, - initialize_immediately: true, - server_token: install_token.clone(), - }, - serde_json::Value::Null, - )?; - - #[derive(Serialize, Hash)] - struct UpdateDbInput { - datacenter_id: Uuid, - server_id: Uuid, - pool_type: cluster::types::PoolType, - } + #[derive(Serialize, Hash)] + struct UpdateDbInput { + server_id: Uuid, + pool_type: cluster::types::PoolType, + cluster_id: Uuid, + datacenter_id: Uuid, + provider_datacenter_id: String, + datacenter_name_id: String, + provider_server_id: String, + provider_hardware: String, + public_ip: Ipv4Addr, + already_installed: bool, + } - swf.activity( - "update_db", - UpdateDbInput { - datacenter_id: server.datacenter_id, - server_id: server.server_id, - pool_type, - }, - serde_json::Value::Null, - )?; - - Ok(()) - })?; - - wf.signal( - "cluster_datacenter_scale", - cluster::workflows::datacenter::Scale {}, - )?; - - if let cluster::types::PoolType::Gg = pool_type { - if let Some(cf) = cf { - // Dns create + wf.activity( + "update_db", + UpdateDbInput { + server_id: server.server_id, + pool_type, + cluster_id: dc.cluster_id, + datacenter_id: server.datacenter_id, + provider_datacenter_id: dc.provider_datacenter_id.clone(), + datacenter_name_id: dc.name_id.clone(), + provider_server_id: unwrap!(server.provider_server_id.clone()), + provider_hardware: unwrap!(server.provider_hardware.clone()), + public_ip, + already_installed: false, + }, + serde_json::Value::Null, + )?; + + if !server.is_installed { + return Ok(()); + } + + // Install wf.sub_workflow(|swf| { #[derive(Serialize, Hash)] - struct GetServerInfoInput { - server_id: Uuid, + struct CreateTokenInput {} + + swf.activity("create_token", CreateTokenInput {}, install_token.clone())?; + + #[derive(Serialize, Hash)] + struct InstallOverSshInput { + datacenter_id: Uuid, + public_ip: Ipv4Addr, + pool_type: cluster::types::PoolType, + initialize_immediately: bool, + server_token: String, } swf.activity( - "get_server_info", - GetServerInfoInput { - server_id: server.server_id, + "install_over_ssh", + InstallOverSshInput { + datacenter_id: server.datacenter_id, + public_ip, + pool_type, + initialize_immediately: true, + server_token: install_token.clone(), }, - json!({ - "datacenter_id": server.datacenter_id, - "public_ip": public_ip, - }), + serde_json::Value::Null, )?; - let zone_id = - unwrap!(util::env::cloudflare::zone::job::id(), "dns not configured"); - let domain_job = unwrap!(util::env::domain_job()); - #[derive(Serialize, Hash)] - struct CreateDnsRecordInput { - record_name: String, - public_ip: Ipv4Addr, - zone_id: String, + struct UpdateDbInput { + datacenter_id: Uuid, + server_id: Uuid, + pool_type: cluster::types::PoolType, } - if let Some(dns_record_id) = &cf.dns_record_id { - swf.activity( - "create_dns_record", - CreateDnsRecordInput { - record_name: format!( - "*.lobby.{}.{domain_job}", - server.datacenter_id - ), - public_ip, - zone_id: zone_id.to_string(), - }, - dns_record_id.clone(), - )?; - } + swf.activity( + "update_db", + UpdateDbInput { + datacenter_id: server.datacenter_id, + server_id: server.server_id, + pool_type, + }, + serde_json::Value::Null, + )?; - if let Some(secondary_dns_record_id) = &cf.secondary_dns_record_id { - swf.activity( - "create_dns_record", - CreateDnsRecordInput { - record_name: format!( - "lobby.{}.{domain_job}", - server.datacenter_id - ), - public_ip, - zone_id: zone_id.to_string(), - }, - secondary_dns_record_id.clone(), - )?; - } + Ok(()) + })?; - if cf.dns_record_id.is_some() && cf.secondary_dns_record_id.is_some() { - #[derive(Serialize, Hash)] - struct InsertDbInput { - server_id: Uuid, - primary_dns_record_id: String, - secondary_dns_record_id: String, - } + wf.signal( + "cluster_datacenter_scale", + cluster::workflows::datacenter::Scale {}, + )?; - swf.activity( - "insert_db", - InsertDbInput { - server_id: server.server_id, - primary_dns_record_id: unwrap!(cf.dns_record_id.clone()), - secondary_dns_record_id: unwrap!(cf - .secondary_dns_record_id - .clone()), - }, - serde_json::Value::Null, - )?; + if let cluster::types::PoolType::Gg = pool_type { + if let Some(cf) = cf { + // Dns create + wf.sub_workflow(|swf| { + #[derive(Serialize, Hash)] + struct GetServerInfoInput { + server_id: Uuid, + } + + swf.activity( + "get_server_info", + GetServerInfoInput { + server_id: server.server_id, + }, + json!({ + "datacenter_id": server.datacenter_id, + "public_ip": public_ip, + }), + )?; + + let zone_id = unwrap!( + util::env::cloudflare::zone::job::id(), + "dns not configured" + ); + let domain_job = unwrap!(util::env::domain_job()); + + #[derive(Serialize, Hash)] + struct CreateDnsRecordInput { + record_name: String, + public_ip: Ipv4Addr, + zone_id: String, + } + + if let Some(dns_record_id) = &cf.dns_record_id { + swf.activity( + "create_dns_record", + CreateDnsRecordInput { + record_name: format!( + "*.lobby.{}.{domain_job}", + server.datacenter_id + ), + public_ip, + zone_id: zone_id.to_string(), + }, + dns_record_id.clone(), + )?; + } + + if let Some(secondary_dns_record_id) = &cf.secondary_dns_record_id { + swf.activity( + "create_dns_record", + CreateDnsRecordInput { + record_name: format!( + "lobby.{}.{domain_job}", + server.datacenter_id + ), + public_ip, + zone_id: zone_id.to_string(), + }, + secondary_dns_record_id.clone(), + )?; + } + + if cf.dns_record_id.is_some() + && cf.secondary_dns_record_id.is_some() + { + #[derive(Serialize, Hash)] + struct InsertDbInput { + server_id: Uuid, + primary_dns_record_id: String, + secondary_dns_record_id: String, + } + + swf.activity( + "insert_db", + InsertDbInput { + server_id: server.server_id, + primary_dns_record_id: unwrap!(cf + .dns_record_id + .clone()), + secondary_dns_record_id: unwrap!(cf + .secondary_dns_record_id + .clone()), + }, + serde_json::Value::Null, + )?; + } + + Ok(()) + })?; } + } - Ok(()) - })?; - } - } + if server.is_draining { + wf.listen("cluster_server_drain", json!({}))?; + + // Don't need to add the sub workflow, it should be idempotent + } - if server.is_draining { - wf.listen("cluster_server_drain", json!({}))?; + if server.is_tainted { + wf.listen("cluster_server_taint", json!({}))?; + } - // Don't need to add the sub workflow, it should be idempotent + Ok(()) + })?; } - if server.is_tainted { - wf.listen("cluster_server_taint", json!({}))?; - } + bctx.execute(tx).await?; Ok(()) - })?; - } - - bctx.execute(&mut tx).await?; - - tx.commit().await?; + }) + }) + .await?; tracing::info!("backfill complete"); diff --git a/svc/pkg/cluster/standalone/workflow-backfill/src/main.rs b/svc/pkg/cluster/standalone/workflow-backfill/src/main.rs deleted file mode 100644 index d527e0912e..0000000000 --- a/svc/pkg/cluster/standalone/workflow-backfill/src/main.rs +++ /dev/null @@ -1,15 +0,0 @@ -use chirp_workflow::prelude::*; -use tracing_subscriber::prelude::*; - -#[tokio::main] -async fn main() -> GlobalResult<()> { - tracing_subscriber::registry() - .with( - tracing_logfmt::builder() - .layer() - .with_filter(tracing_subscriber::filter::LevelFilter::INFO), - ) - .init(); - - cluster_workflow_backfill::run_from_env().await -} diff --git a/svc/pkg/job/standalone/gc/src/lib.rs b/svc/pkg/job/standalone/gc/src/lib.rs index 1d93bacdf0..552d709719 100644 --- a/svc/pkg/job/standalone/gc/src/lib.rs +++ b/svc/pkg/job/standalone/gc/src/lib.rs @@ -27,6 +27,31 @@ lazy_static::lazy_static! { /// known jobs. pub const CHECK_ORPHANED_JOB_THRESHOLD: i64 = util::duration::hours(1); +pub async fn start() -> GlobalResult<()> { + // TODO: Handle ctrl-c + + let pools = rivet_pools::from_env("job-gc").await?; + + tokio::task::Builder::new() + .name("job_gc::health_checks") + .spawn(rivet_health_checks::run_standalone( + rivet_health_checks::Config { + pools: Some(pools.clone()), + }, + ))?; + + tokio::task::Builder::new() + .name("job_gc::metrics") + .spawn(rivet_metrics::run_standalone())?; + + let mut interval = tokio::time::interval(std::time::Duration::from_secs(60 * 15)); + loop { + interval.tick().await; + + run_from_env(util::timestamp::now(), pools.clone()).await?; + } +} + #[tracing::instrument(skip_all)] pub async fn run_from_env(ts: i64, pools: rivet_pools::Pools) -> GlobalResult<()> { let check_orphaned_ts = ts - CHECK_ORPHANED_JOB_THRESHOLD; diff --git a/svc/pkg/job/standalone/gc/src/main.rs b/svc/pkg/job/standalone/gc/src/main.rs deleted file mode 100644 index c8b6f59746..0000000000 --- a/svc/pkg/job/standalone/gc/src/main.rs +++ /dev/null @@ -1,32 +0,0 @@ -use std::time::Duration; - -use rivet_operation::prelude::*; - -fn main() -> GlobalResult<()> { - rivet_runtime::run(start()).unwrap() -} - -async fn start() -> GlobalResult<()> { - // TODO: Handle ctrl-c - - let pools = rivet_pools::from_env("job-gc").await?; - - tokio::task::Builder::new() - .name("job_gc::health_checks") - .spawn(rivet_health_checks::run_standalone( - rivet_health_checks::Config { - pools: Some(pools.clone()), - }, - ))?; - - tokio::task::Builder::new() - .name("job_gc::metrics") - .spawn(rivet_metrics::run_standalone())?; - - let mut interval = tokio::time::interval(Duration::from_secs(60 * 15)); - loop { - interval.tick().await; - - job_gc::run_from_env(util::timestamp::now(), pools.clone()).await?; - } -} diff --git a/svc/pkg/linode/src/util/api.rs b/svc/pkg/linode/src/util/api.rs index cb41c69375..70ffecf8ee 100644 --- a/svc/pkg/linode/src/util/api.rs +++ b/svc/pkg/linode/src/util/api.rs @@ -452,7 +452,7 @@ pub struct ListCustomImagesResponse { pub data: Vec, } -#[derive(Deserialize)] +#[derive(Clone, Deserialize)] pub struct CustomImage { pub id: String, pub created_by: Option, diff --git a/svc/pkg/linode/standalone/gc/src/lib.rs b/svc/pkg/linode/standalone/gc/src/lib.rs index 769928b323..708ccbf20c 100644 --- a/svc/pkg/linode/standalone/gc/src/lib.rs +++ b/svc/pkg/linode/standalone/gc/src/lib.rs @@ -7,6 +7,17 @@ use linode::util::{api, client}; use reqwest::header; use serde_json::json; +pub async fn start() -> GlobalResult<()> { + let pools = rivet_pools::from_env("linode-gc").await?; + + let mut interval = tokio::time::interval(std::time::Duration::from_secs(15)); + loop { + interval.tick().await; + + run_from_env(pools.clone()).await?; + } +} + #[tracing::instrument(skip_all)] pub async fn run_from_env(pools: rivet_pools::Pools) -> GlobalResult<()> { let client = chirp_client::SharedClient::from_env(pools.clone())?.wrap_new("linode-gc"); @@ -18,6 +29,7 @@ pub async fn run_from_env(pools: rivet_pools::Pools) -> GlobalResult<()> { ) .await?; + let secret = util::env::read_secret(&["linode", "token"]).await?; let dc_rows = sql_fetch_all!( [ctx, (i64, String,)] " @@ -28,10 +40,7 @@ pub async fn run_from_env(pools: rivet_pools::Pools) -> GlobalResult<()> { ) .await? .into_iter() - .chain(std::iter::once(( - Provider::Linode as i64, - util::env::read_secret(&["linode", "token"]).await?, - ))); + .chain(std::iter::once((Provider::Linode as i64, secret))); let filter = json!({ "status": "available", @@ -47,7 +56,9 @@ pub async fn run_from_env(pools: rivet_pools::Pools) -> GlobalResult<()> { let provider = unwrap!(Provider::from_repr(provider.try_into()?)); match provider { - Provider::Linode => run_for_linode_account(&ctx, &api_token, &headers).await?, + Provider::Linode => { + run_for_linode_account(ctx.clone(), api_token.clone(), &headers).await? + } } } @@ -55,13 +66,12 @@ pub async fn run_from_env(pools: rivet_pools::Pools) -> GlobalResult<()> { } async fn run_for_linode_account( - ctx: &StandaloneCtx, - api_token: &str, + ctx: StandaloneCtx, + api_token: String, headers: &header::HeaderMap, ) -> GlobalResult<()> { // Build HTTP client - let client = - client::Client::new_with_headers(Some(api_token.to_string()), headers.clone()).await?; + let client = client::Client::new_with_headers(Some(api_token), headers.clone()).await?; let complete_images = api::list_custom_images(&client).await?; @@ -72,7 +82,7 @@ async fn run_for_linode_account( tracing::warn!("page limit reached, new images may not be returned"); } - delete_expired_images(ctx, &complete_images).await?; + delete_expired_images(ctx.clone(), complete_images.clone()).await?; // Get image ids let image_ids = complete_images @@ -117,8 +127,8 @@ async fn run_for_linode_account( } async fn delete_expired_images( - ctx: &StandaloneCtx, - complete_images: &[api::CustomImage], + ctx: StandaloneCtx, + complete_images: Vec, ) -> GlobalResult<()> { // Prebake images have an expiration because of their server token. We add 2 days of padding here for // safety @@ -135,13 +145,13 @@ async fn delete_expired_images( tracing::info!(count=?expired_images_count, "deleting expired images"); } - futures_util::stream::iter(expired_images) + futures_util::stream::iter(expired_images.cloned().collect::>()) .map(|img| { let ctx = ctx.clone(); async move { ctx.signal(linode::workflows::image::Destroy {}) - .tag("image_id", &img.id) + .tag("image_id", img.id) .send() .await } diff --git a/svc/pkg/linode/standalone/gc/src/main.rs b/svc/pkg/linode/standalone/gc/src/main.rs deleted file mode 100644 index 43207f627a..0000000000 --- a/svc/pkg/linode/standalone/gc/src/main.rs +++ /dev/null @@ -1,30 +0,0 @@ -use std::time::Duration; - -use chirp_workflow::prelude::*; - -fn main() -> GlobalResult<()> { - rivet_runtime::run(start()).unwrap() -} - -async fn start() -> GlobalResult<()> { - let pools = rivet_pools::from_env("linode-gc").await?; - - tokio::task::Builder::new() - .name("linode_gc::health_checks") - .spawn(rivet_health_checks::run_standalone( - rivet_health_checks::Config { - pools: Some(pools.clone()), - }, - ))?; - - tokio::task::Builder::new() - .name("linode_gc::metrics") - .spawn(rivet_metrics::run_standalone())?; - - let mut interval = tokio::time::interval(Duration::from_secs(15)); - loop { - interval.tick().await; - - linode_gc::run_from_env(pools.clone()).await?; - } -} diff --git a/svc/pkg/load-test/standalone/api-cloud/src/lib.rs b/svc/pkg/load-test/standalone/api-cloud/src/lib.rs index b24ea06526..8f67aa2e6d 100644 --- a/svc/pkg/load-test/standalone/api-cloud/src/lib.rs +++ b/svc/pkg/load-test/standalone/api-cloud/src/lib.rs @@ -3,6 +3,14 @@ use rivet_api::apis::configuration::Configuration; use rivet_operation::prelude::*; use tokio::time::{Duration, Instant}; +pub async fn start() -> GlobalResult<()> { + run_from_env(util::timestamp::now()).await?; + + tracing::info!("finished"); + + Ok(()) +} + #[tracing::instrument(skip_all)] pub async fn run_from_env(_ts: i64) -> GlobalResult<()> { let pools = rivet_pools::from_env("load-test-api-cloud").await?; diff --git a/svc/pkg/load-test/standalone/api-cloud/src/main.rs b/svc/pkg/load-test/standalone/api-cloud/src/main.rs deleted file mode 100644 index 8d8235c52f..0000000000 --- a/svc/pkg/load-test/standalone/api-cloud/src/main.rs +++ /dev/null @@ -1,15 +0,0 @@ -use rivet_operation::prelude::*; - -fn main() -> GlobalResult<()> { - rivet_runtime::run(start()).unwrap() -} - -async fn start() -> GlobalResult<()> { - load_test_api_cloud::run_from_env(util::timestamp::now()).await?; - - tracing::info!("finished"); - - std::future::pending::<()>().await; - - Ok(()) -} diff --git a/svc/pkg/load-test/standalone/mm-sustain/src/lib.rs b/svc/pkg/load-test/standalone/mm-sustain/src/lib.rs index 5848b38ff4..6eda0d8d3e 100644 --- a/svc/pkg/load-test/standalone/mm-sustain/src/lib.rs +++ b/svc/pkg/load-test/standalone/mm-sustain/src/lib.rs @@ -7,6 +7,19 @@ use tokio::time::Instant; const PARALLEL_WORKERS: usize = 1; +pub async fn start() -> GlobalResult<()> { + // TODO: Handle ctrl-c + + let pools = rivet_pools::from_env("job-gc").await?; + + let mut interval = tokio::time::interval(std::time::Duration::from_secs(60 * 15)); + loop { + interval.tick().await; + + run_from_env(util::timestamp::now()).await?; + } +} + #[tracing::instrument(skip_all)] pub async fn run_from_env(_ts: i64) -> GlobalResult<()> { let pools = rivet_pools::from_env("load-test-mm-sustain").await?; diff --git a/svc/pkg/load-test/standalone/mm-sustain/src/main.rs b/svc/pkg/load-test/standalone/mm-sustain/src/main.rs deleted file mode 100644 index c958feda66..0000000000 --- a/svc/pkg/load-test/standalone/mm-sustain/src/main.rs +++ /dev/null @@ -1,15 +0,0 @@ -use rivet_operation::prelude::*; - -fn main() -> GlobalResult<()> { - rivet_runtime::run(start()).unwrap() -} - -async fn start() -> GlobalResult<()> { - load_test_mm_sustain::run_from_env(util::timestamp::now()).await?; - - tracing::info!("finished"); - - std::future::pending::<()>().await; - - Ok(()) -} diff --git a/svc/pkg/load-test/standalone/mm/src/lib.rs b/svc/pkg/load-test/standalone/mm/src/lib.rs index 8d4b3dcd58..a7479fa076 100644 --- a/svc/pkg/load-test/standalone/mm/src/lib.rs +++ b/svc/pkg/load-test/standalone/mm/src/lib.rs @@ -13,6 +13,14 @@ const LOBBY_GROUP_NAME_ID: &str = "test"; const CHUNK_SIZE: usize = 2048; const BUFFER_SIZE: usize = 16; +pub async fn start() -> GlobalResult<()> { + run_from_env(util::timestamp::now()).await?; + + tracing::info!("finished"); + + Ok(()) +} + struct Ctx { op_ctx: OperationContext<()>, conns: Vec, diff --git a/svc/pkg/load-test/standalone/mm/src/main.rs b/svc/pkg/load-test/standalone/mm/src/main.rs deleted file mode 100644 index 3fe7f84213..0000000000 --- a/svc/pkg/load-test/standalone/mm/src/main.rs +++ /dev/null @@ -1,15 +0,0 @@ -use rivet_operation::prelude::*; - -fn main() -> GlobalResult<()> { - rivet_runtime::run(start()).unwrap() -} - -async fn start() -> GlobalResult<()> { - load_test_mm::run_from_env(util::timestamp::now()).await?; - - tracing::info!("finished"); - - std::future::pending::<()>().await; - - Ok(()) -} diff --git a/svc/pkg/load-test/standalone/sqlx/src/lib.rs b/svc/pkg/load-test/standalone/sqlx/src/lib.rs index 51d2598f47..0c0c19186c 100644 --- a/svc/pkg/load-test/standalone/sqlx/src/lib.rs +++ b/svc/pkg/load-test/standalone/sqlx/src/lib.rs @@ -1,5 +1,14 @@ use rivet_operation::prelude::*; +pub async fn start() -> GlobalResult<()> { + let pools = rivet_pools::from_env("load-test-sqlx").await?; + let _shared_client = chirp_client::SharedClient::from_env(pools.clone())?; + + run_from_env(util::timestamp::now()).await?; + + Ok(()) +} + #[tracing::instrument(skip_all)] pub async fn run_from_env(_ts: i64) -> GlobalResult<()> { let pools = rivet_pools::from_env("load-test-sqlx").await?; diff --git a/svc/pkg/load-test/standalone/sqlx/src/main.rs b/svc/pkg/load-test/standalone/sqlx/src/main.rs deleted file mode 100644 index 1b4971a446..0000000000 --- a/svc/pkg/load-test/standalone/sqlx/src/main.rs +++ /dev/null @@ -1,26 +0,0 @@ -use rivet_operation::prelude::*; - -fn main() -> GlobalResult<()> { - rivet_runtime::run(start()).unwrap() -} - -async fn start() -> GlobalResult<()> { - let pools = rivet_pools::from_env("load-test-sqlx").await?; - let _shared_client = chirp_client::SharedClient::from_env(pools.clone())?; - - tokio::task::Builder::new() - .name("load_test_sqlx::health_checks") - .spawn(rivet_health_checks::run_standalone( - rivet_health_checks::Config { - pools: Some(pools.clone()), - }, - ))?; - - tokio::task::Builder::new() - .name("load_test_sqlx::metrics") - .spawn(rivet_metrics::run_standalone())?; - - load_test_sqlx::run_from_env(util::timestamp::now()).await?; - - Ok(()) -} diff --git a/svc/pkg/load-test/standalone/watch-requests/src/lib.rs b/svc/pkg/load-test/standalone/watch-requests/src/lib.rs index adc761fc4c..6dcc45db82 100644 --- a/svc/pkg/load-test/standalone/watch-requests/src/lib.rs +++ b/svc/pkg/load-test/standalone/watch-requests/src/lib.rs @@ -3,6 +3,14 @@ use rivet_api::apis::configuration::Configuration; use rivet_operation::prelude::*; use tokio::time::{Duration, Instant}; +pub async fn start() -> GlobalResult<()> { + run_from_env(util::timestamp::now()).await?; + + tracing::info!("finished"); + + Ok(()) +} + #[tracing::instrument(skip_all)] pub async fn run_from_env(_ts: i64) -> GlobalResult<()> { let pools = rivet_pools::from_env("load-test-watch-requests").await?; diff --git a/svc/pkg/load-test/standalone/watch-requests/src/main.rs b/svc/pkg/load-test/standalone/watch-requests/src/main.rs deleted file mode 100644 index 8eeaeda432..0000000000 --- a/svc/pkg/load-test/standalone/watch-requests/src/main.rs +++ /dev/null @@ -1,15 +0,0 @@ -use rivet_operation::prelude::*; - -fn main() -> GlobalResult<()> { - rivet_runtime::run(start()).unwrap() -} - -async fn start() -> GlobalResult<()> { - load_test_watch_requests::run_from_env(util::timestamp::now()).await?; - - tracing::info!("finished"); - - std::future::pending::<()>().await; - - Ok(()) -} diff --git a/svc/pkg/mm/standalone/gc/src/lib.rs b/svc/pkg/mm/standalone/gc/src/lib.rs index 0695a8a64c..6cee4319dd 100644 --- a/svc/pkg/mm/standalone/gc/src/lib.rs +++ b/svc/pkg/mm/standalone/gc/src/lib.rs @@ -2,6 +2,32 @@ use proto::backend::pkg::*; use redis::AsyncCommands; use rivet_operation::prelude::*; +pub async fn start() -> GlobalResult<()> { + // TODO: Handle ctrl-c + + let pools = rivet_pools::from_env("mm-gc").await?; + + tokio::task::Builder::new() + .name("mm_gc::health_checks") + .spawn(rivet_health_checks::run_standalone( + rivet_health_checks::Config { + pools: Some(pools.clone()), + }, + ))?; + + tokio::task::Builder::new() + .name("mm_gc::metrics") + .spawn(rivet_metrics::run_standalone())?; + + let mut interval = tokio::time::interval(std::time::Duration::from_secs(15)); + loop { + interval.tick().await; + + let ts = util::timestamp::now(); + run_from_env(ts, pools.clone()).await?; + } +} + #[tracing::instrument(skip_all)] pub async fn run_from_env(ts: i64, pools: rivet_pools::Pools) -> GlobalResult<()> { let client = chirp_client::SharedClient::from_env(pools.clone())?.wrap_new("mm-gc"); diff --git a/svc/pkg/mm/standalone/gc/src/main.rs b/svc/pkg/mm/standalone/gc/src/main.rs deleted file mode 100644 index b9ec1a992a..0000000000 --- a/svc/pkg/mm/standalone/gc/src/main.rs +++ /dev/null @@ -1,33 +0,0 @@ -use std::time::Duration; - -use rivet_operation::prelude::*; - -fn main() -> GlobalResult<()> { - rivet_runtime::run(start()).unwrap() -} - -async fn start() -> GlobalResult<()> { - // TODO: Handle ctrl-c - - let pools = rivet_pools::from_env("mm-gc").await?; - - tokio::task::Builder::new() - .name("mm_gc::health_checks") - .spawn(rivet_health_checks::run_standalone( - rivet_health_checks::Config { - pools: Some(pools.clone()), - }, - ))?; - - tokio::task::Builder::new() - .name("mm_gc::metrics") - .spawn(rivet_metrics::run_standalone())?; - - let mut interval = tokio::time::interval(Duration::from_secs(15)); - loop { - interval.tick().await; - - let ts = util::timestamp::now(); - mm_gc::run_from_env(ts, pools.clone()).await?; - } -} diff --git a/svc/pkg/monolith/standalone/worker/src/lib.rs b/svc/pkg/monolith/standalone/worker/src/lib.rs index 4053985c1a..333dfe39f1 100644 --- a/svc/pkg/monolith/standalone/worker/src/lib.rs +++ b/svc/pkg/monolith/standalone/worker/src/lib.rs @@ -1,5 +1,13 @@ use rivet_operation::prelude::*; +pub async fn start() -> GlobalResult<()> { + let pools = rivet_pools::from_env("monolith-worker").await?; + + run_from_env(pools).await?; + + Ok(()) +} + macro_rules! spawn_workers { ([$shared_client:ident, $pools:ident, $cache:ident, $join_set:ident] $($pkg:ident),* $(,)?) => { $( diff --git a/svc/pkg/monolith/standalone/worker/src/main.rs b/svc/pkg/monolith/standalone/worker/src/main.rs deleted file mode 100644 index 7c2fd72aa2..0000000000 --- a/svc/pkg/monolith/standalone/worker/src/main.rs +++ /dev/null @@ -1,25 +0,0 @@ -use rivet_operation::prelude::*; - -fn main() -> GlobalResult<()> { - rivet_runtime::run(start()).unwrap() -} - -async fn start() -> GlobalResult<()> { - let pools = rivet_pools::from_env("monolith-worker").await?; - - tokio::task::Builder::new() - .name("monolith_worker::health_checks") - .spawn(rivet_health_checks::run_standalone( - rivet_health_checks::Config { - pools: Some(pools.clone()), - }, - ))?; - - tokio::task::Builder::new() - .name("monolith_worker::metrics") - .spawn(rivet_metrics::run_standalone())?; - - monolith_worker::run_from_env(pools).await?; - - Ok(()) -} diff --git a/svc/pkg/monolith/standalone/workflow-worker/src/lib.rs b/svc/pkg/monolith/standalone/workflow-worker/src/lib.rs index 360eb4a452..1b4d14d34b 100644 --- a/svc/pkg/monolith/standalone/workflow-worker/src/lib.rs +++ b/svc/pkg/monolith/standalone/workflow-worker/src/lib.rs @@ -1,8 +1,20 @@ use chirp_workflow::prelude::*; +pub async fn start() -> GlobalResult<()> { + let pools = rivet_pools::from_env("monolith-workflow-worker").await?; + + run_from_env(pools).await?; + + Ok(()) +} + #[tracing::instrument(skip_all)] pub async fn run_from_env(pools: rivet_pools::Pools) -> GlobalResult<()> { - let reg = cluster::registry()?.merge(linode::registry()?)?.merge(ds::registry()?)?.merge(job_run::registry()?)?.merge(pegboard::registry()?)?; + let reg = cluster::registry()? + .merge(linode::registry()?)? + .merge(ds::registry()?)? + .merge(job_run::registry()?)? + .merge(pegboard::registry()?)?; let db = db::DatabasePgNats::from_pools(pools.crdb()?, pools.nats()?); let worker = Worker::new(reg.handle(), db.clone()); diff --git a/svc/pkg/monolith/standalone/workflow-worker/src/main.rs b/svc/pkg/monolith/standalone/workflow-worker/src/main.rs deleted file mode 100644 index 0c5d16e14a..0000000000 --- a/svc/pkg/monolith/standalone/workflow-worker/src/main.rs +++ /dev/null @@ -1,25 +0,0 @@ -use chirp_workflow::prelude::*; - -fn main() -> GlobalResult<()> { - rivet_runtime::run(start()).unwrap() -} - -async fn start() -> GlobalResult<()> { - let pools = rivet_pools::from_env("monolith-workflow-worker").await?; - - tokio::task::Builder::new() - .name("monolith_workflow_worker::health_checks") - .spawn(rivet_health_checks::run_standalone( - rivet_health_checks::Config { - pools: Some(pools.clone()), - }, - ))?; - - tokio::task::Builder::new() - .name("monolith_workflow_worker::metrics") - .spawn(rivet_metrics::run_standalone())?; - - monolith_workflow_worker::run_from_env(pools).await?; - - Ok(()) -} diff --git a/svc/pkg/nomad/standalone/monitor/src/lib.rs b/svc/pkg/nomad/standalone/monitor/src/lib.rs index f13cf4ba87..82fcd98caf 100644 --- a/svc/pkg/nomad/standalone/monitor/src/lib.rs +++ b/svc/pkg/nomad/standalone/monitor/src/lib.rs @@ -3,6 +3,11 @@ use chirp_workflow::prelude::*; mod monitors; use monitors::*; +pub async fn start() -> GlobalResult<()> { + let pools = rivet_pools::from_env("nomad-monitor").await?; + run_from_env(pools).await +} + pub async fn run_from_env(pools: rivet_pools::Pools) -> GlobalResult<()> { let client = chirp_client::SharedClient::from_env(pools.clone())?.wrap_new("nomad-monitor"); let cache = rivet_cache::CacheInner::from_env(pools.clone())?; diff --git a/svc/pkg/nomad/standalone/monitor/src/main.rs b/svc/pkg/nomad/standalone/monitor/src/main.rs deleted file mode 100644 index fae749a154..0000000000 --- a/svc/pkg/nomad/standalone/monitor/src/main.rs +++ /dev/null @@ -1,23 +0,0 @@ -use chirp_workflow::prelude::*; - -fn main() -> GlobalResult<()> { - rivet_runtime::run(start()).unwrap() -} - -async fn start() -> GlobalResult<()> { - let pools = rivet_pools::from_env("nomad-monitor").await?; - - tokio::task::Builder::new() - .name("nomad_monitor::health_checks") - .spawn(rivet_health_checks::run_standalone( - rivet_health_checks::Config { - pools: Some(pools.clone()), - }, - ))?; - - tokio::task::Builder::new() - .name("nomad_monitor::metrics") - .spawn(rivet_metrics::run_standalone())?; - - nomad_monitor::run_from_env(pools).await -} diff --git a/svc/pkg/pegboard/standalone/dc-init/src/lib.rs b/svc/pkg/pegboard/standalone/dc-init/src/lib.rs index a48079789e..c562bba221 100644 --- a/svc/pkg/pegboard/standalone/dc-init/src/lib.rs +++ b/svc/pkg/pegboard/standalone/dc-init/src/lib.rs @@ -24,7 +24,7 @@ enum PoolType { } #[tracing::instrument] -pub async fn run_from_env() -> GlobalResult<()> { +pub async fn start() -> GlobalResult<()> { let pools = rivet_pools::from_env("pegboard-dc-init").await?; let client = chirp_client::SharedClient::from_env(pools.clone())?.wrap_new("pegboard-dc-init"); let cache = rivet_cache::CacheInner::from_env(pools.clone())?; diff --git a/svc/pkg/pegboard/standalone/dc-init/src/main.rs b/svc/pkg/pegboard/standalone/dc-init/src/main.rs deleted file mode 100644 index 33cc5eb212..0000000000 --- a/svc/pkg/pegboard/standalone/dc-init/src/main.rs +++ /dev/null @@ -1,17 +0,0 @@ -use chirp_workflow::prelude::*; -use tracing_subscriber::prelude::*; - -#[tokio::main] -async fn main() -> GlobalResult<()> { - tracing_subscriber::registry() - .with( - tracing_logfmt::builder() - .layer() - .with_filter(tracing_subscriber::filter::LevelFilter::INFO), - ) - .init(); - - // TODO: This functionality should be put in the cluster dc workflow and backfilled, but we don't have - // the ability to update workflows yet - pegboard_dc_init::run_from_env().await -} diff --git a/svc/pkg/pegboard/standalone/gc/src/lib.rs b/svc/pkg/pegboard/standalone/gc/src/lib.rs index 8205ffc7c0..f0d8453e1a 100644 --- a/svc/pkg/pegboard/standalone/gc/src/lib.rs +++ b/svc/pkg/pegboard/standalone/gc/src/lib.rs @@ -20,6 +20,30 @@ struct ContainerRow { failed_stop: bool, } +pub async fn start() -> GlobalResult<()> { + let pools = rivet_pools::from_env("pegboard-gc").await?; + + tokio::task::Builder::new() + .name("pegboard_gc::health_checks") + .spawn(rivet_health_checks::run_standalone( + rivet_health_checks::Config { + pools: Some(pools.clone()), + }, + ))?; + + tokio::task::Builder::new() + .name("pegboard_gc::metrics") + .spawn(rivet_metrics::run_standalone())?; + + let mut interval = tokio::time::interval(std::time::Duration::from_secs(15)); + loop { + interval.tick().await; + + let ts = util::timestamp::now(); + run_from_env(ts, pools.clone()).await?; + } +} + #[tracing::instrument(skip_all)] pub async fn run_from_env(ts: i64, pools: rivet_pools::Pools) -> GlobalResult<()> { let client = chirp_client::SharedClient::from_env(pools.clone())?.wrap_new("pegboard-gc"); diff --git a/svc/pkg/pegboard/standalone/gc/src/main.rs b/svc/pkg/pegboard/standalone/gc/src/main.rs deleted file mode 100644 index 3b03d5c9ed..0000000000 --- a/svc/pkg/pegboard/standalone/gc/src/main.rs +++ /dev/null @@ -1,31 +0,0 @@ -use std::time::Duration; - -use chirp_workflow::prelude::*; - -fn main() -> GlobalResult<()> { - rivet_runtime::run(start()).unwrap() -} - -async fn start() -> GlobalResult<()> { - let pools = rivet_pools::from_env("pegboard-gc").await?; - - tokio::task::Builder::new() - .name("pegboard_gc::health_checks") - .spawn(rivet_health_checks::run_standalone( - rivet_health_checks::Config { - pools: Some(pools.clone()), - }, - ))?; - - tokio::task::Builder::new() - .name("pegboard_gc::metrics") - .spawn(rivet_metrics::run_standalone())?; - - let mut interval = tokio::time::interval(Duration::from_secs(15)); - loop { - interval.tick().await; - - let ts = util::timestamp::now(); - pegboard_gc::run_from_env(ts, pools.clone()).await?; - } -} diff --git a/svc/pkg/pegboard/standalone/ws/src/lib.rs b/svc/pkg/pegboard/standalone/ws/src/lib.rs index 3906dfdad5..ecdd393347 100644 --- a/svc/pkg/pegboard/standalone/ws/src/lib.rs +++ b/svc/pkg/pegboard/standalone/ws/src/lib.rs @@ -29,6 +29,24 @@ struct Connection { type Connections = HashMap>; +pub async fn start() -> GlobalResult<()> { + let pools = rivet_pools::from_env("pegboard-ws").await?; + + tokio::task::Builder::new() + .name("pegboard_ws::health_checks") + .spawn(rivet_health_checks::run_standalone( + rivet_health_checks::Config { + pools: Some(pools.clone()), + }, + ))?; + + tokio::task::Builder::new() + .name("pegboard_ws::metrics") + .spawn(rivet_metrics::run_standalone())?; + + run_from_env(pools.clone()).await +} + #[tracing::instrument(skip_all)] pub async fn run_from_env(pools: rivet_pools::Pools) -> GlobalResult<()> { let client = chirp_client::SharedClient::from_env(pools.clone())?.wrap_new("pegboard-ws"); diff --git a/svc/pkg/pegboard/standalone/ws/src/main.rs b/svc/pkg/pegboard/standalone/ws/src/main.rs deleted file mode 100644 index 98b9edbb05..0000000000 --- a/svc/pkg/pegboard/standalone/ws/src/main.rs +++ /dev/null @@ -1,23 +0,0 @@ -use chirp_workflow::prelude::*; - -fn main() -> GlobalResult<()> { - rivet_runtime::run(start()).unwrap() -} - -async fn start() -> GlobalResult<()> { - let pools = rivet_pools::from_env("pegboard-ws").await?; - - tokio::task::Builder::new() - .name("pegboard_ws::health_checks") - .spawn(rivet_health_checks::run_standalone( - rivet_health_checks::Config { - pools: Some(pools.clone()), - }, - ))?; - - tokio::task::Builder::new() - .name("pegboard_ws::metrics") - .spawn(rivet_metrics::run_standalone())?; - - pegboard_ws::run_from_env(pools.clone()).await -} diff --git a/svc/pkg/telemetry/standalone/beacon/src/lib.rs b/svc/pkg/telemetry/standalone/beacon/src/lib.rs index 2f631e8b19..bca1698b80 100644 --- a/svc/pkg/telemetry/standalone/beacon/src/lib.rs +++ b/svc/pkg/telemetry/standalone/beacon/src/lib.rs @@ -14,6 +14,10 @@ struct NamespaceAnalytics { linked_users: i64, } +pub async fn start() -> GlobalResult<()> { + run_from_env(util::timestamp::now()).await +} + #[tracing::instrument] pub async fn run_from_env(ts: i64) -> GlobalResult<()> { let pools = rivet_pools::from_env("telemetry-beacon").await?; diff --git a/svc/pkg/telemetry/standalone/beacon/src/main.rs b/svc/pkg/telemetry/standalone/beacon/src/main.rs index 9c3751cad8..cba1064c16 100644 --- a/svc/pkg/telemetry/standalone/beacon/src/main.rs +++ b/svc/pkg/telemetry/standalone/beacon/src/main.rs @@ -1,11 +1 @@ use rivet_operation::prelude::*; - -fn main() -> GlobalResult<()> { - rivet_runtime::run(start()).unwrap() -} - -async fn start() -> GlobalResult<()> { - telemetry_beacon::run_from_env(util::timestamp::now()).await?; - - Ok(()) -} diff --git a/svc/pkg/upload/standalone/provider-fill/Cargo.toml b/svc/pkg/upload/standalone/provider-fill/Cargo.toml deleted file mode 100644 index fb4492f754..0000000000 --- a/svc/pkg/upload/standalone/provider-fill/Cargo.toml +++ /dev/null @@ -1,33 +0,0 @@ -[package] -name = "upload-provider-fill" -version = "0.0.1" -edition = "2021" -authors = ["Rivet Gaming, LLC "] -license = "Apache-2.0" - -[dependencies] -chirp-client = { path = "../../../../../lib/chirp/client" } -futures-util = "0.3" -indoc = "1.0" -prost = "0.10" -reqwest = "0.11" -rivet-connection = { path = "../../../../../lib/connection" } -rivet-operation = { path = "../../../../../lib/operation/core" } -rivet-pools = { path = "../../../../../lib/pools" } -s3-util = { path = "../../../../../lib/s3-util" } -tokio = { version = "1.29", features = ["full"] } -tracing = "0.1" -tracing-subscriber = { version = "0.3", default-features = false, features = [ - "fmt", - "json", - "ansi", -] } -tracing-logfmt = "0.3" - -[dependencies.sqlx] -git = "https://github.com/rivet-gg/sqlx" -rev = "08d6e61aa0572e7ec557abbedb72cebb96e1ac5b" -default-features = false - -[dev-dependencies] -chirp-worker = { path = "../../../../../lib/chirp/worker" } diff --git a/svc/pkg/upload/standalone/provider-fill/README.md b/svc/pkg/upload/standalone/provider-fill/README.md deleted file mode 100644 index ad63dca3f1..0000000000 --- a/svc/pkg/upload/standalone/provider-fill/README.md +++ /dev/null @@ -1 +0,0 @@ -# upload-provider-fill diff --git a/svc/pkg/upload/standalone/provider-fill/Service.toml b/svc/pkg/upload/standalone/provider-fill/Service.toml deleted file mode 100644 index f3b17a39fd..0000000000 --- a/svc/pkg/upload/standalone/provider-fill/Service.toml +++ /dev/null @@ -1,10 +0,0 @@ -[service] -name = "upload-provider-fill" - -[runtime] -kind = "rust" - -[oneshot] - -[databases] -db-upload = {} diff --git a/svc/pkg/upload/standalone/provider-fill/src/lib.rs b/svc/pkg/upload/standalone/provider-fill/src/lib.rs deleted file mode 100644 index 1ff012e6c2..0000000000 --- a/svc/pkg/upload/standalone/provider-fill/src/lib.rs +++ /dev/null @@ -1,46 +0,0 @@ -use indoc::indoc; -use proto::backend; -use rivet_operation::prelude::*; - -#[tracing::instrument] -pub async fn run_from_env() -> GlobalResult<()> { - let pools = rivet_pools::from_env("upload-provider-fill").await?; - let client = - chirp_client::SharedClient::from_env(pools.clone())?.wrap_new("upload-provider-fill"); - let cache = rivet_cache::CacheInner::from_env(pools.clone())?; - let ctx = OperationContext::new( - "upload-provider-fill".into(), - std::time::Duration::from_secs(60), - rivet_connection::Connection::new(client, pools, cache), - Uuid::new_v4(), - Uuid::new_v4(), - util::timestamp::now(), - util::timestamp::now(), - (), - ); - - let Ok(backfill_provider) = std::env::var("S3_BACKFILL_PROVIDER") else { - tracing::warn!("no backfill provider env var, will have to manually re-run to backfill"); - return Ok(()); - }; - - let provider = s3_util::Provider::from_str(&backfill_provider)?; - let proto_provider = match provider { - s3_util::Provider::Minio => backend::upload::Provider::Minio, - s3_util::Provider::Backblaze => backend::upload::Provider::Backblaze, - s3_util::Provider::Aws => backend::upload::Provider::Aws, - }; - - sql_execute!( - [ctx] - " - UPDATE db_upload.uploads - SET provider = $1 - WHERE provider IS NULL - ", - proto_provider as i64, - ) - .await?; - - Ok(()) -} diff --git a/svc/pkg/upload/standalone/provider-fill/src/main.rs b/svc/pkg/upload/standalone/provider-fill/src/main.rs deleted file mode 100644 index 9a4ffc9f4b..0000000000 --- a/svc/pkg/upload/standalone/provider-fill/src/main.rs +++ /dev/null @@ -1,15 +0,0 @@ -use rivet_operation::prelude::*; -use tracing_subscriber::prelude::*; - -#[tokio::main] -async fn main() -> GlobalResult<()> { - tracing_subscriber::registry() - .with( - tracing_logfmt::builder() - .layer() - .with_filter(tracing_subscriber::filter::LevelFilter::INFO), - ) - .init(); - - upload_provider_fill::run_from_env().await -} diff --git a/svc/pkg/upload/standalone/provider-fill/tests/integration.rs b/svc/pkg/upload/standalone/provider-fill/tests/integration.rs deleted file mode 100644 index b11f91ee6d..0000000000 --- a/svc/pkg/upload/standalone/provider-fill/tests/integration.rs +++ /dev/null @@ -1,14 +0,0 @@ -use tracing_subscriber::prelude::*; - -#[tokio::test(flavor = "multi_thread")] -async fn basic() { - tracing_subscriber::registry() - .with( - tracing_logfmt::builder() - .layer() - .with_filter(tracing_subscriber::filter::LevelFilter::INFO), - ) - .init(); - - upload_provider_fill::run_from_env().await.unwrap(); -} diff --git a/svc/pkg/user/standalone/delete-pending/src/lib.rs b/svc/pkg/user/standalone/delete-pending/src/lib.rs index c3b8fbd63c..106dcb5785 100644 --- a/svc/pkg/user/standalone/delete-pending/src/lib.rs +++ b/svc/pkg/user/standalone/delete-pending/src/lib.rs @@ -3,6 +3,10 @@ use indoc::indoc; use proto::backend::pkg::*; use rivet_operation::prelude::*; +pub async fn start() -> GlobalResult<()> { + run_from_env(util::timestamp::now()).await +} + #[tracing::instrument] pub async fn run_from_env(ts: i64) -> GlobalResult<()> { let pools = rivet_pools::from_env("user-delete-pending").await?; diff --git a/svc/pkg/user/standalone/delete-pending/src/main.rs b/svc/pkg/user/standalone/delete-pending/src/main.rs deleted file mode 100644 index de2c7b2261..0000000000 --- a/svc/pkg/user/standalone/delete-pending/src/main.rs +++ /dev/null @@ -1,11 +0,0 @@ -use rivet_operation::prelude::*; - -fn main() -> GlobalResult<()> { - rivet_runtime::run(start()).unwrap() -} - -async fn start() -> GlobalResult<()> { - user_delete_pending::run_from_env(util::timestamp::now()).await?; - - Ok(()) -} diff --git a/svc/pkg/user/standalone/search-user-gc/Cargo.toml b/svc/pkg/user/standalone/search-user-gc/Cargo.toml deleted file mode 100644 index f53b378e4a..0000000000 --- a/svc/pkg/user/standalone/search-user-gc/Cargo.toml +++ /dev/null @@ -1,31 +0,0 @@ -[package] -name = "user-search-user-gc" -version = "0.0.1" -edition = "2021" -authors = ["Rivet Gaming, LLC "] -license = "Apache-2.0" - -[dependencies] -lazy_static = "1.4" -chirp-client = { path = "../../../../../lib/chirp/client" } -rivet-operation = { path = "../../../../../lib/operation/core" } -futures-util = "0.3" -indoc = "1.0" -prost = "0.10" -rivet-connection = { path = "../../../../../lib/connection" } -rivet-runtime = { path = "../../../../../lib/runtime" } -tokio = { version = "1.29", features = ["full"] } -tracing = "0.1" -tracing-subscriber = { version = "0.3", default-features = false, features = [ - "fmt", - "json", - "ansi", -] } -tracing-logfmt = "0.3" - -user-identity-get = { path = "../../../user-identity/ops/get" } -user-follow-count = { path = "../../../user-follow/ops/count" } - -[dev-dependencies] -chirp-worker = { path = "../../../../../lib/chirp/worker" } -chrono = "0.4" diff --git a/svc/pkg/user/standalone/search-user-gc/README.md b/svc/pkg/user/standalone/search-user-gc/README.md deleted file mode 100644 index 223ce201e4..0000000000 --- a/svc/pkg/user/standalone/search-user-gc/README.md +++ /dev/null @@ -1 +0,0 @@ -# user-search-user-gc diff --git a/svc/pkg/user/standalone/search-user-gc/Service.toml b/svc/pkg/user/standalone/search-user-gc/Service.toml deleted file mode 100644 index d6c234bc66..0000000000 --- a/svc/pkg/user/standalone/search-user-gc/Service.toml +++ /dev/null @@ -1,11 +0,0 @@ -[service] -name = "user-search-user-gc" - -[runtime] -kind = "rust" - -[periodic] -cron = "0 0 * * *" - -[databases] -db-user = {} diff --git a/svc/pkg/user/standalone/search-user-gc/src/lib.rs b/svc/pkg/user/standalone/search-user-gc/src/lib.rs deleted file mode 100644 index c0a7d04644..0000000000 --- a/svc/pkg/user/standalone/search-user-gc/src/lib.rs +++ /dev/null @@ -1,114 +0,0 @@ -use std::collections::HashSet; - -use futures_util::StreamExt; -use rivet_operation::prelude::*; - -#[tracing::instrument(skip_all)] -pub async fn run_from_env(ts: i64) -> GlobalResult<()> { - let pools = rivet_pools::from_env("user-search-user-gc").await?; - let client = - chirp_client::SharedClient::from_env(pools.clone())?.wrap_new("user-search-user-gc"); - let cache = rivet_cache::CacheInner::from_env(pools.clone())?; - let ctx = OperationContext::new( - "user-search-user-gc".into(), - std::time::Duration::from_secs(60), - rivet_connection::Connection::new(client, pools, cache), - Uuid::new_v4(), - Uuid::new_v4(), - util::timestamp::now(), - util::timestamp::now(), - (), - ); - - let mut total_removed = 0; - let start = std::time::Instant::now(); - - // Filters out users who have been updated in the last 14 days - let crdb = ctx.crdb().await?; - let mut query = sql_fetch!( - [ctx, (Uuid,), &crdb] - " - SELECT user_id - FROM db_user.users AS OF SYSTEM TIME '-5s' - WHERE - is_searchable = TRUE AND - update_ts < $1 - ", - ts - util::duration::days(14), - ); - - let mut batch_user_ids = Vec::with_capacity(1024); - while let Some(row) = query.next().await { - let (user_id,) = row?; - - batch_user_ids.push(user_id); - - if batch_user_ids.len() >= 1024 { - total_removed += process_batch(&ctx, &batch_user_ids).await?; - batch_user_ids.clear(); - } - } - - if !batch_user_ids.is_empty() { - total_removed += process_batch(&ctx, &batch_user_ids).await?; - } - - tracing::info!( - ?total_removed, - "finished in {:.2}s", - start.elapsed().as_millis() as f64 / 1000.0 - ); - - Ok(()) -} - -async fn process_batch(ctx: &OperationContext<()>, user_ids: &[Uuid]) -> GlobalResult { - let user_ids_proto = user_ids.iter().cloned().map(Into::into).collect::>(); - - let (registered, has_followers) = tokio::try_join!( - // TODO: When more identity methods are implemented, query those too - async { - op!([ctx] user_identity_get { - user_ids: user_ids_proto.clone(), - }) - .await? - .users - .iter() - .map(|user| Ok(unwrap_ref!(user.user_id).as_uuid())) - .collect::>>() - }, - async { - op!([ctx] user_follow_count { - user_ids: user_ids_proto.clone(), - }) - .await? - .follows - .iter() - .filter(|follows| follows.count != 0) - .map(|follows| Ok(unwrap_ref!(follows.user_id).as_uuid())) - .collect::>>() - }, - )?; - - // Users who are not registered and have no followers. Note that using `HashSet`'s `.difference` - // method is not ideal here as it cannot be chained with another difference without reallocation. - let deletions = user_ids - .iter() - .filter(|id| !registered.contains(id)) - .filter(|id| !has_followers.contains(id)) - .cloned() - .collect::>(); - - let res = sql_execute!( - [ctx] - " - UPDATE db_user.users - SET is_searchable = FALSE - WHERE user_id = ANY($1) - ", - deletions, - ) - .await?; - - Ok(res.rows_affected()) -} diff --git a/svc/pkg/user/standalone/search-user-gc/src/main.rs b/svc/pkg/user/standalone/search-user-gc/src/main.rs deleted file mode 100644 index ec4ee322e8..0000000000 --- a/svc/pkg/user/standalone/search-user-gc/src/main.rs +++ /dev/null @@ -1,11 +0,0 @@ -use rivet_operation::prelude::*; - -fn main() -> GlobalResult<()> { - rivet_runtime::run(start()).unwrap() -} - -async fn start() -> GlobalResult<()> { - user_search_user_gc::run_from_env(util::timestamp::now()).await?; - - Ok(()) -} diff --git a/svc/pkg/user/standalone/search-user-gc/tests/integration.rs b/svc/pkg/user/standalone/search-user-gc/tests/integration.rs deleted file mode 100644 index 8666457d7c..0000000000 --- a/svc/pkg/user/standalone/search-user-gc/tests/integration.rs +++ /dev/null @@ -1,17 +0,0 @@ -use ::user_search_user_gc::run_from_env; -use chirp_worker::prelude::*; -use tracing_subscriber::prelude::*; - -#[tokio::test(flavor = "multi_thread")] -async fn basic() { - tracing_subscriber::registry() - .with( - tracing_logfmt::builder() - .layer() - .with_filter(tracing_subscriber::filter::LevelFilter::INFO), - ) - .init(); - - // TODO: - run_from_env(util::timestamp::now()).await.unwrap(); -} diff --git a/svc/pkg/workflow/standalone/gc/src/lib.rs b/svc/pkg/workflow/standalone/gc/src/lib.rs index 5b7d7551cb..80f3f1ab87 100644 --- a/svc/pkg/workflow/standalone/gc/src/lib.rs +++ b/svc/pkg/workflow/standalone/gc/src/lib.rs @@ -4,6 +4,18 @@ use rivet_operation::prelude::*; const WORKER_INSTANCE_LOST_THRESHOLD: i64 = util::duration::seconds(30); +pub async fn start() -> GlobalResult<()> { + let pools = rivet_pools::from_env("workflow-gc").await?; + + let mut interval = tokio::time::interval(Duration::from_secs(15)); + loop { + interval.tick().await; + + let ts = util::timestamp::now(); + run_from_env(ts, pools.clone()).await?; + } +} + #[tracing::instrument(skip_all)] pub async fn run_from_env(ts: i64, pools: rivet_pools::Pools) -> GlobalResult<()> { let client = chirp_client::SharedClient::from_env(pools.clone())?.wrap_new("workflow-gc"); diff --git a/svc/pkg/workflow/standalone/gc/src/main.rs b/svc/pkg/workflow/standalone/gc/src/main.rs deleted file mode 100644 index 573defb3d6..0000000000 --- a/svc/pkg/workflow/standalone/gc/src/main.rs +++ /dev/null @@ -1,31 +0,0 @@ -use std::time::Duration; - -use rivet_operation::prelude::*; - -fn main() -> GlobalResult<()> { - rivet_runtime::run(start()).unwrap() -} - -async fn start() -> GlobalResult<()> { - let pools = rivet_pools::from_env("workflow-gc").await?; - - tokio::task::Builder::new() - .name("workflow_gc::health_checks") - .spawn(rivet_health_checks::run_standalone( - rivet_health_checks::Config { - pools: Some(pools.clone()), - }, - ))?; - - tokio::task::Builder::new() - .name("workflow_gc::metrics") - .spawn(rivet_metrics::run_standalone())?; - - let mut interval = tokio::time::interval(Duration::from_secs(15)); - loop { - interval.tick().await; - - let ts = util::timestamp::now(); - workflow_gc::run_from_env(ts, pools.clone()).await?; - } -} diff --git a/svc/pkg/workflow/standalone/metrics-publish/src/lib.rs b/svc/pkg/workflow/standalone/metrics-publish/src/lib.rs index f4374a301d..e848c5c19e 100644 --- a/svc/pkg/workflow/standalone/metrics-publish/src/lib.rs +++ b/svc/pkg/workflow/standalone/metrics-publish/src/lib.rs @@ -1,5 +1,16 @@ use chirp_workflow::prelude::*; +pub async fn start() -> GlobalResult<()> { + let pools = rivet_pools::from_env("workflow-metrics-publish").await?; + + let mut interval = tokio::time::interval(std::time::Duration::from_secs(15)); + loop { + interval.tick().await; + + run_from_env(pools.clone()).await?; + } +} + #[tracing::instrument(skip_all)] pub async fn run_from_env(pools: rivet_pools::Pools) -> GlobalResult<()> { let client = diff --git a/svc/pkg/workflow/standalone/metrics-publish/src/main.rs b/svc/pkg/workflow/standalone/metrics-publish/src/main.rs deleted file mode 100644 index 838d91214c..0000000000 --- a/svc/pkg/workflow/standalone/metrics-publish/src/main.rs +++ /dev/null @@ -1,30 +0,0 @@ -use std::time::Duration; - -use chirp_workflow::prelude::*; - -fn main() -> GlobalResult<()> { - rivet_runtime::run(start()).unwrap() -} - -async fn start() -> GlobalResult<()> { - let pools = rivet_pools::from_env("workflow-metrics-publish").await?; - - tokio::task::Builder::new() - .name("workflow_metrics_publish::health_checks") - .spawn(rivet_health_checks::run_standalone( - rivet_health_checks::Config { - pools: Some(pools.clone()), - }, - ))?; - - tokio::task::Builder::new() - .name("workflow_metrics_publish::metrics") - .spawn(rivet_metrics::run_standalone())?; - - let mut interval = tokio::time::interval(Duration::from_secs(15)); - loop { - interval.tick().await; - - workflow_metrics_publish::run_from_env(pools.clone()).await?; - } -}