GitHub - duemaster/IS4302_Project · GitHub
Skip to content

duemaster/IS4302_Project

Repository files navigation

IS4302_Project

Project Setup

Technology Stack

  1. BlockChain - Hyperledger Composer (Running in vagrant container)
  2. FrontEnd (Web) - Angular 5
  3. FrontEnd (Mobile App) - Ionic 3
  4. BackEnd - Play

Play Server communicates with Composer via Vagrant SSH.

By default, the Play server will use first vagrant boxId recovered via the

vagrant global-status

command

Auto Generated Data Setup

  1. The project is configured to generate the following companies by default
  • Airline Company (id: Airline1)
  • Cargo Company (id: Cargo1) [default authorisedCargoCompany of Airline Company]
  • Cargo Company 2 (id: Cargo2)
  • GHA Company (id: GHA1)
  1. Default generated login credentials for all officers (All companies) is
Username: admin
Password: password

Set up Vagrant Environment

We have configured a special vagrant file inside our project folder. The vagrant file pulls the setup files from this repo

To setup:

vagrant up
cd composer-playground
./playground.sh
./setup.sh

Note:

./setup.sh starts a composer rest server at port 3000, this is needed by the play server to generate user accounts during initial setup

Upgrade Network (optional)

If there is a need to update bna

./update-network.sh

Things to check

  1. Vagrant File and Docker.compose-cli.yaml have ports 15000+ opened Vagrant
  # Airline
  for i in 15000..15019
    config.vm.network :forwarded_port, guest: i, host: i
  end

  # Cargo
  for i in 15020..15039
    config.vm.network :forwarded_port, guest: i, host: i
  end

  # Cargo 2
  for i in 15040..15059
    config.vm.network :forwarded_port, guest: i, host: i
  end

  # GHA
  for i in 15060..15079
    config.vm.network :forwarded_port, guest: i, host: i
  end

Docker

    ports:
      - 8080:8080
      - 3000:3000
      - 3001:3001
      - 3002:3002
      - "15000-15080:15000-15080"
  1. air-chain.bna file is the latest version
  2. Check both blockchain (localhost:8080) and mysql database have the same users that tally

Setup Database

This project has 4 companies and 4 servers. Below is the sql command to create corresponding database.

1 Airline Company

CREATE DATABASE Airline DEFAULT CHARACTER SET utf8;
CREATE USER 'Airline'@'localhost' IDENTIFIED BY 'Airline';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, REFERENCES ON Airline.* TO 'Airline'@'localhost';

2 Cargo Company

CREATE DATABASE CargoCom DEFAULT CHARACTER SET utf8;
CREATE USER 'CargoCom'@'localhost' IDENTIFIED BY 'CargoCom';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, REFERENCES ON CargoCom.* TO 'CargoCom'@'localhost';

3 Cargo Company 2

CREATE DATABASE CargoCom2 DEFAULT CHARACTER SET utf8;
CREATE USER 'CargoCom2'@'localhost' IDENTIFIED BY 'CargoCom2';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, REFERENCES ON CargoCom2.* TO 'CargoCom2'@'localhost';

4 GHA Company

CREATE DATABASE GHA DEFAULT CHARACTER SET utf8;
CREATE USER 'GHA'@'localhost' IDENTIFIED BY 'GHA';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, REFERENCES ON GHA.* TO 'GHA'@'localhost';

Set up server

Install sbt (sbt is the engine to run server)

Please refer to the installing section in below link

   https://www.scala-sbt.org/1.0/docs/Setup.html

Run server in a server folder

Airline use 9000, GHA 9001, Cargo1 9002, Cargo2 9003

sbt
run 9000

A default admin user(userName: admin, password:password) will be created. Web app is already built in production and served by server.

Set up mobile app

Each type of company has Server,App and Web. Server uses play framework, Web is a angular 5 project and app is ionic project.

For App please use npm install

npm install

Start Ionic App (Inside App Directory)

Option 1 use browser

Ionic allows to use browser to simulate the app, however native functions such as scan QR code is not available. It is needed to disable chrome CORS security also since request is from port 4200 and sending request to port 9000.

Do change Ip address in app/src/providers/settings/settings.ts for each app

ionic serve

Option 2 Install on android phone (ios needs other configuration)

Install on android phone and android development is required. Do change Ip address in app/src/providers/settings/settings.ts for each app

ionic cordova platform add android
ionic cordova run android --Device

Testing Blockchain

cd hyper-ledger-composer-model
npm test

If any problem is appeared please contact us (Tut3Grp2)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors