Giter Site home page Giter Site logo

dsatter's Introduction

DSatter

DSatter is a real-time chat service that is implemented as a Distributed System with the backend running on the edge of the cloud.

This project originally started as a course project for the course Distributed Systems, organized by the University of Helsinki.

The core system consists of two different types of nodes: one discovery node whose main task is to implement the naming service functionality, and a set of server nodes.

Project (repo) structure

Common

Contains common modules and types that are used by all types of nodes.

Node client

Client application for the chat service. Serves as the users interface to the chat service.

Node discovery

Serves node-servers and clients. Provides a REST endpoint for the different nodes. Assigns ids for node-servers and provides endpoints for them to register to or query statuses of their peers. Also provides a REST endpoint for clients to query for endpoints to connect to.

Node server

Provides an endpoint for clients to connect to. Handles incoming messages, conveys them to other node-servers, and assures that all clients get all messages. The whole distributed system is designed so that a node-server can run in isolation by itself or as a part of a distributed system with n nodes.

Test perf

A simple test to test the performance of the system.

Usage

The node discovery and server are packaged as npm packages and are implemented using Javascript running on nodejs. The client and performance test are packaged as python virtual environments. Instructions for running the python packages are given in their own README's.

Running the distributed chat service backend

All nodes have 2 different environments configured; production and development. When running in the development environment additional checks and debug-prints are done. Also the startup differs a bit between the different modes. Detailed info about required arguments are given separately for each node in their own directories.

Dockerized (production environment)

You can run the backend in production mode, utilizing the docker scripts. The provided scripts handle all required arguments.

Setting up Dockerized environment:

./build-images.sh
./start-containers.sh

Tearing down the Dockerized environment:

./teardown.sh

If you wish to only stop running the containers or delete the images or volumes, the following commands accomplish those respective actions:

./stop-containers.sh
./delete-images.sh
./delete-volumes.sh

Localhost (development environment)

You can run the project on localhost by following the detailed instructions for each node in their README's. Start by setting up the environments for each node. When the environments are set up run one instance of the node-discovery. After that you can continue by running n instances node-servers. When running the node-servers in dev-env on localhost, there is a small chance for port colliding, since the listening ports are selected randomly from a set of 1000 ports. This is not handled in any way. In case of any errors, delete all *.db -files from both the discovery and the server nodes' directories before restarting the system. Most errors happen when the node-servers are terminated forcefully and are not given a chance to unregister themself from the discovery node.

dsatter's People

Contributors

kordaniel avatar juliapalorinne avatar jolaakso avatar jaanan avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

juliapalorinne

dsatter's Issues

System messages

newMessagesForClient

  • payload: messageId type string -> number. nodeId and id is not used by the client -> remove these.

node-server: handling broadcasted messages sent from other node-servers

In message-handler, when handling the incoming broadcastNewMessages the variable added is a object, that only contains the property messageId, which is then broadcasted to all clients. Instead the whole message object should be broadcasted to the clients. There should also be a check to ensure that the message really is inserted into the DB.

In addition, the messageId value is a string, when it probably should be a integer.

Update README:s

Go trough all README:s and update them where needed, before the project deadline on Mon 19.12, 23:59.

Add ID:s to messages

Do we need to add ID:s to all or a subset of all message types? To handle errors, for example so the client knows if new message is not handled/added?

Build a chat client application

This was not a part of the project, neither a requirement in the course project. Still a fun thing to do and if desired by the group, the client can be kept in it's own branch without ever merging it into the main branch.

System status, monitoring, logging

Implement a system so that the whole distributed system can be monitored. Ideas:

  • Topology of network, including possible partitions
  • Clients, at a minimum info about how many clients are connected to which server
  • Discovery server should be updated of changes in the network

Node-server: login error handling

Handle case when node-server tries to login with invalid id/pass and discovery-node replies with status 401 'invalid credentials'

SQLite database

SQLite3 database and schema
Database connection
Functions to submit and search the database

Handle database path argument

When running node-servers in dev env (on localhost) we need to pass a different database file path for every running node

refactor messages

  • Rename field name to type or other suggestion
  • Add a field containing the senders ID (?)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.