Erlang backend
This project consists of three main parts, all of which are open-source, distributed and horizontally scalable:
Yamka and Scylla are containerized, Gluster isn’t. You also need to set up a mail server; how you do this is outside the scope of this document. Execute these commands to download everything:
apt install glusterfs-server # or another package manager
git clone https://github.com/yamka-app/backend.git
cd backend
systemctl start glusterd # or something else if you're not using systemd
# (configure Yamka and Gluster here)
docker-compose build
docker-compose up -d
# (configure Scylla here, then restart the Yamka container)
Required Scylla configuration:
yamkadb
with a custom password (this tutorial might be helpful)db_structure.cql
(e.g. cqlsh --file db_structure.cql
)Required Docker secrets:
tls_fullchain
- full TLS certificate chain (.pem
). You have to obtain it yourself (e.g. from Let’s Encrypt).tls_privkey
- TLS certificate private key (.pem
)cassandra_password
- Scylla password for the yamkadb
usersmtp_pass
- SMTP password for the noreply
user on your mail serverTweak the paths to these secrets in docker-compose.yml
.
src/yamkabackend.app.src
, key env
:
sweet_port
: Sweet (main protocol) port (TCP). Remember to open this port in the firewall if using onesweet_client_timeout
: clients get disconnected if they do not send packets for that many millisecondssweet_comp_threshold
: server-to-client compression threshold (bytes)sweet_protocol_between
: {MinimumProtocolVersion, MaximumProtocolVerion}
(inclusive). Making these values go over the default bounds will most certainly make the server unexpectedly crash in weird places.sweet_file_chunk_size
: server-to-client FileDataChunk
packet payload sizetasty_port
: Tasty (real-time, e.g. voice protocol) port (UDP). Remember to open this port in the firewall if using onetasty_client_timeout
: clients get disconnected if they do not send packets for that many millisecondstasty_packet_rate_limit
: packet rate limit (Hz)tasty_packet_sz_limit
: packet size limit (bytes)tasty_speaking_ind_threshold
: the “speaking” flag gets reset after that many milliseconds pass without the client sending voiceemail_relay
: server to send email fromstat_interval
: stat logging period (ms)token_ttl
: default access token expiration time (s)cassandra
: {CassandraInstanceHostname, CassandraInstancePort}
typing_reset_threshold
: the “typing” flag gets reset after that many milliseconds pass without the client sending typing notificationsfile_storage_path
: user uploaded file storage path (preferrably a Gluster instance)sync
is declared as a rebar dependency for this project, so you should be able to just edit your files, save the changes and watch your code get reloaded in the shell after you have started the project with rebar3 shell
. You can also run rebar3 check
to run xref and dialyzer. Scylla and Gluster have to be up, and the Yamka container has to be down.