### Install Dendrite binary with go install Source: https://github.com/element-hq/dendrite/blob/main/docs/installation/manual/1_build.md Installs the Dendrite binary into $GOPATH/bin using the go install command. ```sh go install ./cmd/dendrite ``` -------------------------------- ### Start Docker Compose deployment Source: https://github.com/element-hq/dendrite/blob/main/build/docker/README.md Starts the Dendrite deployment defined in docker-compose.yml. ```bash docker-compose -f docker-compose.yml up ``` -------------------------------- ### Start Dendrite with config file Source: https://github.com/element-hq/dendrite/blob/main/docs/installation/manual/5_starting_dendrite.md Starts the Dendrite server with the specified configuration file. By default, Dendrite listens on HTTP port 8008. ```bash ./dendrite -config /path/to/dendrite.yaml ``` -------------------------------- ### Start Dendrite with custom bind addresses Source: https://github.com/element-hq/dendrite/blob/main/docs/installation/manual/5_starting_dendrite.md Starts Dendrite with custom HTTP and HTTPS bind addresses using the -http-bind-address and -https-bind-address command line arguments. ```bash ./dendrite -config /path/to/dendrite.yaml \ -http-bind-address 1.2.3.4:12345 \ -https-bind-address 1.2.3.4:54321 ``` -------------------------------- ### Run the Pinecone demo homeserver Source: https://github.com/element-hq/dendrite/blob/main/cmd/dendrite-demo-pinecone/README.md Starts the Dendrite Pinecone demo homeserver from the repository root. ```bash go run ./cmd/dendrite-demo-pinecone ``` -------------------------------- ### Install and run local rendezvous relay Source: https://github.com/element-hq/dendrite/blob/main/docs/other/p2p.md Installs the libp2p-websocket-star-rendezvous package globally and starts a local relay server on port 9090. ```bash npm install --global libp2p-websocket-star-rendezvous rendezvous --port=9090 --host=127.0.0.1 ``` -------------------------------- ### Run the Yggdrasil demo Source: https://github.com/element-hq/dendrite/blob/main/cmd/dendrite-demo-yggdrasil/README.md Start the Dendrite Yggdrasil demo homeserver from the root of the repository. Requires Go 1.21 or later. ```bash go run ./cmd/dendrite-demo-yggdrasil ``` -------------------------------- ### Create dendrite database with postgres Source: https://github.com/element-hq/dendrite/blob/main/helm/dendrite/README.md SQL command to create the 'dendrite' database. Required before starting Dendrite if not using the PostgreSQL dependency. ```postgres create database dendrite ``` -------------------------------- ### Launch relay server for store & forward test Source: https://github.com/element-hq/dendrite/blob/main/cmd/dendrite-demo-pinecone/README.md Starts the relay node with a data directory and listen address. ```bash go run cmd/dendrite-demo-pinecone/main.go -dir relay/ -listen "[::]:49000" ``` -------------------------------- ### Clone go-http-js-libp2p repository Source: https://github.com/element-hq/dendrite/blob/main/docs/other/p2p.md Clones the go-http-js-libp2p repository needed for Riot-web setup. ```bash git clone git@github.com:matrix-org/go-http-js-libp2p.git ``` -------------------------------- ### Examine CPU profile with go tool pprof Source: https://github.com/element-hq/dendrite/blob/main/docs/development/PROFILING.md Use go tool pprof with the -http parameter to start a web server providing a view of the captured CPU profile. Visit http://localhost:23456 in a browser; the 'View' menu offers a 'Flame Graph' option. ```bash go tool pprof -http=localhost:23456 http://localhost:65432/debug/pprof/profile?seconds=30 ``` -------------------------------- ### Install with bundled PostgreSQL Source: https://github.com/element-hq/dendrite/blob/main/docs/installation/helm/1_helm.md Enables the bundled PostgreSQL dependency and sets the server_name; the database connection string is set automatically. ```yaml postgresql: enabled: true # this installs Postgres primary: persistence: size: 1Gi # defines the size for $PGDATA dendrite_config: global: server_name: "localhost" ``` -------------------------------- ### Launch Node 1 for store & forward test Source: https://github.com/element-hq/dendrite/blob/main/cmd/dendrite-demo-pinecone/README.md Starts the first user node, connecting to the relay peer and listening on port 8007. ```bash go run cmd/dendrite-demo-pinecone/main.go -dir node-1/ -peer "[::]:49000" -port 8007 ``` -------------------------------- ### Enable pprof with PPROFLISTEN Source: https://github.com/element-hq/dendrite/blob/main/docs/development/PROFILING.md Start Dendrite with the PPROFLISTEN environment variable to enable the embedded pprof profiler. The variable specifies the address and port to listen on. If successful, a log line at startup will show that pprof is listening. ```bash PPROFLISTEN=localhost:65432 ./bin/dendrite ... ``` ```text WARN[2020-12-03T13:32:33.669405000Z] [/Users/neilalexander/Desktop/dendrite/internal/log.go:87] SetupPprof Starting pprof on localhost:65432 ``` -------------------------------- ### Launch Node 2 for store & forward test Source: https://github.com/element-hq/dendrite/blob/main/cmd/dendrite-demo-pinecone/README.md Starts the second user node, connecting to the relay peer and listening on port 8009. ```bash go run cmd/dendrite-demo-pinecone/main.go -dir node-2/ -peer "[::]:49000" -port 8009 ``` -------------------------------- ### Configure server_name in values.yaml Source: https://github.com/element-hq/dendrite/blob/main/docs/installation/helm/1_helm.md Minimal values.yaml configuration required to install the chart; the server_name must be set or the chart will complain. ```yaml dendrite_config: global: server_name: "localhost" ``` -------------------------------- ### Examine memory profile with go tool pprof Source: https://github.com/element-hq/dendrite/blob/main/docs/development/PROFILING.md Use go tool pprof with the -http parameter to start a web server providing a view of the captured memory profile. The 'Sample' menu lets you select between four memory profiles: inuse_space, inuse_objects, alloc_space, and alloc_objects. The 'View' menu offers a 'Flame Graph' option. ```bash go tool pprof -http=localhost:23456 http://localhost:65432/debug/pprof/heap ``` -------------------------------- ### Run a single SyTest file with Docker Source: https://github.com/element-hq/dendrite/blob/main/docs/development/sytest.md Runs a single SyTest test file (e.g., tests/50federation/40devicelists.pl) using the Docker image. This example mounts local SyTest, dendrite, logs, and GOPATH directories, and enables POSTGRES and HTTP tracing. ```sh docker run --rm --name sytest -v "/Users/kegan/github/sytest:/sytest" -v "/Users/kegan/github/dendrite:/src" -v "/Users/kegan/logs:/logs" -v "/Users/kegan/go/:/gopath" -e "POSTGRES=1" -e "DENDRITE_TRACE_HTTP=1" matrixdotorg/sytest-dendrite:latest tests/50federation/40devicelists.pl ``` -------------------------------- ### Download CPU profile with curl Source: https://github.com/element-hq/dendrite/blob/main/docs/development/PROFILING.md Download the CPU profile using curl when Go tools are not installed. This blocks for the specified seconds and produces a 'profile' file to send onward. ```bash curl -O http://localhost:65432/debug/pprof/profile?seconds=30 ``` -------------------------------- ### Download memory profile with curl Source: https://github.com/element-hq/dendrite/blob/main/docs/development/PROFILING.md Download the memory profile using curl when Go tools are not installed. This almost instantly produces a 'heap' file to send onward. ```bash curl -O http://localhost:65432/debug/pprof/heap ``` -------------------------------- ### Override the connection URL with -url flag Source: https://github.com/element-hq/dendrite/blob/main/docs/administration/1_createusers.md By default create-account uses http://localhost:8008. Use the -url flag to connect to a different address, for example https://localhost:8448. ```bash ./bin/create-account -config /path/to/dendrite.yaml -username USERNAME -url https://localhost:8448 ``` -------------------------------- ### Get coverage for Complement runs alone Source: https://github.com/element-hq/dendrite/blob/main/docs/development/coverage.md Generates coverage for Complement runs alone by finding all covmeta files and passing them to the go tool covdata func command. ```bash go tool covdata func -i="$(find /tmp/Complement -name 'covmeta*' -type f -exec dirname {} \; | uniq | paste -s -d ',' -)" ``` -------------------------------- ### GET /_matrix/client/v3/admin/whois/{userId} Source: https://github.com/element-hq/dendrite/blob/main/docs/administration/4_adminapi.md Gets information about a particular user. ```APIDOC ## [GET] /_matrix/client/v3/admin/whois/{userId} ### Description Gets information about a particular user from the Matrix Spec. ### Method GET ### Endpoint /_matrix/client/v3/admin/whois/{userId} ### Parameters #### Path Parameters - **userId** (string) - Required - The full user ID (e.g., @alice:domain.com). ### Response No response details specified. ``` -------------------------------- ### Build and run a non-federating Dendrite test server Source: https://github.com/element-hq/dendrite/blob/main/README.md Use these commands to clone, build, generate keys, configure, run, and create a user for a local Dendrite test deployment. Requires Go 1.21 or later and a copy of dendrite-sample.yaml. The server listens on http://localhost:8008 or https://localhost:8448. ```bash git clone https://github.com/element-hq/dendrite cd dendrite go build -o bin/ ./cmd/... # Generate a Matrix signing key for federation (required) ./bin/generate-keys --private-key matrix_key.pem # Generate a self-signed certificate (optional, but a valid TLS certificate is normally # needed for Matrix federation/clients to work properly!) ./bin/generate-keys --tls-cert server.crt --tls-key server.key # Copy and modify the config file - you'll need to set a server name and paths to the keys # at the very least, along with setting up the database connection strings. cp dendrite-sample.yaml dendrite.yaml # Build and run the server: ./bin/dendrite --tls-cert server.crt --tls-key server.key --config dendrite.yaml # Create an user account (add -admin for an admin user). # Specify the localpart only, e.g. 'alice' for '@alice:domain.com' ./bin/create-account --config dendrite.yaml --username alice ``` -------------------------------- ### GET /_synapse/admin/v1/register Source: https://github.com/element-hq/dendrite/blob/main/docs/administration/4_adminapi.md Endpoint for shared secret registration. ```APIDOC ## [GET] /_synapse/admin/v1/register ### Description Shared secret registration. See the user creation page for guidance on configuring and using this endpoint. ### Method GET ### Endpoint /_synapse/admin/v1/register ### Parameters No parameters specified. ### Response No response details specified. ``` -------------------------------- ### GET /_dendrite/admin/fulltext/reindex Source: https://github.com/element-hq/dendrite/blob/main/docs/administration/4_adminapi.md Triggers a full reindex of searchable events. ```APIDOC ## [GET] /_dendrite/admin/fulltext/reindex ### Description Instructs Dendrite to reindex all searchable events (m.room.message, m.room.topic, m.room.name). Returns an empty JSON body immediately. Indexing is done in the background, with progress logged every 1000 events. ### Method GET ### Endpoint /_dendrite/admin/fulltext/reindex ### Response #### Success Response (200) An empty JSON body. ``` -------------------------------- ### GET /_dendrite/admin/emptyRooms Source: https://github.com/element-hq/dendrite/blob/main/docs/administration/4_adminapi.md Lists all rooms with zero locally joined members. ```APIDOC ## [GET] /_dendrite/admin/emptyRooms ### Description Returns a list of all rooms which have zero (locally) joined members. ### Method GET ### Endpoint /_dendrite/admin/emptyRooms ### Response #### Success Response (200) JSON object with field `empty_rooms` which is an array of room IDs. #### Response Example { "empty_rooms": [ "!roomid1:server_name", "!roomid2:server_name" ] } ``` -------------------------------- ### Create a normal account with create-account Source: https://github.com/element-hq/dendrite/blob/main/docs/administration/1_createusers.md Run the create-account tool to create a normal user account. Requires a running Dendrite instance and shared secret registration enabled. You will be prompted to enter a new password. ```bash ./bin/create-account -config /path/to/dendrite.yaml -username USERNAME ``` -------------------------------- ### Create an admin account with create-account Source: https://github.com/element-hq/dendrite/blob/main/docs/administration/1_createusers.md Add the -admin flag to create an admin account instead of a normal one. ```bash ./bin/create-account -config /path/to/dendrite.yaml -username USERNAME -admin ``` -------------------------------- ### Build Dendrite binary to custom path Source: https://github.com/element-hq/dendrite/blob/main/docs/installation/manual/1_build.md Builds the Dendrite binary and writes it to a custom path, here /usr/local/bin/, using go build. ```sh go build -o /usr/local/bin/ ./cmd/dendrite ``` -------------------------------- ### Empty rooms response Source: https://github.com/element-hq/dendrite/blob/main/docs/administration/4_adminapi.md Response format for GET /_dendrite/admin/emptyRooms, listing rooms with zero locally joined members. ```json { "empty_rooms": [ "!roomid1:server_name", "!roomid2:server_name" ] } ``` -------------------------------- ### Create posttest.sh to copy coverage files Source: https://github.com/element-hq/dendrite/blob/main/docs/development/coverage.md Creates a post-test script that copies the covdatafiles from each container to a directory like /tmp/Complement/logs/TestLogin/94f9c428de95779d2b62a3ccd8eab9d5ddcf65cc259a40ece06bdc61687ffed3/. $1 is the containerID and $2 is the test name. Make the file executable with chmod +x posttest.sh. ```bash #!/bin/bash mkdir -p /tmp/Complement/logs/$2/$1/ docker cp $1:/tmp/covdatafiles/. /tmp/Complement/logs/$2/$1/ ``` -------------------------------- ### Generate a Matrix signing private key with generate-keys Source: https://github.com/element-hq/dendrite/blob/main/docs/installation/manual/3_signingkey.md Run the generate-keys utility to create a new signing key file. The output file matrix_key.pem is your new signing key and must be kept private and backed up. ```bash ./bin/generate-keys --private-key matrix_key.pem ``` -------------------------------- ### Increase soft file descriptor limit Source: https://github.com/element-hq/dendrite/blob/main/docs/administration/5_optimisation.md Increases the soft file descriptor limit to 65535 before starting Dendrite. After this, the startup warning should no longer appear. ```bash ulimit -Sn 65535 ``` -------------------------------- ### GET /_matrix/federation/v1/relay_txn/{userID} Source: https://github.com/element-hq/dendrite/blob/main/relayapi/ARCHITECTURE.md Retrieves events from a relay server that are destined for the requesting server. The request includes the ID of the previous transaction received to paginate through the queue. ```APIDOC ## GET /_matrix/federation/v1/relay_txn/{userID} ### Description Retrieves events from a relay server that are destined for the requesting server. The request includes the ID of the previous transaction received to paginate through the queue. ### Method GET ### Endpoint /_matrix/federation/v1/relay_txn/{userID} ### Parameters #### Path Parameters - **userID** (string) - Required - The user ID that events are being requested for. #### Request Body - **entry_id** (int64) - Required - The id of the previous transaction received from the relay. Provided in the previous response to this endpoint. ### Request Example { "entry_id": 0 } ### Response #### Success Response (200) Successfully stored transaction for forwarding. #### Response Body - **transaction** (Transaction) - Required - A matrix transaction. - **entry_id** (int64) - An ID associated with this transaction. - **entries_queued** (bool) - Required - Whether or not there are more events stored for this user. #### Response Example { "transaction": {}, "entry_id": 0, "entries_queued": false } #### Error Responses - **400** - Invalid userID. - **400** - Invalid request body. - **400** - Invalid previous entry. Must be >= 0 - **500** - Server failed processing transaction. ``` -------------------------------- ### Create dendrite database with createdb Source: https://github.com/element-hq/dendrite/blob/main/helm/dendrite/README.md Bash command to create the 'dendrite' database using the createdb utility, owned by user 'dendrite' with UTF-8 encoding. Alternative to the SQL command. ```bash sudo -u postgres createdb -O dendrite -E UTF-8 dendrite ``` -------------------------------- ### Run Go unit tests with coverage Source: https://github.com/element-hq/dendrite/blob/main/docs/development/coverage.md Runs Go unit tests with coverage enabled, generating an `integrationcover.log` file. The second command prints a function-level coverage report from that file. ```bash go test -covermode=atomic -coverpkg=./... -coverprofile=integrationcover.log $(go list ./... | grep -v '/cmd/') go tool cover -func=integrationcover.log ``` -------------------------------- ### Connect to static Pinecone peer Source: https://github.com/element-hq/dendrite/blob/main/cmd/dendrite-demo-pinecone/README.md Runs the demo with a static peer using the -peer flag. ```bash go run ./cmd/dendrite-demo-pinecone -peer wss://pinecone.matrix.org/public ``` -------------------------------- ### Generate a configuration file Source: https://github.com/element-hq/dendrite/blob/main/docs/installation/docker/1_docker.md Generates config/dendrite.yaml with the correct paths. Change server and db values to match your domain and docker-compose settings. Includes a Windows equivalent command. ```bash mkdir -p ./config docker run --rm --entrypoint="/bin/sh" \ -v $(pwd)/config:/mnt \ ghcr.io/element-hq/dendrite-monolith:latest \ -c "/usr/bin/generate-config \ -dir /var/dendrite/ \ -db postgres://dendrite:itsasecret@postgres/dendrite?sslmode=disable \ -server YourDomainHere > /mnt/dendrite.yaml" # Windows equivalent: docker run --rm --entrypoint="/bin/sh" -v %cd%/config:/mnt ghcr.io/element-hq/dendrite-monolith:latest -c "/usr/bin/generate-config -dir /var/dendrite/ -db postgres://dendrite:itsasecret@postgres/dendrite?sslmode=disable -server YourDomainHere > /mnt/dendrite.yaml" ``` -------------------------------- ### Run golangci-lint Source: https://github.com/element-hq/dendrite/blob/main/docs/development/CONTRIBUTING.md Use this command to lint the Dendrite codebase with golangci-lint. Run it before submitting a contribution to ensure code style compliance. ```bash golangci-lint run ``` -------------------------------- ### Build Complement-compatible Docker image Source: https://github.com/element-hq/dendrite/blob/main/docs/development/coverage.md Builds a Docker image compatible with Complement from within the Dendrite repository. ```bash docker build -t complement-dendrite -f build/scripts/Complement.Dockerfile . ``` -------------------------------- ### Build Docker image Source: https://github.com/element-hq/dendrite/blob/main/build/docker/README.md Builds the Dendrite monolith Docker image from the root of the repository. ```bash docker build -t ghcr.io/element-hq/dendrite-monolith:latest . ``` -------------------------------- ### Run Sytest with coverage (Postgres and SQLite) Source: https://github.com/element-hq/dendrite/blob/main/docs/development/coverage.md Runs Sytest with coverage enabled. The first command uses Postgres (POSTGRES=1); the second uses SQLite for more accurate coverage. Both generate a `covdatafiles` folder in each server's directory (e.g., `server-0/covdatafiles`). ```bash docker run --rm --name sytest -v "/Users/kegan/github/sytest:/sytest" \ -v "/Users/kegan/github/dendrite:/src" -v "$(pwd)/sytest_logs:/logs" \ -v "/Users/kegan/go/:/gopath" -e "POSTGRES=1" \ -e "COVER=1" \ matrixdotorg/sytest-dendrite:latest ``` ```bash # to get a more accurate coverage you may also need to run Sytest using SQLite as the database: docker run --rm --name sytest -v "/Users/kegan/github/sytest:/sytest" \ -v "/Users/kegan/github/dendrite:/src" -v "$(pwd)/sytest_logs:/logs" \ -v "/Users/kegan/go/:/gopath" \ -e "COVER=1" \ matrixdotorg/sytest-dendrite:latest ``` -------------------------------- ### Build Dendrite WASM and copy to riot-web Source: https://github.com/element-hq/dendrite/blob/main/docs/other/p2p.md Builds the WASM binary for Dendrite and copies it to the riot-web source directory. ```bash ./build-dendritejs.sh cp bin/main.wasm ../riot-web/src/vector/dendrite.wasm ``` -------------------------------- ### Generate a private key Source: https://github.com/element-hq/dendrite/blob/main/docs/installation/docker/1_docker.md Creates a private key used to sign events. Run once and store in ./config. Includes a Windows equivalent command. ```bash mkdir -p ./config docker run --rm --entrypoint="/usr/bin/generate-keys" \ -v $(pwd)/config:/mnt \ ghcr.io/element-hq/dendrite-monolith:latest \ -private-key /mnt/matrix_key.pem # Windows equivalent: docker run --rm --entrypoint="/usr/bin/generate-keys" -v %cd%/config:/mnt ghcr.io/element-hq/dendrite-monolith:latest -private-key /mnt/matrix_key.pem ``` -------------------------------- ### Create symlink for go-http-js-libp2p Source: https://github.com/element-hq/dendrite/blob/main/docs/other/p2p.md Creates a symlink in node_modules pointing to the go-http-js-libp2p repository. ```bash cd node_modules ln -s ../../go-http-js-libp2p ``` -------------------------------- ### Create accounts in Docker with create-account Source: https://github.com/element-hq/dendrite/blob/main/docs/administration/1_createusers.md Run create-account inside a Docker container. Replace CONTAINERNAME with the container name from docker ps. The first command creates a normal account, the second creates an admin account. ```bash docker exec -it CONTAINERNAME /usr/bin/create-account -config /path/to/dendrite.yaml -username USERNAME ``` ```bash docker exec -it CONTAINERNAME /usr/bin/create-account -config /path/to/dendrite.yaml -username USERNAME -admin ``` -------------------------------- ### Configure reCAPTCHA and enable registration in client_api Source: https://github.com/element-hq/dendrite/blob/main/docs/administration/2_registration.md Use this YAML configuration in the `client_api` section to enable registration and set up reCAPTCHA verification. Replace the public and private keys with your own from the reCAPTCHA Admin Panel. The `captcha_bypass_secret` can be left empty, and the `recaptcha_siteverify_api` points to Google's siteverify endpoint. ```yaml client_api: # ... registration_disabled: false recaptcha_public_key: "PUBLIC_KEY_HERE" recaptcha_private_key: "PRIVATE_KEY_HERE" enable_registration_captcha: true captcha_bypass_secret: "" recaptcha_siteverify_api: "https://www.google.com/recaptcha/api/siteverify" ``` -------------------------------- ### Run SyTest using Docker image Source: https://github.com/element-hq/dendrite/blob/main/docs/development/sytest.md Pulls the latest SyTest Docker image and runs the test suite. Replace the paths with your actual dendrite source and log output directories. The test results TAP file and homeserver logging output will be written to the log output directory. ```sh docker pull matrixdotorg/sytest-dendrite docker run --rm -v /path/to/dendrite/:/src/ -v /path/to/log/output/:/logs/ matrixdotorg/sytest-dendrite ``` -------------------------------- ### Well-known delegation server file Source: https://github.com/element-hq/dendrite/blob/main/docs/installation/2_domainname.md Served at https://example.com/.well-known/matrix/server. Points to the Dendrite server at matrix.example.com on port 8448. ```json { "m.server": "matrix.example.com:8448" } ``` -------------------------------- ### Profile CPU usage with /debug/pprof/profile Source: https://github.com/element-hq/dendrite/blob/main/docs/development/PROFILING.md Call the profile endpoint to capture CPU usage. The profile runs for the specified number of seconds and then produces a result. ```text http://localhost:65432/debug/pprof/profile?seconds=30 ``` -------------------------------- ### Set user as admin in userapi_accounts Source: https://github.com/element-hq/dendrite/blob/main/docs/administration/4_adminapi.md SQL to promote an existing user to admin by setting account_type to 3. Replace $localpart with the username only (e.g., alice). ```sql UPDATE userapi_accounts SET account_type = 3 WHERE localpart = '$localpart'; ``` -------------------------------- ### Generate keys with Docker Source: https://github.com/element-hq/dendrite/blob/main/build/docker/README.md Runs the generate-keys command inside a Docker container to create the matrix_key.pem, server.crt, and server.key files in the current directory. ```bash docker run --rm --entrypoint="" \ -v $(pwd):/mnt \ ghcr.io/element-hq/dendrite-monolith:latest \ /usr/bin/generate-keys \ -private-key /mnt/matrix_key.pem \ -tls-cert /mnt/server.crt \ -tls-key /mnt/server.key ``` -------------------------------- ### Build Dendrite binaries Source: https://github.com/element-hq/dendrite/blob/main/docs/development/sytest.md Builds the Dendrite binaries to verify there are no build problems before running SyTest tests. ```sh go build -o bin/ ./cmd/... ``` -------------------------------- ### Caddy reverse proxy for /_matrix paths Source: https://github.com/element-hq/dendrite/blob/main/docs/installation/2_domainname.md Caddy configuration line to reverse proxy all /_matrix paths to a local Dendrite server on port 8008. This is required for federation and TLS automation. ```caddy reverse_proxy /_matrix/* localhost:8008 ``` -------------------------------- ### Run unit tests with SQLite only Source: https://github.com/element-hq/dendrite/blob/main/docs/development/CONTRIBUTING.md Executes the Go unit test suite with the race detector, skipping NODB (Postgres) tests. This only runs SQLite database tests. ```bash DENDRITE_TEST_SKIP_NODB=1 go test --race ./... ``` -------------------------------- ### Configure server_name in global section Source: https://github.com/element-hq/dendrite/blob/main/docs/installation/manual/4_configuration.md Sets the Matrix homeserver domain name in the global section. Must match the delegated domain name configured for domain name delegation. ```yaml global: # ... server_name: example.com ``` -------------------------------- ### Profile memory usage with /debug/pprof/heap Source: https://github.com/element-hq/dendrite/blob/main/docs/development/PROFILING.md Call the heap endpoint to examine memory usage. The profile returns almost instantly. ```text http://localhost:65432/debug/pprof/heap ``` -------------------------------- ### Configure full-text search in sync_api Source: https://github.com/element-hq/dendrite/blob/main/docs/installation/manual/4_configuration.md Enables full-text search using Bleve. Adjust the language to match the server's primary language for better results. ```yaml sync_api: # ... search: enabled: false index_path: "./searchindex" language: "en" ``` -------------------------------- ### Copy coverage files to Dendrite repository Source: https://github.com/element-hq/dendrite/blob/main/docs/development/coverage.md Copies the resulting covdatafiles from /tmp/Complement/logs to your Dendrite repository for the next step. ```bash cp -pr /tmp/Complement/logs PathToYourDendriteRepository ``` -------------------------------- ### Configure existing PostgreSQL connection Source: https://github.com/element-hq/dendrite/blob/main/docs/installation/helm/1_helm.md Configures an existing PostgreSQL database connection in values.yaml, including connection string and pool settings. ```yaml dendrite_config: global: database: connection_string: "postgresql://PostgresUser:PostgresPassword@PostgresHostName/DendriteDatabaseName" max_open_conns: 90 max_idle_conns: 5 conn_max_lifetime: -1 ``` -------------------------------- ### Dendrite file descriptor limit warning Source: https://github.com/element-hq/dendrite/blob/main/docs/administration/5_optimisation.md Dendrite logs this warning immediately after startup if the file descriptor limit is too low. The recommended limit is 65535. ```text level=warning msg="IMPORTANT: Process file descriptor limit is currently 1024, it is recommended to raise the limit for Dendrite to at least 65535 to avoid issues" ``` -------------------------------- ### POST /_synapse/admin/v1/send_server_notice Source: https://github.com/element-hq/dendrite/blob/main/docs/administration/4_adminapi.md Sends a server notice to a specific user. ```APIDOC ## [POST] /_synapse/admin/v1/send_server_notice ### Description Sends a server notice to a specific user. See the Matrix Spec for additional details on server notice behavior. ### Method POST ### Endpoint /_synapse/admin/v1/send_server_notice ### Parameters #### Request Body - **user_id** (string) - Required - The full user ID of the recipient. - **content** (object) - Required - The content of the message, with `msgtype` and `body` fields. ### Request Example { "user_id": "@target_user:server_name", "content": { "msgtype": "m.text", "body": "This is my message" } } ### Response #### Success Response (200) JSON object containing the `event_id` of the sent event. #### Response Example { "event_id": "" } ``` -------------------------------- ### Clone Complement repository Source: https://github.com/element-hq/dendrite/blob/main/docs/development/coverage.md Clones the Complement repository and changes into its directory. ```bash git clone https://github.com/matrix-org/complement.git cd complement ``` -------------------------------- ### Combine coverage data with go tool covdata func Source: https://github.com/element-hq/dendrite/blob/main/docs/development/coverage.md Combines coverage data from all covdatafiles in the repository to produce overall function coverage, excluding unit tests. The command finds all directories containing covmeta* files, deduplicates them, and passes them as a comma-separated list to the -i flag of go tool covdata func. ```bash go tool covdata func -i="$(find -name 'covmeta*' -type f -exec dirname {} \; | uniq | paste -s -d ',' -)" ``` -------------------------------- ### Enable debug logging in dendrite.yaml Source: https://github.com/element-hq/dendrite/blob/main/docs/administration/6_troubleshooting.md Add this to the dendrite.yaml configuration file and restart Dendrite to increase the log level to the more verbose debug level. Look for lines containing level=error or level=warning. ```yaml logging: - type: std level: debug ``` -------------------------------- ### Run Complement tests with coverage Source: https://github.com/element-hq/dendrite/blob/main/docs/development/coverage.md Executes Complement tests with coverage enabled, using the previously built Docker image and post-test script. The COMPLEMENT_DENDRITE_COVER=1 environment variable enables coverage collection. ```bash COMPLEMENT_BASE_IMAGE=complement-dendrite \ COMPLEMENT_SHARE_ENV_PREFIX=COMPLEMENT_DENDRITE_ \ COMPLEMENT_DENDRITE_COVER=1 \ COMPLEMENT_POST_TEST_SCRIPT=$(pwd)/posttest.sh \ go test -tags dendrite_blacklist ./tests/... -count=1 -v -timeout=30m -failfast=false ``` -------------------------------- ### POST /_dendrite/admin/evacuateRoom/{roomID} Source: https://github.com/element-hq/dendrite/blob/main/docs/administration/4_adminapi.md Parts all local users from a given room. ```APIDOC ## [POST] /_dendrite/admin/evacuateRoom/{roomID} ### Description This endpoint instructs Dendrite to part all local users from the given room. It may take some time to complete. A JSON body is returned containing the user IDs of all affected users. ### Method POST ### Endpoint /_dendrite/admin/evacuateRoom/{roomID} ### Parameters #### Path Parameters - **roomID** (string) - Required - The room ID to evacuate. If the room has an alias set, the room's internal ID must be used. ### Response #### Success Response (200) A JSON body containing the user IDs of all affected users. ``` -------------------------------- ### Add Dendrite Helm repository Source: https://github.com/element-hq/dendrite/blob/main/docs/installation/helm/1_helm.md Adds the Dendrite Helm repository and updates the local Helm chart repository cache. ```bash helm repo add dendrite https://matrix-org.github.io/dendrite/ helm repo update ``` -------------------------------- ### POST /_dendrite/admin/evacuateUser/{userID} Source: https://github.com/element-hq/dendrite/blob/main/docs/administration/4_adminapi.md Parts a given local user from all rooms they are joined to. ```APIDOC ## [POST] /_dendrite/admin/evacuateUser/{userID} ### Description This endpoint instructs Dendrite to part the given local user from all rooms they are currently joined. A JSON body is returned containing the room IDs of all affected rooms. ### Method POST ### Endpoint /_dendrite/admin/evacuateUser/{userID} ### Parameters #### Path Parameters - **userID** (string) - Required - The full user ID (e.g., @alice:domain.com). ### Response #### Success Response (200) A JSON body containing the room IDs of all affected rooms. ``` -------------------------------- ### Set private_key path for server signing keys Source: https://github.com/element-hq/dendrite/blob/main/docs/installation/manual/4_configuration.md Specifies the path to the server signing key file in the global section. Required for signing keys. ```yaml global: # ... private_key: /path/to/matrix_key.pem ``` -------------------------------- ### Synapse signing key format Source: https://github.com/element-hq/dendrite/blob/main/docs/installation/manual/3_signingkey.md Shows the format used by Synapse for storing signing keys. This format is used when converting to Dendrite's PEM format. ```text ed25519 ``` -------------------------------- ### POST /_dendrite/admin/refreshDevices/{userID} Source: https://github.com/element-hq/dendrite/blob/main/docs/administration/4_adminapi.md Refreshes local device/key data for a remote user by querying the remote server. ```APIDOC ## [POST] /_dendrite/admin/refreshDevices/{userID} ### Description Instructs Dendrite to immediately query /devices/{userID} on a federated server. Returns an empty JSON body on success, updating all locally stored user devices/keys. Can be used to resolve E2EE issues where the remote user can't decrypt messages. ### Method POST ### Endpoint /_dendrite/admin/refreshDevices/{userID} ### Parameters #### Path Parameters - **userID** (string) - Required - The full user ID of the remote user. ### Response #### Success Response (200) An empty JSON body. ``` -------------------------------- ### Run WASM-specific tests Source: https://github.com/element-hq/dendrite/blob/main/docs/other/p2p.md Runs the WASM-specific tests to verify the Dendrite side works as Wasm. ```bash ./test-dendritejs.sh ```