Skip to content

Diesel-Jeans/signal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

signal Rust

Setup

Preliminaries

  1. cargo
  2. docker-compose
  3. sqlx

Building the server

  1. Go into server
  2. Create a file called .env with the following content
DATABASE_URL=postgres://root:root@127.0.0.1:5432/signal_db
DATABASE_URL_TEST=postgres://test:test@127.0.0.1:3306/signal_db_test
REDIS_URL=redis://127.0.0.1:6379
SERVER_ADDRESS=127.0.0.1
HTTPS_PORT=443
HTTP_PORT=80

if you are on linux and do not want to sudo the program, you can change the HTTPS and HTTP ports to your liking.

  1. Go into server/cert
  2. Generate certificates by running the following
./generate_cert.sh
  1. Go back into server
  2. Start the database by running the following command
docker-compose up
  1. Start the server by running the following command
cargo run

Building the client

  1. Go into client
  2. Create a file called .env with the following content
HTTPS_SERVER_URL=https://localhost:443
HTTP_SERVER_URL=http://localhost:80
DATABASE_URL=sqlite://./client/client_db/dev.db
DATABASE_URL_TEST=sqlite::memory:
CERT_PATH=../server/cert/rootCA.crt
  1. Go into client/client_db
  2. Execute the following command
cargo sqlx database create -D sqlite://dev.db && cargo sqlx migrate run -D sqlite://dev.db
  1. Go back into client
  2. Start the client by running the following command
cargo run

As an example, two clients should then be created and messages between them will be send.

TLS Configuration

If you do not want to use HTTPS and WSS you can run the server and client with --no-tls and then they will just communicate over HTTP and WS

Clean up

Resetting the server database

  1. Go into server
  2. Close the database and run the following command
docker-compose down -v

Resetting the client database

  1. Go into client/client_db and run the following command
rm alice.db* && rm bob.db*

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published