diff --git a/CHANGELOG.md b/CHANGELOG.md index 20765595..1036213a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,12 @@ # Changelog -## Unreleased +## 0.2.0 (2021-09-07) -### Bugfixes +### Major performance improvements -- Do not send empty message ([#117](https://github.com/ayrat555/el_monitorro/pull/117)) +- migrate all background processing to [fang](https://github.com/ayrat555/fang) +- allow to start all services from the main binary with `ALL_BINARIES` env var +- maintain db pool for processing user commands ## 0.1.3 (2021-06-22) diff --git a/Cargo.lock b/Cargo.lock index 89881467..c5c60f71 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,12 +11,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "ascii" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97be891acc47ca214468e09425d02cef3af2c94d0d82081cd02061f996802f14" - [[package]] name = "assert-json-diff" version = "2.0.1" @@ -74,34 +68,12 @@ dependencies = [ "winapi", ] -[[package]] -name = "autocfg" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" - [[package]] name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -[[package]] -name = "base64" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" -dependencies = [ - "byteorder", - "safemem", -] - -[[package]] -name = "base64" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" - [[package]] name = "bitflags" version = "1.3.2" @@ -129,22 +101,6 @@ dependencies = [ "byte-tools", ] -[[package]] -name = "buf_redux" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b953a6887648bb07a535631f2bc00fbdb2a2216f135552cb3f534ed136b9c07f" -dependencies = [ - "memchr", - "safemem", -] - -[[package]] -name = "bumpalo" -version = "3.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631" - [[package]] name = "byte-tools" version = "0.3.1" @@ -194,27 +150,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "chunked_transfer" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "498d20a7aaf62625b9bf26e637cf7736417cde1d0c99f1d04d1170229a85cf87" - -[[package]] -name = "chunked_transfer" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff857943da45f546682664a79488be82e69e43c1a7a2307679ab9afb3a66d2e" - -[[package]] -name = "cloudabi" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -dependencies = [ - "bitflags", -] - [[package]] name = "colored" version = "2.0.0" @@ -483,7 +418,7 @@ checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" [[package]] name = "el_monitorro" -version = "0.1.3" +version = "0.2.0" dependencies = [ "atom_syndication 0.10.0", "chrono", @@ -497,14 +432,14 @@ dependencies = [ "html2text", "htmlescape", "isahc", - "log 0.4.14", + "log", "mockito", "regex", "rss", "serde", "serde_json", "tokio", - "url 2.2.2", + "url", ] [[package]] @@ -524,7 +459,7 @@ checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" dependencies = [ "atty", "humantime", - "log 0.4.14", + "log", "regex", "termcolor", ] @@ -560,7 +495,7 @@ dependencies = [ "diesel", "diesel-derive-enum", "dotenv", - "log 0.4.14", + "log", "serde", "serde_json", "typetag", @@ -584,13 +519,13 @@ checksum = "7f94e79fc5fbac9e1143a7af3c1b66c82edce080b8dff4d9e90bcd948d8d2aa8" dependencies = [ "chrono", "lazy_static", - "mime 0.3.16", + "mime", "quick-xml 0.20.0", "regex", "serde", "serde_json", - "siphasher 0.3.7", - "url 2.2.2", + "siphasher", + "url", "uuid", ] @@ -607,7 +542,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" dependencies = [ "matches", - "percent-encoding 2.1.0", + "percent-encoding", ] [[package]] @@ -616,19 +551,9 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1972504621beb750802c973f15f6c3b59906741a08c44908233f28c58807010" dependencies = [ - "mime_guess 2.0.3", - "multipart", "serde", - "serde_json", - "ureq", ] -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" - [[package]] name = "futf" version = "0.1.4" @@ -708,22 +633,16 @@ dependencies = [ "syn", ] -[[package]] -name = "groupable" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32619942b8be646939eaf3db0602b39f5229b74575b67efc897811ded1db4e57" - [[package]] name = "handlebars" version = "4.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd85ecabdb47308d28d3a4113224fefcab2510ccb4e463aee0a1362eb84c756a" dependencies = [ - "log 0.4.14", + "log", "pest", "pest_derive", - "quick-error 2.0.1", + "quick-error", "serde", "serde_json", ] @@ -763,7 +682,7 @@ version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aafcf38a1a36118242d29b92e1b08ef84e67e4a5ed06e0a80be20e6a32bfed6b" dependencies = [ - "log 0.4.14", + "log", "mac", "markup5ever", "proc-macro2", @@ -800,42 +719,12 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" -[[package]] -name = "hyper" -version = "0.10.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a0652d9a2609a968c14be1a9ea00bf4b1d64e2e1f53a1b51b6fff3a6e829273" -dependencies = [ - "base64 0.9.3", - "httparse", - "language-tags", - "log 0.3.9", - "mime 0.2.6", - "num_cpus", - "time", - "traitobject", - "typeable", - "unicase 1.4.2", - "url 1.7.2", -] - [[package]] name = "ident_case" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "0.2.3" @@ -878,22 +767,6 @@ dependencies = [ "syn", ] -[[package]] -name = "iron" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6d308ca2d884650a8bf9ed2ff4cb13fbb2207b71f64cda11dc9b892067295e8" -dependencies = [ - "hyper", - "log 0.3.9", - "mime_guess 1.8.8", - "modifier", - "num_cpus", - "plugin", - "typemap", - "url 1.7.2", -] - [[package]] name = "isahc" version = "1.5.0" @@ -908,15 +781,15 @@ dependencies = [ "event-listener", "futures-lite", "http", - "log 0.4.14", - "mime 0.3.16", + "log", + "mime", "once_cell", "polling", "slab", "sluice", "tracing", "tracing-futures", - "url 2.2.2", + "url", "waker-fn", ] @@ -926,21 +799,6 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" -[[package]] -name = "js-sys" -version = "0.3.53" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4bf49d50e2961077d9c99f4b7997d770a1114f087c3c2e0069b36c13fc2979d" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "language-tags" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" - [[package]] name = "lazy_static" version = "1.4.0" @@ -984,15 +842,6 @@ dependencies = [ "scopeguard", ] -[[package]] -name = "log" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" -dependencies = [ - "log 0.4.14", -] - [[package]] name = "log" version = "0.4.14" @@ -1020,9 +869,9 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a24f40fb03852d1cdd84330cddcaf98e9ec08a7b7768e952fad3b4cf048ec8fd" dependencies = [ - "log 0.4.14", - "phf 0.8.0", - "phf_codegen 0.8.0", + "log", + "phf", + "phf_codegen", "string_cache", "string_cache_codegen", "tendril", @@ -1052,43 +901,12 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" -[[package]] -name = "mime" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" -dependencies = [ - "log 0.3.9", -] - [[package]] name = "mime" version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" -[[package]] -name = "mime_guess" -version = "1.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216929a5ee4dd316b1702eedf5e74548c123d370f47841ceaac38ca154690ca3" -dependencies = [ - "mime 0.2.6", - "phf 0.7.24", - "phf_codegen 0.7.24", - "unicase 1.4.2", -] - -[[package]] -name = "mime_guess" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" -dependencies = [ - "mime 0.3.16", - "unicase 2.6.0", -] - [[package]] name = "mio" version = "0.7.13" @@ -1096,7 +914,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16" dependencies = [ "libc", - "log 0.4.14", + "log", "miow", "ntapi", "winapi", @@ -1122,51 +940,13 @@ dependencies = [ "difference", "httparse", "lazy_static", - "log 0.4.14", + "log", "rand 0.8.4", "regex", "serde_json", "serde_urlencoded", ] -[[package]] -name = "modifier" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f5c9112cb662acd3b204077e0de5bc66305fa8df65c8019d5adb10e9ab6e58" - -[[package]] -name = "multipart" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00dec633863867f29cb39df64a397cdf4a6354708ddd7759f70c7fb51c5f9182" -dependencies = [ - "buf_redux", - "httparse", - "hyper", - "iron", - "log 0.4.14", - "mime 0.3.16", - "mime_guess 2.0.3", - "nickel", - "quick-error 1.2.3", - "rand 0.8.4", - "safemem", - "tempfile", - "tiny_http", - "twoway", -] - -[[package]] -name = "mustache" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51956ef1c5d20a1384524d91e616fb44dfc7d8f249bf696d49c97dd3289ecab5" -dependencies = [ - "log 0.3.9", - "serde", -] - [[package]] name = "never" version = "0.1.0" @@ -1179,27 +959,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" -[[package]] -name = "nickel" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5061a832728db2dacb61cefe0ce303b58f85764ec680e71d9138229640a46d9" -dependencies = [ - "groupable", - "hyper", - "lazy_static", - "log 0.3.9", - "modifier", - "mustache", - "plugin", - "regex", - "serde", - "serde_json", - "time", - "typemap", - "url 1.7.2", -] - [[package]] name = "ntapi" version = "0.3.6" @@ -1215,7 +974,7 @@ version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ - "autocfg 1.0.1", + "autocfg", "num-traits", ] @@ -1225,7 +984,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "autocfg 1.0.1", + "autocfg", ] [[package]] @@ -1262,7 +1021,7 @@ version = "0.9.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1996d2d305e561b70d1ee0c53f1542833f4e1ac6ce9a6708b6ff2738ca67dc82" dependencies = [ - "autocfg 1.0.1", + "autocfg", "cc", "libc", "pkg-config", @@ -1300,12 +1059,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "percent-encoding" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" - [[package]] name = "percent-encoding" version = "2.1.0" @@ -1355,32 +1108,13 @@ dependencies = [ "sha-1", ] -[[package]] -name = "phf" -version = "0.7.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3da44b85f8e8dfaec21adae67f95d93244b2ecf6ad2a692320598dcc8e6dd18" -dependencies = [ - "phf_shared 0.7.24", -] - [[package]] name = "phf" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" dependencies = [ - "phf_shared 0.8.0", -] - -[[package]] -name = "phf_codegen" -version = "0.7.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03e85129e324ad4166b06b2c7491ae27fe3ec353af72e72cd1654c7225d517e" -dependencies = [ - "phf_generator 0.7.24", - "phf_shared 0.7.24", + "phf_shared", ] [[package]] @@ -1389,18 +1123,8 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815" dependencies = [ - "phf_generator 0.8.0", - "phf_shared 0.8.0", -] - -[[package]] -name = "phf_generator" -version = "0.7.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662" -dependencies = [ - "phf_shared 0.7.24", - "rand 0.6.5", + "phf_generator", + "phf_shared", ] [[package]] @@ -1409,27 +1133,17 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" dependencies = [ - "phf_shared 0.8.0", + "phf_shared", "rand 0.7.3", ] -[[package]] -name = "phf_shared" -version = "0.7.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0" -dependencies = [ - "siphasher 0.2.3", - "unicase 1.4.2", -] - [[package]] name = "phf_shared" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" dependencies = [ - "siphasher 0.3.7", + "siphasher", ] [[package]] @@ -1464,15 +1178,6 @@ version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" -[[package]] -name = "plugin" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a6a0dc3910bc8db877ffed8e457763b317cf880df4ae19109b9f77d277cf6e0" -dependencies = [ - "typemap", -] - [[package]] name = "polling" version = "2.1.0" @@ -1481,7 +1186,7 @@ checksum = "92341d779fa34ea8437ef4d82d440d5e1ce3f3ff7f824aa64424cd481f9a1f25" dependencies = [ "cfg-if", "libc", - "log 0.4.14", + "log", "wepoll-ffi", "winapi", ] @@ -1516,12 +1221,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - [[package]] name = "quick-error" version = "2.0.1" @@ -1563,30 +1262,11 @@ version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "545c5bc2b880973c9c10e4067418407a0ccaa3091781d1671d46eb35107cb26f" dependencies = [ - "log 0.4.14", + "log", "parking_lot", "scheduled-thread-pool", ] -[[package]] -name = "rand" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" -dependencies = [ - "autocfg 0.1.7", - "libc", - "rand_chacha 0.1.1", - "rand_core 0.4.2", - "rand_hc 0.1.0", - "rand_isaac", - "rand_jitter", - "rand_os", - "rand_pcg 0.1.2", - "rand_xorshift", - "winapi", -] - [[package]] name = "rand" version = "0.7.3" @@ -1598,7 +1278,7 @@ dependencies = [ "rand_chacha 0.2.2", "rand_core 0.5.1", "rand_hc 0.2.0", - "rand_pcg 0.2.1", + "rand_pcg", ] [[package]] @@ -1613,16 +1293,6 @@ dependencies = [ "rand_hc 0.3.1", ] -[[package]] -name = "rand_chacha" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" -dependencies = [ - "autocfg 0.1.7", - "rand_core 0.3.1", -] - [[package]] name = "rand_chacha" version = "0.2.2" @@ -1643,21 +1313,6 @@ dependencies = [ "rand_core 0.6.3", ] -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -dependencies = [ - "rand_core 0.4.2", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" - [[package]] name = "rand_core" version = "0.5.1" @@ -1676,15 +1331,6 @@ dependencies = [ "getrandom 0.2.3", ] -[[package]] -name = "rand_hc" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" -dependencies = [ - "rand_core 0.3.1", -] - [[package]] name = "rand_hc" version = "0.2.0" @@ -1703,50 +1349,6 @@ dependencies = [ "rand_core 0.6.3", ] -[[package]] -name = "rand_isaac" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rand_jitter" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" -dependencies = [ - "libc", - "rand_core 0.4.2", - "winapi", -] - -[[package]] -name = "rand_os" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" -dependencies = [ - "cloudabi", - "fuchsia-cprng", - "libc", - "rand_core 0.4.2", - "rdrand", - "winapi", -] - -[[package]] -name = "rand_pcg" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" -dependencies = [ - "autocfg 0.1.7", - "rand_core 0.4.2", -] - [[package]] name = "rand_pcg" version = "0.2.1" @@ -1756,24 +1358,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "rand_xorshift" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -dependencies = [ - "rand_core 0.3.1", -] - [[package]] name = "redox_syscall" version = "0.2.10" @@ -1800,30 +1384,6 @@ version = "0.6.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin", - "untrusted", - "web-sys", - "winapi", -] - [[package]] name = "rss" version = "1.10.0" @@ -1835,31 +1395,12 @@ dependencies = [ "quick-xml 0.20.0", ] -[[package]] -name = "rustls" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" -dependencies = [ - "base64 0.13.0", - "log 0.4.14", - "ring", - "sct", - "webpki", -] - [[package]] name = "ryu" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" -[[package]] -name = "safemem" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" - [[package]] name = "schannel" version = "0.1.19" @@ -1885,16 +1426,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "sct" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "serde" version = "1.0.130" @@ -1959,12 +1490,6 @@ dependencies = [ "libc", ] -[[package]] -name = "siphasher" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" - [[package]] name = "siphasher" version = "0.3.7" @@ -2004,12 +1529,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - [[package]] name = "string_cache" version = "0.8.1" @@ -2018,7 +1537,7 @@ checksum = "8ddb1139b5353f96e429e1a5e19fbaf663bddedaa06d1dbd49f82e352601209a" dependencies = [ "lazy_static", "new_debug_unreachable", - "phf_shared 0.8.0", + "phf_shared", "precomputed-hash", "serde", ] @@ -2029,8 +1548,8 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f24c8e5e19d22a726626f1a5e16fe15b132dcf21d10177fa5a45ce7962996b97" dependencies = [ - "phf_generator 0.8.0", - "phf_shared 0.8.0", + "phf_generator", + "phf_shared", "proc-macro2", "quote", ] @@ -2058,20 +1577,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "tempfile" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" -dependencies = [ - "cfg-if", - "libc", - "rand 0.8.4", - "redox_syscall", - "remove_dir_all", - "winapi", -] - [[package]] name = "tendril" version = "0.4.2" @@ -2102,19 +1607,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "tiny_http" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e22cb179b63e5fc2d0b5be237dc107da072e2407809ac70a8ce85b93fe8f562" -dependencies = [ - "ascii", - "chrono", - "chunked_transfer 0.3.1", - "log 0.4.14", - "url 1.7.2", -] - [[package]] name = "tinyvec" version = "1.3.1" @@ -2136,7 +1628,7 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4efe6fc2395938c8155973d7be49fe8d03a843726e285e100a8a383cc0154ce" dependencies = [ - "autocfg 1.0.1", + "autocfg", "bytes", "libc", "memchr", @@ -2168,7 +1660,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" dependencies = [ "cfg-if", - "log 0.4.14", + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -2204,36 +1696,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "traitobject" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" - -[[package]] -name = "twoway" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1" -dependencies = [ - "memchr", -] - -[[package]] -name = "typeable" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" - -[[package]] -name = "typemap" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "653be63c80a3296da5551e1bfd2cca35227e13cdd08c6668903ae2f4f77aa1f6" -dependencies = [ - "unsafe-any", -] - [[package]] name = "typenum" version = "1.14.0" @@ -2270,24 +1732,6 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" -[[package]] -name = "unicase" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" -dependencies = [ - "version_check 0.1.5", -] - -[[package]] -name = "unicase" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" -dependencies = [ - "version_check 0.9.3", -] - [[package]] name = "unicode-bidi" version = "0.3.6" @@ -2321,48 +1765,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" -[[package]] -name = "unsafe-any" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f" -dependencies = [ - "traitobject", -] - -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - -[[package]] -name = "ureq" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3131cd6cb18488da91da1d10ed31e966f453c06b65bf010d35638456976a3fd7" -dependencies = [ - "base64 0.13.0", - "chunked_transfer 1.4.0", - "log 0.4.14", - "once_cell", - "rustls", - "url 2.2.2", - "webpki", - "webpki-roots", -] - -[[package]] -name = "url" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" -dependencies = [ - "idna 0.1.5", - "matches", - "percent-encoding 1.0.1", -] - [[package]] name = "url" version = "2.2.2" @@ -2370,9 +1772,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" dependencies = [ "form_urlencoded", - "idna 0.2.3", + "idna", "matches", - "percent-encoding 2.1.0", + "percent-encoding", ] [[package]] @@ -2396,18 +1798,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "version_check" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" - -[[package]] -name = "version_check" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" - [[package]] name = "waker-fn" version = "1.1.0" @@ -2426,89 +1816,6 @@ version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" -[[package]] -name = "wasm-bindgen" -version = "0.2.76" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce9b1b516211d33767048e5d47fa2a381ed8b76fc48d2ce4aa39877f9f183e0" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.76" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfe8dc78e2326ba5f845f4b5bf548401604fa20b1dd1d365fb73b6c1d6364041" -dependencies = [ - "bumpalo", - "lazy_static", - "log 0.4.14", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.76" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44468aa53335841d9d6b6c023eaab07c0cd4bddbcfdee3e2bb1e8d2cb8069fef" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.76" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0195807922713af1e67dc66132c7328206ed9766af3858164fb583eedc25fbad" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.76" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdb075a845574a1fa5f09fd77e43f7747599301ea3417a9fbffdeedfc1f4a29" - -[[package]] -name = "web-sys" -version = "0.3.53" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224b2f6b67919060055ef1a67807367c2066ed520c3862cc013d26cf893a783c" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki" -version = "0.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "webpki-roots" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" -dependencies = [ - "webpki", -] - [[package]] name = "wepoll-ffi" version = "0.1.2" @@ -2555,7 +1862,7 @@ version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b1b52e6e8614d4a58b8e70cf51ec0cc21b256ad8206708bcff8139b5bbd6a59" dependencies = [ - "log 0.4.14", + "log", "mac", "markup5ever", "time", diff --git a/Cargo.toml b/Cargo.toml index 8c3a02f4..4bf60b1d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "el_monitorro" -version = "0.1.3" +version = "0.2.0" authors = ["Ayrat Badykov "] edition = "2018" @@ -14,7 +14,7 @@ dotenv = "0.15.0" env_logger = "0.9" fang = "0.4.1" feed-rs = "0.6.1" -frankenstein = "0.6.0" +frankenstein = { version = "0.6", default-features = false } handlebars = "4.1" html2text = "0.2" htmlescape = "0.3" diff --git a/Dockerfile b/Dockerfile index ce2369fd..03da983b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM rustlang/rust:nightly-buster +FROM rustlang/rust:nightly-bullseye WORKDIR /app diff --git a/README.md b/README.md index af7f5dbf..f7cb558d 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ # el_monitorro -`el_monitorro` is RSS, Atom and JSON feed reader as a Telegram bot. +El Monitorro is RSS, Atom and JSON feed reader as a Telegram bot. It's available at [@el_monitorro_bot](https://t.me/el_monitorro_bot). @@ -83,7 +83,7 @@ diesel database setup You'll need diesel-cli for this -3. Start a bot +3. Start the bot - Start the command bot @@ -108,37 +108,46 @@ RUST_LOG=info RUST_BACKTRACE=1 cargo run --bin deliver RUST_LOG=info RUST_BACKTRACE=1 cargo run --bin cleaner ``` +### Running all services from a single binary + +Set `ALL_BINARIES` to run all binaries (clean, commands, deliver, sync) in the same binary: + +``` +ALL_BINARIES=true +``` + ### Configuration All configuration is done through env variables -| Name | Required | Default value | Example / Description | -|--------------------------|----------|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| DATABASE_URL | yes | -- | postgres://postgres:postgres@localhost/el_monitorro | -| DATABASE_POOL_SIZE | no | 10 | | -| TELEGRAM_BOT_TOKEN | yes | -- | 6666618370:AAGx5YhNQvUG4eUcQXN-OB_a09ZzYl6aaaa | -| TELEGRAM_BOT_HANDLE | no | -- | This value is used during parsing of commands. If you set autocompletion menu for your bot, the bot will understand commands like `/subscribe@handle` along with just `/subscribe` | -| SUBSCRIPTION_LIMIT | no | 20 | | -| SYNC_INTERVAL_SECONDS | no | 60 | The bot tries to sync feeds every `SYNC_INTERVAL_SECONDS` seconds | -| DELIVER_INTERVAL_SECONDS | no | 60 | The bot tries to deliver new feed items every `DELIVER_INTERVAL_SECONDS` seconds | -| CLEAN_INTERVAL_SECONDS | no | 3600 | The bot cleans old feed items and feeds without subscriptions every `CLEAN_INTERVAL_SECONDS` seconds | -| OWNER_TELEGRAM_ID | no | -- | If this value is set, the bot will process commands from the specified chat id -| REQUEST_TIMEOUT | no | 5 | Timeout in seconds for feed syncing requests +| Name | Required | Default value | Example / Description | +|--------------------------|----------|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| DATABASE_URL | yes | -- | postgres://postgres:postgres@localhost/el_monitorro | +| TELEGRAM_BOT_TOKEN | yes | -- | 6666618370:AAGx5YhNQvUG4eUcQXN-OB_a09ZzYl6aaaa | +| DATABASE_POOL_SIZE | no | 5 | Db pool size to process user commands | +| ALL_BINARIES | no | -- | If this var is set, all services will be started in the main binary | +| TELEGRAM_BOT_HANDLE | no | -- | This value is used during parsing of commands. If you set autocompletion menu for your bot, the bot will understand commands like `/subscribe@handle` along with just `/subscribe` | +| SUBSCRIPTION_LIMIT | no | 20 | | +| SYNC_INTERVAL_SECONDS | no | 60 | The bot tries to sync feeds every `SYNC_INTERVAL_SECONDS` seconds | +| SYNC_WORKERS_NUMBER | no | 1 | The number of workers to sync feeds | +| DELIVER_INTERVAL_SECONDS | no | 60 | The bot tries to deliver new feed items every `DELIVER_INTERVAL_SECONDS` seconds | +| DELIVER_WORKERS_NUMBER | no | 1 | The number of workers to deliver updates | +| CLEAN_INTERVAL_SECONDS | no | 3600 | The bot cleans old feed items and feeds without subscriptions every `CLEAN_INTERVAL_SECONDS` seconds | +| CLEAN_WORKERS_NUMBER | no | 1 | The number of workers to remove old data | +| OWNER_TELEGRAM_ID | no | -- | If this value is set, the bot will process commands from the specified chat id | +| REQUEST_TIMEOUT | no | 5 | Timeout in seconds for feed syncing requests | ### Using docker image The image is published on docker hub under [ayratbadykov/el_monitorro](https://hub.docker.com/r/ayratbadykov/el_monitorro). It accepts additional env variables: - `RUN_MIGRATION` - if this variable is not empty, `diesel database setup` is run. It creates DB and runs migrations. -- `BOT_BINARY` - depending on this variable, docker container will run one of four binaries. Possible values are `commands`, `sync`, `deliver`, `cleaner`, `all`. - -You'll have to set these variables in the `.env` file. For example: +- `BOT_BINARY` - depending on this variable, docker container will run one of four binaries. Possible values are `commands`, `sync`, `deliver`, `cleaner`. To run all services in the main binary, set: ``` -... - RUN_MIGRATION=true BOT_BINARY=commands +ALL_BINARIES=true ``` Run the docker container: @@ -150,7 +159,6 @@ docker run --env-file ./.env --network host -t ayratbadykov/el_monitorro:latest Notes: - `--network host` is used so the docker container can access a host network if you're running Postgres on the same machine -- To run all binaries (commands, sync, deliver and cleaner), you'll have to start 4 containers replacing `BOT_BINARY` variable, or run with `BOT_BINARY` set to `all`. If you choose to use the `all` option, it would be wise to set a cron job to restart the container periodically in case one of the executables crashes. #### Creating a docker image from the latest master branch diff --git a/docker/start.sh b/docker/start.sh index f95a5de2..482d63b4 100644 --- a/docker/start.sh +++ b/docker/start.sh @@ -23,9 +23,6 @@ case "$BOT_BINARY" in cleaner*) ./cleaner ;; - all*) - ./el_monitorro & ./sync & ./deliver & ./cleaner - ;; *) echo "Unknown binary" exit 1 diff --git a/src/config.rs b/src/config.rs index 521093f9..00ed8894 100644 --- a/src/config.rs +++ b/src/config.rs @@ -66,7 +66,9 @@ impl Config { { let value = env::var(name).unwrap_or_else(|_| default_value.to_string()); - value.parse().unwrap() + value + .parse() + .unwrap_or_else(|_| panic!("{} can not be parsed", name)) } fn read_var(name: &str) -> T @@ -75,7 +77,9 @@ impl Config { { let value = env::var(name).unwrap_or_else(|_| panic!("{} must be set", name)); - value.parse().unwrap() + value + .parse() + .unwrap_or_else(|_| panic!("{} can not be parsed", name)) } fn read_var_option(name: &str) -> Option @@ -84,7 +88,9 @@ impl Config { { match env::var(name) { Ok(val) => { - let parsed_value: T = val.parse().unwrap(); + let parsed_value: T = val + .parse() + .unwrap_or_else(|_| panic!("{} can not be parsed", name)); Some(parsed_value) } Err(_error) => None,