Giter Site home page Giter Site logo

davvve / ds_ss20_group16_localshit Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 2.04 MB

Project of lecture DBE14 Distributed Systems. Digital Business Engineering Masters Degree at HHZ Böblingen - Hochschule Reutlingen. Team: Markus Drespling, Frederick Dehner, David Lüttmann

HTML 7.64% Python 92.36%
distributed-systems python ring-algorithm chang-roberts leader-election

ds_ss20_group16_localshit's Introduction

Local's Hit

Logo_LocalsHit

Project of Lecture DBE14 Distributed Systems

Team Members

  • Markus Drespling
  • Frederick Dehner
  • David Lüttmann

Install & run

Install:

  1. Update pip: pip install --upgrade pip
  2. Update setuptools: pip install --upgrade setuptools
  3. Install localshit: pip install -e .

Run frontend server:

frontend

Run backend server(s) with custom frontend server IP:

localshit -f "172.17.0.2"

Open client:

http://[frontend-ip]:8081/index.html

Run tests:

pytest tests -s

Demo Video

Demo-Video

Config

All configuration parameters are stored in utils/config.py:

config = {
    "frontend_server": "192.168.0.179",
    "ring_multicast_address": "224.1.1.1",
    "ring_multicast_port": 5007,
    "ring_unicast_port": 10001,
    "content_websocket_port": 10013,
    "frontend_unicast_port": 10012,
    "frontend_webserver_port": 8081,
    "reliable_socket": 10033,
    "loglevel": "debug",
    "chuck_norris": True,
    "quote_intervall": 25,
    "announcement_timeout": 1,
    "heartbeat_intervall": 2,
    "heartbeat_timeout": 6,
}

Docker

You can use docker to run multiple servers on one host. If you use multiple servers distributed on more than one host, use Vagrant because Docker doesn't support bridged networks to the local area network.

Build and run backend

Build Docker image for backends (after every change)

docker build -f Dockerfile.backend -t localshit .

Run docker

docker run --rm localshit

Build and run client

Build Docker image for backends (after every change)

docker build -f Dockerfile.client -t localshit-client .

Run docker

docker run --rm localshit-client

Build and run client

Build Docker image for backends (after every change)

docker build -f Dockerfile.frontend -t localshit-frontend .

Run docker

docker run --rm localshit-frontend

Run tests

pytest tests -s

Details about the system

Message Types

Type Parameter 1 Parameter 2 Description
SA IP address - Service announcement - announce backend service to multicast
SE leader candidate IP isLeader (True/False) Start election - election messages in the ring
HB heartbeat GUID - Heartbeat messages
FF IP address of failed node - Failure message when heartbeat fails
RP IP address - Reply to sender of service announcement with own IP address
LE IP address of current leader - notifies frontend server about current leader
CO content - Content messages - send to clients
CL message - Notify clients that websocket of backend server is shutting down
CR comment - Message type for comments on quotes from the client
AA IP address - Send initial message via multicast to get a database update

Vagrant

Because Docker doesn't support bridged networking, we choose Vagrant containers with VirtualBox.

Setup

  1. Install VirtualBox
  2. Install Vagrant
  3. Add hashicorp/bionic64 box image: vagrant box add hashicorp/bionic64
  4. (Init Vagrantfile: vagrant init hashicorp/bionic64)
  5. vagrant up
  6. sudo apt-get updates
  7. sudo apt-get -y install python3-pip
  8. Update setuptools: pip3 install setuptools
  9. Install localshit: pip3 install -e .
  10. sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
  11. Update pip: pip install --upgrade pip
  12. Update setuptools: pip install --upgrade setuptools
  13. Install localshit: pip install -e .

Run Vagrant

  1. Start vagrant VM: vagrant up
  2. Connect to VM via ssh: vagrant ssh
  3. Navigate to /home/vagrant/code and start the server with localshit -f "[frontend_ip]"
  4. To stop the VM, use vagrant halt

Examples

To run the examles within a docker container use

docker run -it --rm  -v "$PWD/examples":"/usr/src/widget_app" python:3 python /usr/src/widget_app/dynamicdiscover.py

ds_ss20_group16_localshit's People

Contributors

davvve avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.