From 48485c309738b98c50f99643147c2e0e5a5a0728 Mon Sep 17 00:00:00 2001 From: koalp Date: Fri, 30 Apr 2021 02:10:29 +0200 Subject: [PATCH] =?UTF-8?q?feat:=C2=A0add=20a=20containerfile=20to=20build?= =?UTF-8?q?=20a=20chatbot=20image?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An image to run crieur-chatbot have been added. The crieur-chatbot matrix-sdk dependency have been edited in order to use rustls instead of native tsl library. --- Cargo.lock | 403 +++++++--------------------- README.md | 27 +- containers/chatbot.containerfile | 26 ++ crieur-chatbot/Cargo.toml | 4 +- documentation/design/tooling.md | 36 +++ documentation/guides/run_chatbot.md | 12 +- justfile | 3 + 7 files changed, 188 insertions(+), 323 deletions(-) create mode 100644 containers/chatbot.containerfile create mode 100644 documentation/design/tooling.md diff --git a/Cargo.lock b/Cargo.lock index db3830a..25be411 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -95,9 +95,9 @@ checksum = "5f093eed78becd229346bf859eec0aa4dd7ddde0757287b2b4107a1f09c80002" [[package]] name = "async-trait" -version = "0.1.48" +version = "0.1.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36ea56748e10732c49404c153638a15ec3d6211ec5ff35d9bb20e13b93576adf" +checksum = "0b98e84bbb4cbcdd97da190ba0c58a1bb0de2c1fdf67d159e192ed766aeca722" dependencies = [ "proc-macro2", "quote", @@ -213,29 +213,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chacha20" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed8738f14471a99f0e316c327e68fc82a3611cc2895fcb604b89eedaf8f39d95" -dependencies = [ - "cipher", - "zeroize", -] - -[[package]] -name = "chacha20poly1305" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af1fc18e6d90c40164bf6c317476f2a98f04661e310e79830366b7e914c58a8e" -dependencies = [ - "aead", - "chacha20", - "cipher", - "poly1305", - "zeroize", -] - [[package]] name = "cipher" version = "0.2.5" @@ -265,9 +242,9 @@ dependencies = [ [[package]] name = "const_fn" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076a6803b0dacd6a88cfe64deba628b01533ff5ef265687e6938280c1afd0a28" +checksum = "402da840495de3f976eaefc3485b7f5eb5b0bf9761f9a47be27fe975b3b8c2ec" [[package]] name = "convert_case" @@ -319,15 +296,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba" -[[package]] -name = "crc32fast" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" -dependencies = [ - "cfg-if 1.0.0", -] - [[package]] name = "crieur" version = "0.1.0" @@ -378,30 +346,6 @@ dependencies = [ "url", ] -[[package]] -name = "crossbeam-epoch" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", - "lazy_static", - "memoffset", - "scopeguard", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" -dependencies = [ - "autocfg 1.0.1", - "cfg-if 1.0.0", - "lazy_static", -] - [[package]] name = "crypto-mac" version = "0.10.0" @@ -491,9 +435,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9d6ddad5866bb2170686ed03f6839d31a76e5407d80b1c334a2c24618543ffa" +checksum = "5f2c43f534ea4b0b049015d00269734195e6d3f0f6635cb692251aca6f9f8b3c" dependencies = [ "darling_core", "darling_macro", @@ -501,9 +445,9 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9ced1fd13dc386d5a8315899de465708cf34ee2a6d9394654515214e67bb846" +checksum = "8e91455b86830a1c21799d94524df0845183fa55bafd9aa137b01c7d1065fa36" dependencies = [ "fnv", "ident_case", @@ -515,9 +459,9 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a7a1445d54b2f9792e3b31a3e715feabbace393f38dc4ffd49d94ee9bc487d5" +checksum = "29b5acf0dea37a7f66f7b25d2c5e93fd46f8f6968b1a5d7a3e02e97768afc95a" dependencies = [ "darling_core", "quote", @@ -536,19 +480,18 @@ dependencies = [ [[package]] name = "derive_builder" -version = "0.10.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ef25735c9f0d0c547d2794701600c94abf030ecb740fad1673fa64461f3573" +checksum = "d13202debe11181040ae9063d739fa32cfcaaebe2275fe387703460ae2365b30" dependencies = [ - "derive_builder_core", "derive_builder_macro", ] [[package]] name = "derive_builder_core" -version = "0.10.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3150f1e84602847b99d3eeb702487fc364f7d6c94f634e944a68fdbaea09e457" +checksum = "66e616858f6187ed828df7c64a6d71720d83767a7f19740b2d1b6fe6327b36e5" dependencies = [ "darling", "proc-macro2", @@ -558,9 +501,9 @@ dependencies = [ [[package]] name = "derive_builder_macro" -version = "0.10.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca1008bddefdc08d1e734aeb27b94f384390af261b4d1a8fb51fe19c577f05c" +checksum = "58a94ace95092c5acb1e97a7e846b310cfbd499652f72297da7493f618a98d73" dependencies = [ "derive_builder_core", "syn", @@ -616,9 +559,9 @@ dependencies = [ [[package]] name = "educe" -version = "0.4.14" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54ed56329d95e524ef98177ad672881bdfe7f22f254eb6ae80deb6fdd2ab20c4" +checksum = "2b6f648515c65974bcb893b286a5c4a35adfdcfbfd03c1bbf1108f40feec65d7" dependencies = [ "enum-ordinalize", "proc-macro2", @@ -643,9 +586,9 @@ dependencies = [ [[package]] name = "enum-ordinalize" -version = "3.1.9" +version = "3.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d52ff39419d3e16961ecfb9e32f5042bdaacf9a4cc553d2d688057117bae49b" +checksum = "0b166c9e378360dd5a6666a9604bb4f54ae0cac39023ffbac425e917a2a04fef" dependencies = [ "num-bigint", "num-traits", @@ -673,21 +616,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.0.1" @@ -698,16 +626,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fs2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "fuchsia-cprng" version = "0.1.1" @@ -950,18 +868,18 @@ dependencies = [ [[package]] name = "html-escape" -version = "0.2.7" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d64794b2265e97e459334ed47a7b7369ce8e8ee3d3450c0c363a0b563fc92233" +checksum = "816ea801a95538fc5f53c836697b3f8b64a9d664c4f0b91efe1fe7c92e4dbcb7" dependencies = [ "utf8-width", ] [[package]] name = "html-minifier" -version = "3.0.9" +version = "3.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae99b46762d01ce79973e90ff61541ee9d2b6179ff8f554c38602e48e8158088" +checksum = "108452631307790510cde91282fc706ae70076bd68200add8638773f06d5e122" dependencies = [ "cow-utils", "educe", @@ -1007,15 +925,15 @@ dependencies = [ [[package]] name = "httparse" -version = "1.3.5" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691" +checksum = "4a1ce40d6fc9764887c2fdc7305c3dcc429ba11ff981c1509416afd5697e4437" [[package]] name = "httpdate" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" +checksum = "05842d0d43232b23ccb7060ecb0f0626922c21f30012e97b767b30afd4a5d4b9" [[package]] name = "humantime" @@ -1025,9 +943,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.5" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf09f61b52cfcf4c00de50df88ae423d6c02354e385a86341133b5338630ad1" +checksum = "1e5f105c494081baa3bf9e200b279e27ec1623895cd504c7dbef8d0b080fcf54" dependencies = [ "bytes", "futures-channel", @@ -1064,19 +982,6 @@ dependencies = [ "webpki", ] -[[package]] -name = "hyper-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper", - "native-tls", - "tokio", - "tokio-native-tls", -] - [[package]] name = "ident_case" version = "1.0.1" @@ -1085,9 +990,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89829a5d69c23d348314a7ac337fe39173b61149a9864deabd260983aed48c21" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" dependencies = [ "matches", "unicode-bidi", @@ -1180,9 +1085,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.92" +version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56d855069fafbb9b344c0f962150cd2c1187975cb1c22c1522c240d8c4986714" +checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e" [[package]] name = "lock_api" @@ -1241,16 +1146,13 @@ checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" [[package]] name = "markup5ever" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aae38d669396ca9b707bfc3db254bc382ddb94f57cc5c235f34623a669a01dab" +checksum = "a24f40fb03852d1cdd84330cddcaf98e9ec08a7b7768e952fad3b4cf048ec8fd" dependencies = [ "log", "phf 0.8.0", "phf_codegen 0.8.0", - "serde", - "serde_derive", - "serde_json", "string_cache", "string_cache_codegen", "tendril", @@ -1265,7 +1167,7 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" [[package]] name = "matrix-sdk" version = "0.2.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=ab180362c931606385dd53b73620d82ef2c3166d#ab180362c931606385dd53b73620d82ef2c3166d" +source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=242d46c9a1bf40fa15b5892c2ee81cb0f4508ff4#242d46c9a1bf40fa15b5892c2ee81cb0f4508ff4" dependencies = [ "backoff", "bytes", @@ -1289,20 +1191,14 @@ dependencies = [ [[package]] name = "matrix-sdk-base" version = "0.2.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=ab180362c931606385dd53b73620d82ef2c3166d#ab180362c931606385dd53b73620d82ef2c3166d" +source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=242d46c9a1bf40fa15b5892c2ee81cb0f4508ff4#242d46c9a1bf40fa15b5892c2ee81cb0f4508ff4" dependencies = [ - "chacha20poly1305", "dashmap", "futures", - "hmac", "matrix-sdk-common", "matrix-sdk-crypto", - "pbkdf2", - "rand 0.8.3", "serde", "serde_json", - "sha2", - "sled", "thiserror", "tokio", "tracing", @@ -1312,7 +1208,7 @@ dependencies = [ [[package]] name = "matrix-sdk-common" version = "0.2.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=ab180362c931606385dd53b73620d82ef2c3166d#ab180362c931606385dd53b73620d82ef2c3166d" +source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=242d46c9a1bf40fa15b5892c2ee81cb0f4508ff4#242d46c9a1bf40fa15b5892c2ee81cb0f4508ff4" dependencies = [ "async-trait", "futures", @@ -1328,7 +1224,7 @@ dependencies = [ [[package]] name = "matrix-sdk-crypto" version = "0.2.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=ab180362c931606385dd53b73620d82ef2c3166d#ab180362c931606385dd53b73620d82ef2c3166d" +source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=242d46c9a1bf40fa15b5892c2ee81cb0f4508ff4#242d46c9a1bf40fa15b5892c2ee81cb0f4508ff4" dependencies = [ "aes-ctr", "aes-gcm", @@ -1345,7 +1241,6 @@ dependencies = [ "serde", "serde_json", "sha2", - "sled", "thiserror", "tracing", "zeroize", @@ -1363,15 +1258,6 @@ version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" -[[package]] -name = "memoffset" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d" -dependencies = [ - "autocfg 1.0.1", -] - [[package]] name = "mime" version = "0.3.16" @@ -1409,24 +1295,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "native-tls" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "new_debug_unreachable" version = "1.0.4" @@ -1463,9 +1331,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d0a3d5e207573f948a9e5376662aa743a2ea13f7c50a554d7af443a73fbfeba" +checksum = "4e0d047c1062aa51e256408c560894e5251f08925980e53cf1aa5bd00eec6512" dependencies = [ "autocfg 1.0.1", "num-integer", @@ -1535,39 +1403,12 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" -[[package]] -name = "openssl" -version = "0.10.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a61075b62a23fef5a29815de7536d940aa35ce96d18ce0cc5076272db678a577" -dependencies = [ - "bitflags", - "cfg-if 1.0.0", - "foreign-types", - "libc", - "once_cell", - "openssl-sys", -] - [[package]] name = "openssl-probe" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" -[[package]] -name = "openssl-sys" -version = "0.9.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "313752393519e876837e09e1fa183ddef0be7735868dced3196f4472d536277f" -dependencies = [ - "autocfg 1.0.1", - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "parking_lot" version = "0.11.1" @@ -1708,18 +1549,18 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc174859768806e91ae575187ada95c91a29e96a98dc5d2cd9a1fed039501ba6" +checksum = "c7509cc106041c40a4518d2af7a61530e1eed0e6285296a3d8c5472806ccc4a4" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a490329918e856ed1b083f244e3bfe2d8c4f336407e4ea9e1a9f479ff09049e5" +checksum = "48c950132583b500556b1efd71d45b319029f2b71518d979fcc208e16b42426f" dependencies = [ "proc-macro2", "quote", @@ -1738,22 +1579,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "pkg-config" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" - -[[package]] -name = "poly1305" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b7456bc1ad2d4cf82b3a016be4c2ac48daf11bf990c1603ebd447fe6f30fca8" -dependencies = [ - "cpuid-bool 0.2.0", - "universal-hash", -] - [[package]] name = "polyval" version = "0.4.5" @@ -2031,18 +1856,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.5" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" +checksum = "85dd92e586f7355c633911e11f77f3d12f04b1b1bd76a198bd34ae3af8341ef2" dependencies = [ "bitflags", ] [[package]] name = "regex" -version = "1.4.5" +version = "1.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" +checksum = "2a26af418b574bd56588335b3a3659a65725d4e636eb1016c2f9e3b38c7cc759" dependencies = [ "aho-corasick", "memchr", @@ -2055,15 +1880,6 @@ version = "0.6.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" -[[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 = "reqwest" version = "0.11.3" @@ -2078,23 +1894,24 @@ dependencies = [ "http", "http-body", "hyper", - "hyper-tls", + "hyper-rustls", "ipnet", "js-sys", "lazy_static", "log", "mime", - "native-tls", "percent-encoding", "pin-project-lite", + "rustls", "serde", "serde_urlencoded", "tokio", - "tokio-native-tls", + "tokio-rustls", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", + "webpki-roots", "winreg", ] @@ -2116,7 +1933,7 @@ dependencies = [ [[package]] name = "ruma" version = "0.0.3" -source = "git+https://github.com/ruma/ruma?rev=c816630058ab625d93ebab294e9e6c02dd9d866c#c816630058ab625d93ebab294e9e6c02dd9d866c" +source = "git+https://github.com/ruma/ruma?rev=1e005f576e4640ee5ce6e357bcf33293819502d1#1e005f576e4640ee5ce6e357bcf33293819502d1" dependencies = [ "assign", "js_int", @@ -2132,8 +1949,9 @@ dependencies = [ [[package]] name = "ruma-api" version = "0.17.0-alpha.4" -source = "git+https://github.com/ruma/ruma?rev=c816630058ab625d93ebab294e9e6c02dd9d866c#c816630058ab625d93ebab294e9e6c02dd9d866c" +source = "git+https://github.com/ruma/ruma?rev=1e005f576e4640ee5ce6e357bcf33293819502d1#1e005f576e4640ee5ce6e357bcf33293819502d1" dependencies = [ + "bytes", "http", "percent-encoding", "ruma-api-macros", @@ -2147,7 +1965,7 @@ dependencies = [ [[package]] name = "ruma-api-macros" version = "0.17.0-alpha.4" -source = "git+https://github.com/ruma/ruma?rev=c816630058ab625d93ebab294e9e6c02dd9d866c#c816630058ab625d93ebab294e9e6c02dd9d866c" +source = "git+https://github.com/ruma/ruma?rev=1e005f576e4640ee5ce6e357bcf33293819502d1#1e005f576e4640ee5ce6e357bcf33293819502d1" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2158,9 +1976,10 @@ dependencies = [ [[package]] name = "ruma-client-api" version = "0.10.0-alpha.3" -source = "git+https://github.com/ruma/ruma?rev=c816630058ab625d93ebab294e9e6c02dd9d866c#c816630058ab625d93ebab294e9e6c02dd9d866c" +source = "git+https://github.com/ruma/ruma?rev=1e005f576e4640ee5ce6e357bcf33293819502d1#1e005f576e4640ee5ce6e357bcf33293819502d1" dependencies = [ "assign", + "bytes", "http", "js_int", "maplit", @@ -2177,7 +1996,7 @@ dependencies = [ [[package]] name = "ruma-common" version = "0.5.0" -source = "git+https://github.com/ruma/ruma?rev=c816630058ab625d93ebab294e9e6c02dd9d866c#c816630058ab625d93ebab294e9e6c02dd9d866c" +source = "git+https://github.com/ruma/ruma?rev=1e005f576e4640ee5ce6e357bcf33293819502d1#1e005f576e4640ee5ce6e357bcf33293819502d1" dependencies = [ "indexmap", "js_int", @@ -2193,7 +2012,7 @@ dependencies = [ [[package]] name = "ruma-events" version = "0.22.0-alpha.3" -source = "git+https://github.com/ruma/ruma?rev=c816630058ab625d93ebab294e9e6c02dd9d866c#c816630058ab625d93ebab294e9e6c02dd9d866c" +source = "git+https://github.com/ruma/ruma?rev=1e005f576e4640ee5ce6e357bcf33293819502d1#1e005f576e4640ee5ce6e357bcf33293819502d1" dependencies = [ "js_int", "ruma-common", @@ -2207,7 +2026,7 @@ dependencies = [ [[package]] name = "ruma-events-macros" version = "0.22.0-alpha.3" -source = "git+https://github.com/ruma/ruma?rev=c816630058ab625d93ebab294e9e6c02dd9d866c#c816630058ab625d93ebab294e9e6c02dd9d866c" +source = "git+https://github.com/ruma/ruma?rev=1e005f576e4640ee5ce6e357bcf33293819502d1#1e005f576e4640ee5ce6e357bcf33293819502d1" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2218,7 +2037,7 @@ dependencies = [ [[package]] name = "ruma-federation-api" version = "0.1.0-alpha.2" -source = "git+https://github.com/ruma/ruma?rev=c816630058ab625d93ebab294e9e6c02dd9d866c#c816630058ab625d93ebab294e9e6c02dd9d866c" +source = "git+https://github.com/ruma/ruma?rev=1e005f576e4640ee5ce6e357bcf33293819502d1#1e005f576e4640ee5ce6e357bcf33293819502d1" dependencies = [ "js_int", "ruma-api", @@ -2233,7 +2052,7 @@ dependencies = [ [[package]] name = "ruma-identifiers" version = "0.19.0" -source = "git+https://github.com/ruma/ruma?rev=c816630058ab625d93ebab294e9e6c02dd9d866c#c816630058ab625d93ebab294e9e6c02dd9d866c" +source = "git+https://github.com/ruma/ruma?rev=1e005f576e4640ee5ce6e357bcf33293819502d1#1e005f576e4640ee5ce6e357bcf33293819502d1" dependencies = [ "paste", "ruma-identifiers-macros", @@ -2246,7 +2065,7 @@ dependencies = [ [[package]] name = "ruma-identifiers-macros" version = "0.19.0" -source = "git+https://github.com/ruma/ruma?rev=c816630058ab625d93ebab294e9e6c02dd9d866c#c816630058ab625d93ebab294e9e6c02dd9d866c" +source = "git+https://github.com/ruma/ruma?rev=1e005f576e4640ee5ce6e357bcf33293819502d1#1e005f576e4640ee5ce6e357bcf33293819502d1" dependencies = [ "proc-macro2", "quote", @@ -2257,13 +2076,14 @@ dependencies = [ [[package]] name = "ruma-identifiers-validation" version = "0.3.0" -source = "git+https://github.com/ruma/ruma?rev=c816630058ab625d93ebab294e9e6c02dd9d866c#c816630058ab625d93ebab294e9e6c02dd9d866c" +source = "git+https://github.com/ruma/ruma?rev=1e005f576e4640ee5ce6e357bcf33293819502d1#1e005f576e4640ee5ce6e357bcf33293819502d1" [[package]] name = "ruma-serde" version = "0.3.1" -source = "git+https://github.com/ruma/ruma?rev=c816630058ab625d93ebab294e9e6c02dd9d866c#c816630058ab625d93ebab294e9e6c02dd9d866c" +source = "git+https://github.com/ruma/ruma?rev=1e005f576e4640ee5ce6e357bcf33293819502d1#1e005f576e4640ee5ce6e357bcf33293819502d1" dependencies = [ + "bytes", "form_urlencoded", "itoa", "js_int", @@ -2275,7 +2095,7 @@ dependencies = [ [[package]] name = "ruma-serde-macros" version = "0.3.1" -source = "git+https://github.com/ruma/ruma?rev=c816630058ab625d93ebab294e9e6c02dd9d866c#c816630058ab625d93ebab294e9e6c02dd9d866c" +source = "git+https://github.com/ruma/ruma?rev=1e005f576e4640ee5ce6e357bcf33293819502d1#1e005f576e4640ee5ce6e357bcf33293819502d1" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2294,9 +2114,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "064fd21ff87c6e87ed4506e68beb42459caa4a0e2eb144932e6776768556980b" +checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" dependencies = [ "base64", "log", @@ -2347,9 +2167,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "sct" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c" +checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" dependencies = [ "ring", "untrusted", @@ -2533,25 +2353,9 @@ checksum = "cbce6d4507c7e4a3962091436e56e95290cb71fa302d0d270e32130b75fbff27" [[package]] name = "slab" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" - -[[package]] -name = "sled" -version = "0.34.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0132f3e393bcb7390c60bb45769498cf4550bcb7a21d7f95c02b69f6362cdc" -dependencies = [ - "crc32fast", - "crossbeam-epoch", - "crossbeam-utils", - "fs2", - "fxhash", - "libc", - "log", - "parking_lot", -] +checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527" [[package]] name = "smallvec" @@ -2687,9 +2491,9 @@ checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" [[package]] name = "syn" -version = "1.0.68" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ce15dd3ed8aa2f8eeac4716d6ef5ab58b6b9256db41d7e1a0224c2788e8fd87" +checksum = "ad184cc9470f9117b2ac6817bfe297307418819ba40552f9b3846f05c33d5373" dependencies = [ "proc-macro2", "quote", @@ -2708,20 +2512,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 1.0.0", - "libc", - "rand 0.8.3", - "redox_syscall", - "remove_dir_all", - "winapi", -] - [[package]] name = "tendril" version = "0.4.2" @@ -2852,16 +2642,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-native-tls" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" -dependencies = [ - "native-tls", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.22.0" @@ -2875,9 +2655,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5143d049e85af7fbc36f5454d990e62c2df705b3589f123b71f441b6b59f443f" +checksum = "940a12c99365c31ea8dd9ba04ec1be183ffe4920102bb7122c2f515437601e8e" dependencies = [ "bytes", "futures-core", @@ -3016,15 +2796,15 @@ dependencies = [ [[package]] name = "utf-8" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] name = "utf8-width" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9071ac216321a4470a69fb2b28cfc68dcd1a39acd877c8be8e014df6772d8efa" +checksum = "7cf7d77f457ef8dfa11e4cd5933c5ddb5dc52a94664071951219a97710f0a32b" [[package]] name = "uuid" @@ -3036,12 +2816,6 @@ dependencies = [ "serde", ] -[[package]] -name = "vcpkg" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbdbff6266a24120518560b5dc983096efb98462e51d0d68169895b237be3e5d" - [[package]] name = "version_check" version = "0.9.3" @@ -3158,6 +2932,15 @@ dependencies = [ "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 = "wildmatch" version = "2.1.0" diff --git a/README.md b/README.md index f5970e5..455d599 100644 --- a/README.md +++ b/README.md @@ -9,25 +9,32 @@ First retrieve login cookies for websites and put it in a `.env` such as explained in the [newspaper source configuration documentation](./documentation/reference/newspaper_configuration.md) -Then you can run run +Then you can run [an example](./examples/cli_downloader.rs) using ``` cargo run --example=cli_downloader ``` +You can also specify the URL using +``` +cargo run --example=cli_downloader -- [your url] +``` + To know how to run the chatbot, please read the [chatbot guide](./documentation/guides/run_chatbot.md) # Documentation -- 1. Design - - a. [Scope of the project and roadmap](./documentation/design/scope.md) - - b. [Retrieve](./documentation/design/retrieve.md) -- 2. Guides - - a. [Add a newspaper a - source](./documentation/guides/add_a_newspaper_source.md) -- 3. Reference - - a. [Newspaper source +1. Design + 1. [Scope of the project and roadmap](./documentation/design/scope.md) + 2. [Retrieve](./documentation/design/retrieve.md) + 3. [Tooling](./documentation/design/tooling.md) +2. Guides + 1. [Add a newspaper a source + ](./documentation/guides/add_a_newspaper_source.md) + 2. [Build and run the chatbot](./documentation/guides/run_chatbot.md) +3. Reference + 1. [Newspaper source configuration](./documentation/reference/newspaper_configuration.md) - - b. [Chatbot + 2. [Chatbot configuration](./documentation/reference/chatbot_configuration.md) diff --git a/containers/chatbot.containerfile b/containers/chatbot.containerfile new file mode 100644 index 0000000..9317f45 --- /dev/null +++ b/containers/chatbot.containerfile @@ -0,0 +1,26 @@ +FROM docker.io/rust:1.51-alpine as build +WORKDIR /app + +RUN apk add \ + cmake \ + musl-dev \ + make \ + g++ \ + && rustup target add x86_64-unknown-linux-musl + +COPY Cargo.lock Cargo.toml . +COPY crieur-chatbot crieur-chatbot +COPY crieur-retrieve crieur-retrieve +COPY src src + +RUN RUSTFLAGS=-Ctarget-feature=-crt-static cargo build --target x86_64-unknown-linux-musl --release --bin=crieur-chatbot + +FROM scratch +WORKDIR / + +COPY --from=build /usr/lib/libstdc++.so.6 /usr/lib/libstdc++.so.6 +COPY --from=build /usr/lib/libgcc_s.so.1 /usr/lib/libgcc_s.so.1 +COPY --from=build /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 +COPY --from=build /app/target/x86_64-unknown-linux-musl/release/crieur-chatbot /crieur-chatbot + +CMD ["./crieur-chatbot"] diff --git a/crieur-chatbot/Cargo.toml b/crieur-chatbot/Cargo.toml index e2f3631..c415dd2 100644 --- a/crieur-chatbot/Cargo.toml +++ b/crieur-chatbot/Cargo.toml @@ -15,5 +15,7 @@ log = "0.4.14" [dependencies.matrix-sdk] git = "https://github.com/matrix-org/matrix-rust-sdk" -rev = "ab180362c931606385dd53b73620d82ef2c3166d" +rev = "242d46c9a1bf40fa15b5892c2ee81cb0f4508ff4" version = "0.2.0" +default-features = false +features = ["encryption", "rustls-tls", "require_auth_for_profile_requests"] diff --git a/documentation/design/tooling.md b/documentation/design/tooling.md new file mode 100644 index 0000000..627d841 --- /dev/null +++ b/documentation/design/tooling.md @@ -0,0 +1,36 @@ +--- +title: Project tooling +--- + +# Container image + + +## Chatbot release + +The [chatbot containerfile](../../containers/chatbot.containerfile) intend to +be the smaller possible in order to ease and reduce the storage needed in +registries. + +In order to provide a minimal image, the rust-alpine container image is used. +This image uses the `x86_64-unknown-linux-musl` target that provides static +linking with `musl`. + +However, the `olm-sys` couldn't be linked statically[^oml-sys-static-error]. +The workaround have been to introduce the +`RUSTFLAGS=-Ctarget-feature=-crt-static` environment variable that disables +static linking. + +The following lines have been added to copy the needed libraries. + +```containerfile +COPY --from=build /usr/lib/libstdc++.so.6 /usr/lib/libstdc++.so.6 +COPY --from=build /usr/lib/libgcc_s.so.1 /usr/lib/libgcc_s.so.1 +COPY --from=build /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 +``` + +## Development + +An image aimed at providing a development environment for developers may +be added later. + +[^oml-sys-static-error]: with `oml-sys` v1.1.1, in march 2021 diff --git a/documentation/guides/run_chatbot.md b/documentation/guides/run_chatbot.md index b6f9322..bee82b3 100644 --- a/documentation/guides/run_chatbot.md +++ b/documentation/guides/run_chatbot.md @@ -1,5 +1,5 @@ --- -title: run the chatbot +title: Build and run the chatbot --- 1. You must first configure matrix login, every variable in [the_reference](../reference/chatbot_configuration.md) is mandatory. @@ -13,7 +13,15 @@ CRIEUR_MATRIX_ROOM=roomid You can put it in a `.env` file. -2. run the chatbot +2. Run the chatbot + +**Using `podman` (or another container tool, like `docker`)** +``` +podman build --file ./containers/chatbot.containerfile -t crieur-chatbot . +podman run --env-file .env --rm -i -t crieur-chatbot +``` + +**Using `cargo` (for development)** ``` cargo run --release --bin crieur-chatbot ``` diff --git a/justfile b/justfile index ca269ef..a28b9d5 100644 --- a/justfile +++ b/justfile @@ -7,6 +7,9 @@ @run: cargo run +@container: + podman build --file ./containers/chatbot.containerfile -t crieur-chatbot . + @audit: cargo audit