Skip to content

Distributed Collaborative Editor including Passive Replication and Fault Tolerance implemented as a term project for the course Distributed Systems (CS60002) [IIT Kgp]

Notifications You must be signed in to change notification settings

sarthak-chakraborty/Distributed-Collaborative-Editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Distributed Collaborative Editor

This is term project for the course Distributed Systems(CS60002) [IIT Kgp]. Contributors for this project are:

  • Sarthak Chakraborty
  • Sai Saketh Aluru
  • Nikhil Nayan Jha
  • Omar Eqbal
  • Aditya Anand

Basic Information

This is a Collaborative editor that uses Operational Transformations to maintain consistency in the documents at server and client side. OT algorithms and its code is based on Tim Baumann's project.

Our system has a single MASTER server, and 2 worker servers, among which one will act as a PRIMARY while the others act as a SECONDARY.

Django app has been used for all the SERVERS while CLIENT text area is written in javascript and uses CodeMirror. Updates can be sent over Fanout Cloud to get real-time streaming guarantees.

We have implemented a basic collaborative editor that can handle multiple documents, supports a single crash fault, along with recovery mechanism. The replication strategy that we have used is Passive Replication.

Usage

Install dependencies and setup database for all the servers:

virtualenv venv
. venv/bin/activate
cd master
pip install -r requirements.txt
python manage.py migrate

cd ../worker-primary
python manage.py migrate

cd ../worker-secondary
python manage.py migrate
cd ..

Note: default storage is sqlite.

Install dependencies for proxy server:

cd proxy-server/
npm install
cd ..

Running with Fanout Cloud

Create a .env file in each of the directories(master / worker-primary / worker-secondary ) containing GRIP_URL:

GRIP_URL=https://api.fanout.io/realm/{realm-id}?iss={realm-id}&key=base64:{realm-key}

Be sure to replace {realm-id} and {realm-key} with the values from the Fanout control panel.

In a separate shell, run proxy server for local tunneling:

node proxy-server/proxy.js

In the Fanout control panel, set the public IP of the running system <host>:<port> as the Origin Server. (Since the proxy server is running at PORT=8000, <port> at the Fanout control panel will be 8000 as well)

Now run a local instance of all the servers in separate shell

cd master/
python manage.py runserver 127.0.0.1:8001
cd worker-primary/
python manage.py runserver 127.0.0.1:8002
cd worker-secondary/
python manage.py runserver 127.0.0.1:8003

Then open up two browser windows to your Fanout Cloud domain (e.g. http://{realm-id}.fanoutcdn.com/). Requests made to Fanout Cloud should be routed through the procy server to the local instances of the server running. New document can be created by going to the URL http://{realm-id}.fanoutcdn.com/{new-document-ID}

Recovery Handling

For recovery handling, the local instance running as the PRIMARY server (S1) can be stopped(representing as a crash fault) and can then be restarted again(at the same port). It can be seen that S1 recovers with the updates that had been applied while it was down becomes a secondary server. Consistency checks can be done by crashing the current primary server (not S1), which will lead S1 to be primary.

About

Distributed Collaborative Editor including Passive Replication and Fault Tolerance implemented as a term project for the course Distributed Systems (CS60002) [IIT Kgp]

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •