This is the repo for the backend of the c-meet system. (Dissertation Project: link)
The main components:
rest_api_server.py
: handles all REST API requests from the frontend.meeting_server.py
: enables frontend clients to hold meetings.db.py
: database for meetings and events (using mongo)
The quickest way to setup the system is by using docker containers.
The steps are as follows:
- Make sure you have docker installed.
- Go into docker directory, (
cd docker
) - Run
docker-compose up
(NOTE: This also sets up the frontend) - (Optional) The setup wont have any data. To generate sample data:
- Open bash in the container with image 'bakshi41c/mdt_meeting_server',
(docker exec -it container_id_here /bin/sh
) - Run:
python gen_sample.py
- Open bash in the container with image 'bakshi41c/mdt_meeting_server',
- (Optional) The setup uses Ganache-CLI for a Ethereum test network. But the server account doesn't have any money, as such it can't deploy any smart contracts. Follow topping up server eth account section.
The front-end will be running on http://localhost.
If for any reason, docker is not an option, the system can be setup manually.
- Make sure you have python 3.7+ installed.
- Make sure you have MongoDB installed and running on port 27017 (can be configured).
- Make sure you have Ganache installed.
- Follow 'Setting up Ganache' section.
- (Optional) Follow 'Topping up server eth account' section.
- Run
pip install -r requirements.txt
. - (Optional) SET env variable
$MDT_SERVER_CONFIG
to use custom config (It uses config.json as default). - SET env variable
$PYTHONPATH
to this directory. - (Optional) Run
python gen_sample.py
to generate sample data. - Run
python meeting_server.py
. - Run
python rest_api_server.py
.
The system uses Ganache/Truffle for test Ethereum network. To setup Ganache:
- Download Ganache (GUI).
- Create a workspace.
- Go to settings, make sure the port is
8545
and network id is5777
.
This can also be done using Ganache-CLI.
The server Ethereum account has no balanace at start, as such it cannot interact with the Ethereum network. To top up:
- Install Metamask extension in Chrome or Firefox.
- Connect Metamask to Ganache by setting up 'Custom RPC'. Ganache should be running on
localhost:8545
. - Import one of the accounts from Ganache (using the account's private key). If using docker: the private key of all the test accounts should be printed in the console. If using Ganache GUI: the private key is hidden under the key icon. The test accounts should all have 100 ETH by default.
- Import the server's account into Metamask, using the
sample_server_eth_key
JSON file (select import type as 'JSON file' rather than 'Private Key' in Metamask). - Transfer some (50 recommended) ETH from the Ganache test account to the server account.
The docker images that are generated from this repository:
bakshi41c/mdt_rest_api_server
: https://hub.docker.com/r/bakshi41c/mdt_rest_api_serverbakshi41c/mdt_meeting_server
: https://hub.docker.com/r/bakshi41c/mdt_meeting_server
New commits automatically generate new images.
The system utilises DeeID Websocket server. The default configuration uses the publicaly available server at: ws://deeid.uksouth.azurecontainer.io:5678
The DeeID mobile app (which is required to sign in) can be obtained from:
https://github.com/sirvan3tr/OmneeMobileApp
The contract CLI can be used to check and deploy smart contract without the web app. To use it, run python tests/contract_cli.py [meeting_id]
The meeting CLI can be used to generate meeting events without the web app. To use it, run python tests/meeting_cli.py [staff_deeid] [staff private_key]