From 3e06fd57ac95c45476dabf9f2bc901a4e77b1135 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Wed, 11 Dec 2024 15:49:49 +0000 Subject: [PATCH 1/3] add ruma --- Cargo.lock | 95 ++++++++++++++++++++++++++++++++++------- Cargo.toml | 5 +++ native/acter/Cargo.toml | 3 +- native/core/Cargo.toml | 1 + 4 files changed, 86 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4bf15e34d337..163da6047f9b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -54,7 +54,7 @@ dependencies = [ "pulldown-cmark 0.9.6", "reqwest", "ruma", - "ruma-common", + "ruma-common 0.14.1 (git+https://github.com/ruma/ruma?rev=c91499fc464adc865a7c99d0ce0b35982ad96711)", "sanitize-filename-reader-friendly", "scc", "serde", @@ -4442,23 +4442,24 @@ dependencies = [ [[package]] name = "ruma" version = "0.11.1" -source = "git+https://github.com/ruma/ruma?rev=c91499fc464adc865a7c99d0ce0b35982ad96711#c91499fc464adc865a7c99d0ce0b35982ad96711" +source = "git+https://github.com/acterglobal/ruma?branch=ben-msc2326#5f85a7939b17167132925142ded895b397104ca0" dependencies = [ "assign", "js_int", "js_option", "ruma-client-api", - "ruma-common", + "ruma-common 0.14.1 (git+https://github.com/acterglobal/ruma?branch=ben-msc2326)", "ruma-events", "ruma-federation-api", "ruma-html", + "ruma-push-gateway-api", "web-time", ] [[package]] name = "ruma-client-api" version = "0.19.0" -source = "git+https://github.com/ruma/ruma?rev=c91499fc464adc865a7c99d0ce0b35982ad96711#c91499fc464adc865a7c99d0ce0b35982ad96711" +source = "git+https://github.com/acterglobal/ruma?branch=ben-msc2326#5f85a7939b17167132925142ded895b397104ca0" dependencies = [ "as_variant", "assign", @@ -4468,7 +4469,7 @@ dependencies = [ "js_int", "js_option", "maplit", - "ruma-common", + "ruma-common 0.14.1 (git+https://github.com/acterglobal/ruma?branch=ben-msc2326)", "ruma-events", "serde", "serde_html_form", @@ -4481,7 +4482,7 @@ dependencies = [ [[package]] name = "ruma-common" version = "0.14.1" -source = "git+https://github.com/ruma/ruma?rev=c91499fc464adc865a7c99d0ce0b35982ad96711#c91499fc464adc865a7c99d0ce0b35982ad96711" +source = "git+https://github.com/acterglobal/ruma?branch=ben-msc2326#5f85a7939b17167132925142ded895b397104ca0" dependencies = [ "as_variant", "base64 0.22.1", @@ -4496,8 +4497,8 @@ dependencies = [ "percent-encoding", "rand", "regex", - "ruma-identifiers-validation", - "ruma-macros", + "ruma-identifiers-validation 0.10.0 (git+https://github.com/acterglobal/ruma?branch=ben-msc2326)", + "ruma-macros 0.14.0 (git+https://github.com/acterglobal/ruma?branch=ben-msc2326)", "serde", "serde_html_form", "serde_json", @@ -4510,10 +4511,36 @@ dependencies = [ "wildmatch", ] +[[package]] +name = "ruma-common" +version = "0.14.1" +source = "git+https://github.com/ruma/ruma?rev=c91499fc464adc865a7c99d0ce0b35982ad96711#c91499fc464adc865a7c99d0ce0b35982ad96711" +dependencies = [ + "as_variant", + "base64 0.22.1", + "bytes", + "form_urlencoded", + "indexmap 2.7.0", + "js_int", + "percent-encoding", + "regex", + "ruma-identifiers-validation 0.10.0 (git+https://github.com/ruma/ruma?rev=c91499fc464adc865a7c99d0ce0b35982ad96711)", + "ruma-macros 0.14.0 (git+https://github.com/ruma/ruma?rev=c91499fc464adc865a7c99d0ce0b35982ad96711)", + "serde", + "serde_html_form", + "serde_json", + "thiserror 2.0.6", + "time", + "tracing", + "url", + "web-time", + "wildmatch", +] + [[package]] name = "ruma-events" version = "0.29.1" -source = "git+https://github.com/ruma/ruma?rev=c91499fc464adc865a7c99d0ce0b35982ad96711#c91499fc464adc865a7c99d0ce0b35982ad96711" +source = "git+https://github.com/acterglobal/ruma?branch=ben-msc2326#5f85a7939b17167132925142ded895b397104ca0" dependencies = [ "as_variant", "indexmap 2.7.0", @@ -4522,10 +4549,10 @@ dependencies = [ "percent-encoding", "pulldown-cmark 0.12.2", "regex", - "ruma-common", + "ruma-common 0.14.1 (git+https://github.com/acterglobal/ruma?branch=ben-msc2326)", "ruma-html", - "ruma-identifiers-validation", - "ruma-macros", + "ruma-identifiers-validation 0.10.0 (git+https://github.com/acterglobal/ruma?branch=ben-msc2326)", + "ruma-macros 0.14.0 (git+https://github.com/acterglobal/ruma?branch=ben-msc2326)", "serde", "serde_json", "thiserror 2.0.6", @@ -4538,12 +4565,12 @@ dependencies = [ [[package]] name = "ruma-federation-api" version = "0.10.0" -source = "git+https://github.com/ruma/ruma?rev=c91499fc464adc865a7c99d0ce0b35982ad96711#c91499fc464adc865a7c99d0ce0b35982ad96711" +source = "git+https://github.com/acterglobal/ruma?branch=ben-msc2326#5f85a7939b17167132925142ded895b397104ca0" dependencies = [ "http 1.2.0", "js_int", "mime", - "ruma-common", + "ruma-common 0.14.1 (git+https://github.com/acterglobal/ruma?branch=ben-msc2326)", "ruma-events", "serde", "serde_json", @@ -4552,7 +4579,7 @@ dependencies = [ [[package]] name = "ruma-html" version = "0.3.0" -source = "git+https://github.com/ruma/ruma?rev=c91499fc464adc865a7c99d0ce0b35982ad96711#c91499fc464adc865a7c99d0ce0b35982ad96711" +source = "git+https://github.com/acterglobal/ruma?branch=ben-msc2326#5f85a7939b17167132925142ded895b397104ca0" dependencies = [ "as_variant", "html5ever", @@ -4561,6 +4588,15 @@ dependencies = [ "wildmatch", ] +[[package]] +name = "ruma-identifiers-validation" +version = "0.10.0" +source = "git+https://github.com/acterglobal/ruma?branch=ben-msc2326#5f85a7939b17167132925142ded895b397104ca0" +dependencies = [ + "js_int", + "thiserror 2.0.6", +] + [[package]] name = "ruma-identifiers-validation" version = "0.10.0" @@ -4570,6 +4606,21 @@ dependencies = [ "thiserror 2.0.6", ] +[[package]] +name = "ruma-macros" +version = "0.14.0" +source = "git+https://github.com/acterglobal/ruma?branch=ben-msc2326#5f85a7939b17167132925142ded895b397104ca0" +dependencies = [ + "cfg-if", + "proc-macro-crate", + "proc-macro2", + "quote", + "ruma-identifiers-validation 0.10.0 (git+https://github.com/acterglobal/ruma?branch=ben-msc2326)", + "serde", + "syn 2.0.90", + "toml 0.8.19", +] + [[package]] name = "ruma-macros" version = "0.14.0" @@ -4580,12 +4631,24 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "ruma-identifiers-validation", + "ruma-identifiers-validation 0.10.0 (git+https://github.com/ruma/ruma?rev=c91499fc464adc865a7c99d0ce0b35982ad96711)", "serde", "syn 2.0.90", "toml 0.8.19", ] +[[package]] +name = "ruma-push-gateway-api" +version = "0.10.0" +source = "git+https://github.com/acterglobal/ruma?branch=ben-msc2326#5f85a7939b17167132925142ded895b397104ca0" +dependencies = [ + "js_int", + "ruma-common 0.14.1 (git+https://github.com/acterglobal/ruma?branch=ben-msc2326)", + "ruma-events", + "serde", + "serde_json", +] + [[package]] name = "rusqlite" version = "0.32.1" diff --git a/Cargo.toml b/Cargo.toml index 818caf463855..09cccc7a39a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,6 +49,7 @@ default-features = false # version = "0.11.1" git = "https://github.com/ruma/ruma" rev = "c91499fc464adc865a7c99d0ce0b35982ad96711" +features = ["unstable-msc2326"] # - see comment above [workspace.dependencies.ruma-common] @@ -78,3 +79,7 @@ strip = true # Automatically strip symbols from the binary. [patch.crates-io] const_panic = { git = "https://github.com/jplatte/const_panic", rev = "9024a4cb3eac45c1d2d980f17aaee287b17be498" } +[patch.'https://github.com/ruma/ruma'] +ruma = { git = "https://github.com/acterglobal/ruma", branch = "ben-msc2326"} +ruma-events = { git = "https://github.com/acterglobal/ruma", branch = "ben-msc2326"} +ruma-client-api = { git = "https://github.com/acterglobal/ruma", branch = "ben-msc2326"} \ No newline at end of file diff --git a/native/acter/Cargo.toml b/native/acter/Cargo.toml index 76eb866218da..caab73203114 100644 --- a/native/acter/Cargo.toml +++ b/native/acter/Cargo.toml @@ -79,8 +79,7 @@ tracing-log = { version = "0.2", optional = true } console-subscriber = { version = "0.2.0", optional = true } # not used directly but needed to enable specific features from ruma -ruma = { workspace = true, features = ["html", "rand", "unstable-msc2448", "unstable-msc2965", "unstable-msc3930", "unstable-msc3245-v1-compat"] } -ruma-common = { workspace = true, features = ["client", "unstable-unspecified"] } +ruma = { workspace = true, features = ["html", "rand", "unstable-unspecified", "unstable-msc2448", "unstable-msc2965", "unstable-msc3930", "unstable-msc3245-v1-compat"] } [dev-dependencies] tempfile = "3.9.0" diff --git a/native/core/Cargo.toml b/native/core/Cargo.toml index d6e7d4b3233a..c3c13d9b55fb 100644 --- a/native/core/Cargo.toml +++ b/native/core/Cargo.toml @@ -17,6 +17,7 @@ templates = ["toml", "minijinja", "indexmap", "tokio-retry"] client = [] server = [] unstable-exhaustive-types = [] +ruma_unstable_exhaustive_types = [] [dependencies] tokio = { version = "1", features = ["rt", "macros"] } From 9cf9c84e387b2d5144825ad773d4c4f04c08655f Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Wed, 11 Dec 2024 15:50:18 +0000 Subject: [PATCH 2/3] Upgrade test server, improve config management, add jaeger support --- .../.config/acter-synapse-ci/Dockerfile | 3 +- .../.config/acter-synapse-ci/ci-start.sh | 89 +++---------------- .../acter-synapse-ci/homeserver.local.yml | 71 +++++++++++++++ util/test_server/docker-compose.yml | 6 ++ 4 files changed, 91 insertions(+), 78 deletions(-) create mode 100644 util/test_server/.config/acter-synapse-ci/homeserver.local.yml diff --git a/util/test_server/.config/acter-synapse-ci/Dockerfile b/util/test_server/.config/acter-synapse-ci/Dockerfile index b6a946e9e2b3..00da930b789d 100644 --- a/util/test_server/.config/acter-synapse-ci/Dockerfile +++ b/util/test_server/.config/acter-synapse-ci/Dockerfile @@ -1,6 +1,7 @@ -FROM ghcr.io/matrix-org/synapse:latest +FROM ghcr.io/element-hq/synapse:latest RUN apt-get update && apt-get install git -y RUN pip install git+https://github.com/acterglobal/synapse-super-invites/@ben-share-link-generator +ADD homeserver.local.yml /data/homeserver.local.yml ADD ci-start.sh /ci-start.sh RUN chmod 770 /ci-start.sh ENTRYPOINT /ci-start.sh \ No newline at end of file diff --git a/util/test_server/.config/acter-synapse-ci/ci-start.sh b/util/test_server/.config/acter-synapse-ci/ci-start.sh index bb4db3d73361..fee06efd55cd 100644 --- a/util/test_server/.config/acter-synapse-ci/ci-start.sh +++ b/util/test_server/.config/acter-synapse-ci/ci-start.sh @@ -1,81 +1,16 @@ #!/bin/bash set -e -export SYNAPSE_SERVER_NAME=localhost -export SYNAPSE_REPORT_STATS=no -echo " ====== Generating config ====== " -/start.py generate -echo " ====== Patching for local fixes ====== " -echo """ - -email: - smtp_host: mailhog - smtp_port: 1025 - force_tls: false - require_transport_security: false - enable_tls: false - notif_from: \"Your Friendly %(app)s homeserver \" - can_verify_email: true - -allow_guest_access: true -enable_registration_without_verification: true -enable_registration: true -suppress_key_server_warning: true - -rc_message: - per_second: 1000 - burst_count: 1000 - -rc_registration: - per_second: 1000 - burst_count: 1000 - -rc_login: - address: - per_second: 1000 - burst_count: 1000 - account: - per_second: 1000 - burst_count: 1000 - failed_attempts: - per_second: 1000 - burst_count: 1000 - -rc_admin_redaction: - per_second: 1000 - burst_count: 1000 - -rc_joins: - local: - per_second: 1000 - burst_count: 1000 - remote: - per_second: 1000 - burst_count: 1000 - -rc_3pid_validation: - per_second: 1000 - burst_count: 1000 - -rc_invites: - per_room: - per_second: 1000 - burst_count: 1000 - per_user: - per_second: 1000 - burst_count: 1000 - -modules: - - module: \"synapse_super_invites.SynapseSuperInvites\" - config: - sql_url: sqlite:///data/super_invites.db - generate_registration_token: true - share_link_generator: - url_prefix: "http://localhost:8099/" - target_path: "/data/share_links/" - -""" >> /data/homeserver.yaml - -echo " ====== Starting server with: ====== " -cat /data/homeserver.yaml +if [ ! -f /data/homeserver.yaml ]; then + export SYNAPSE_SERVER_NAME=localhost + export SYNAPSE_REPORT_STATS=no + echo " ====== Generating config ====== " + /start.py generate + echo " ====== Patching for local fixes ====== " + echo cat /data/homeserver.local.yaml >> /data/homeserver.yaml + echo " ====== Starting server with: ====== " + cat /data/homeserver.yaml +else + echo "Configuration already exists, ignoring" +fi; echo " ====== STARTING ====== " /start.py run \ No newline at end of file diff --git a/util/test_server/.config/acter-synapse-ci/homeserver.local.yml b/util/test_server/.config/acter-synapse-ci/homeserver.local.yml new file mode 100644 index 000000000000..ce314751f17f --- /dev/null +++ b/util/test_server/.config/acter-synapse-ci/homeserver.local.yml @@ -0,0 +1,71 @@ + +email: + smtp_host: mailhog + smtp_port: 1025 + force_tls: false + require_transport_security: false + enable_tls: false + notif_from: "Your Friendly %(app)s homeserver " + can_verify_email: true + +allow_guest_access: true +enable_registration_without_verification: true +enable_registration: true +suppress_key_server_warning: true + +opentracing: + enabled: true + homeserver_whitelist: + - ".*" + +rc_message: + per_second: 1000 + burst_count: 1000 + +rc_registration: + per_second: 1000 + burst_count: 1000 + +rc_login: + address: + per_second: 1000 + burst_count: 1000 + account: + per_second: 1000 + burst_count: 1000 + failed_attempts: + per_second: 1000 + burst_count: 1000 + +rc_admin_redaction: + per_second: 1000 + burst_count: 1000 + +rc_joins: + local: + per_second: 1000 + burst_count: 1000 + remote: + per_second: 1000 + burst_count: 1000 + +rc_3pid_validation: + per_second: 1000 + burst_count: 1000 + +rc_invites: + per_room: + per_second: 1000 + burst_count: 1000 + per_user: + per_second: 1000 + burst_count: 1000 + +modules: + - module: "synapse_super_invites.SynapseSuperInvites" + config: + sql_url: sqlite:///data/super_invites.db + generate_registration_token: true + share_link_generator: + url_prefix: "http://localhost:8099/" + target_path: "/data/share_links/" diff --git a/util/test_server/docker-compose.yml b/util/test_server/docker-compose.yml index 2c353c7a80af..3020a9e6cc80 100644 --- a/util/test_server/docker-compose.yml +++ b/util/test_server/docker-compose.yml @@ -53,3 +53,9 @@ services: - synapse entrypoint: "/bin/bash -c" command: '"register_new_matrix_user -u admin -p admin -a -c /data/homeserver.yaml http://synapse:8008"' + + jaeger: + image: jaegertracing/all-in-one:latest + ports: + - "6831:6831/udp" + - "16686:16686" From dd43b22c6d03cbdc65f55c127ee3ef6e0c309934 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Wed, 11 Dec 2024 15:50:35 +0000 Subject: [PATCH 3/3] Remove ruma --- Cargo.lock | 72 ++++++++---------------------------------------------- Cargo.toml | 6 ----- 2 files changed, 10 insertions(+), 68 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 163da6047f9b..d7b8fa1f6bcb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -54,7 +54,6 @@ dependencies = [ "pulldown-cmark 0.9.6", "reqwest", "ruma", - "ruma-common 0.14.1 (git+https://github.com/ruma/ruma?rev=c91499fc464adc865a7c99d0ce0b35982ad96711)", "sanitize-filename-reader-friendly", "scc", "serde", @@ -4448,7 +4447,7 @@ dependencies = [ "js_int", "js_option", "ruma-client-api", - "ruma-common 0.14.1 (git+https://github.com/acterglobal/ruma?branch=ben-msc2326)", + "ruma-common", "ruma-events", "ruma-federation-api", "ruma-html", @@ -4469,7 +4468,7 @@ dependencies = [ "js_int", "js_option", "maplit", - "ruma-common 0.14.1 (git+https://github.com/acterglobal/ruma?branch=ben-msc2326)", + "ruma-common", "ruma-events", "serde", "serde_html_form", @@ -4497,8 +4496,8 @@ dependencies = [ "percent-encoding", "rand", "regex", - "ruma-identifiers-validation 0.10.0 (git+https://github.com/acterglobal/ruma?branch=ben-msc2326)", - "ruma-macros 0.14.0 (git+https://github.com/acterglobal/ruma?branch=ben-msc2326)", + "ruma-identifiers-validation", + "ruma-macros", "serde", "serde_html_form", "serde_json", @@ -4511,32 +4510,6 @@ dependencies = [ "wildmatch", ] -[[package]] -name = "ruma-common" -version = "0.14.1" -source = "git+https://github.com/ruma/ruma?rev=c91499fc464adc865a7c99d0ce0b35982ad96711#c91499fc464adc865a7c99d0ce0b35982ad96711" -dependencies = [ - "as_variant", - "base64 0.22.1", - "bytes", - "form_urlencoded", - "indexmap 2.7.0", - "js_int", - "percent-encoding", - "regex", - "ruma-identifiers-validation 0.10.0 (git+https://github.com/ruma/ruma?rev=c91499fc464adc865a7c99d0ce0b35982ad96711)", - "ruma-macros 0.14.0 (git+https://github.com/ruma/ruma?rev=c91499fc464adc865a7c99d0ce0b35982ad96711)", - "serde", - "serde_html_form", - "serde_json", - "thiserror 2.0.6", - "time", - "tracing", - "url", - "web-time", - "wildmatch", -] - [[package]] name = "ruma-events" version = "0.29.1" @@ -4549,10 +4522,10 @@ dependencies = [ "percent-encoding", "pulldown-cmark 0.12.2", "regex", - "ruma-common 0.14.1 (git+https://github.com/acterglobal/ruma?branch=ben-msc2326)", + "ruma-common", "ruma-html", - "ruma-identifiers-validation 0.10.0 (git+https://github.com/acterglobal/ruma?branch=ben-msc2326)", - "ruma-macros 0.14.0 (git+https://github.com/acterglobal/ruma?branch=ben-msc2326)", + "ruma-identifiers-validation", + "ruma-macros", "serde", "serde_json", "thiserror 2.0.6", @@ -4570,7 +4543,7 @@ dependencies = [ "http 1.2.0", "js_int", "mime", - "ruma-common 0.14.1 (git+https://github.com/acterglobal/ruma?branch=ben-msc2326)", + "ruma-common", "ruma-events", "serde", "serde_json", @@ -4597,15 +4570,6 @@ dependencies = [ "thiserror 2.0.6", ] -[[package]] -name = "ruma-identifiers-validation" -version = "0.10.0" -source = "git+https://github.com/ruma/ruma?rev=c91499fc464adc865a7c99d0ce0b35982ad96711#c91499fc464adc865a7c99d0ce0b35982ad96711" -dependencies = [ - "js_int", - "thiserror 2.0.6", -] - [[package]] name = "ruma-macros" version = "0.14.0" @@ -4615,23 +4579,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "ruma-identifiers-validation 0.10.0 (git+https://github.com/acterglobal/ruma?branch=ben-msc2326)", - "serde", - "syn 2.0.90", - "toml 0.8.19", -] - -[[package]] -name = "ruma-macros" -version = "0.14.0" -source = "git+https://github.com/ruma/ruma?rev=c91499fc464adc865a7c99d0ce0b35982ad96711#c91499fc464adc865a7c99d0ce0b35982ad96711" -dependencies = [ - "cfg-if", - "once_cell", - "proc-macro-crate", - "proc-macro2", - "quote", - "ruma-identifiers-validation 0.10.0 (git+https://github.com/ruma/ruma?rev=c91499fc464adc865a7c99d0ce0b35982ad96711)", + "ruma-identifiers-validation", "serde", "syn 2.0.90", "toml 0.8.19", @@ -4643,7 +4591,7 @@ version = "0.10.0" source = "git+https://github.com/acterglobal/ruma?branch=ben-msc2326#5f85a7939b17167132925142ded895b397104ca0" dependencies = [ "js_int", - "ruma-common 0.14.1 (git+https://github.com/acterglobal/ruma?branch=ben-msc2326)", + "ruma-common", "ruma-events", "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 09cccc7a39a2..47fefa51ad1c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,12 +51,6 @@ git = "https://github.com/ruma/ruma" rev = "c91499fc464adc865a7c99d0ce0b35982ad96711" features = ["unstable-msc2326"] -# - see comment above -[workspace.dependencies.ruma-common] -# version = "0.14.1" -git = "https://github.com/ruma/ruma" -rev = "c91499fc464adc865a7c99d0ce0b35982ad96711" - [workspace.dependencies.url] version = "2.5.0" features = ["serde"]