Skip to content

Latest commit

 

History

History
114 lines (73 loc) · 3.37 KB

CONTRIBUTING.md

File metadata and controls

114 lines (73 loc) · 3.37 KB

Contributing to Rust Commune

There are many ways to contribute to Commune Rust, including writing code, openning issues, helping people, reproduce, or fix bugs that people have filed and improving documentation.

Development Environment

Commune Rust is written in The Rust Programming Language, you will have to setup Rust in your machine to run the project locally.

Tools like Justfile are recommended to improve DX and reduce learning curve by running commands easily.

Getting Started

  1. Create a copy of .env.example on .env
cp .env.example .env
  1. Generate Synapse server configuration
just gen_synapse_conf
  1. Run Synapse Server (and other containerized services) using Docker Compose via:
just backend

When you are ready

Teardown services using just stop. If you want to perform a complete cleanup use just clear.

Warning just clear will remove all containers and images.

Testing

This application has 2 layers for tests:

  • Unit: Are usually inlined inside crates, and dont depend on any integration
  • E2E: Lives in test crate and counts with the services that run the application

Unit

Unit tests can be executed via cargo test -p <crate name>, this will run every unit test.

E2E

You must run Docker services as for development. In order to avoid messing up the development environment, its recommended to use the synapse setup from crates/test/fixtures/synapse replacing it with docker/synapse.

Make sure the .env file is created from the contents on .env.example

Application Layout

Application Layout Overview

The client, any HTTP Client, comunicates with the Commune Server which may or may not communicate with Matrix's server Synapse which runs along with its database in a Docker container.

Email Development

Use MJML Editor and then render into HTML. Make sure variables use Handlebars syntax (e.g. {{name}}).

For local testing you can use something like:

curl -s http://localhost:1080/email | grep -o -E "This is your verification code.{0,7}" | tail -1 | sed 's/^.*://' | awk '{$1=$1;print}

To get the very last email's verification code.

Warning Note that changes on email content will break this script

Redis

A Redis instance is used to keep in-memory short-lived data used certain server operations such as storing verification codes.

For this purpose Redis is served as part of the development stack on Docker.

The redis/redis-stack image contains both Redis Stack server and RedisInsight, you can use RedisInsight by pointing your browser to localhost:8001.

Synapse

There is an official Synapse image available at https://hub.docker.com/r/matrixdotorg/synapse or at ghcr.io/matrix-org/synapse which can be used with the docker-compose file available at contrib/docker. Further information on this including configuration options is available in the README on hub.docker.com.