-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Slice folder is moved to car-renting-system/shared
Blockchain
- 5000: mock blockchain
Auth
- 5010: api
- 5011: postgres
- 5012: ice
Rental
- 5020: api
CarDB
- 5030: api
- 5031: postgres
- 5032: ice
Tarrif
- 5041: api
CarManager
- 5050: api (WIP)
Source files car-renting-system/shared/scripts/<microservice-name>.bat
from root directory (/car-renting-system). Where <microservice-name>
is one of:
auth
blockchain
cardb
front
rental
tarrif
Windows example:
.\shared\scripts\auth.bat
Linux example (not tested):
chmod u+x .\shared\scripts\auth.bat
source .\shared\scripts\auth.bat
In addition to deploy all avaliable microservices on Windows, source file car-renting-system/shared/scripts/launch.bat
from root directory (/car-renting-system):
.\shared\scripts\launch.bat
This command can also be run with any number of arguments. It allows you to specify, microservices to skip. For more information run:
.\shared\scripts\launch.bat -h
To run tests and application outside docker, you need running postgresql database:
docker run -d -p 5011:5432 --name auth-postgres -e POSTGRES_PASSWORD=password postgres
To run tests and application outside docker, you need running postgresql database:
docker run -d -p 5031:5432 --name cardb-postgres -e POSTGRES_PASSWORD=password -e POSTGRES_DB=cars postgres
To run the simplest blockchain, you need docker image, run with this command:
docker run --detach --publish 5000:8545 trufflesuite/ganache-cli:latest --mnemonic "frog coin ten lottery sport awful broken extra call stereo police manual"
where: --mnemonic is a phrase used as a seed in the blockchain, provides predictable outcomes in generation (all our services are using generated addresses using this mnemonic
To run blockchain with set delay between blocks (simulating the real blockchain), run with this command:
docker run --detach --publish 5000:8545 trufflesuite/ganache-cli:latest --mnemonic "frog coin ten lottery sport awful broken extra call stereo police manual" --blockTime 60
where: --mnemonic is a phrase used as a seed in the blockchain, provides predictable outcomes in generation (all our services are using generated addresses using this mnemonic --blockTime number is a number of SECONDS it takes to mine a new block
To compile and deploy contracts you will need truffle:
npm install -g truffle
Then, in the directory with contracts (in our project /contracts) you need to run:
truffle compile
truffle migrate
This will deploy contracts to the blockchain specified in truffle-config.js (default: 127.0.0.1:5000)
To run tests, you will need a running blockchain, deployed contracts, and finally:
truffle test
First, compile the contracts using
truffle compile
Then, in the contracts\build\contracts, use the web3j as follows
web3j generate truffle --truffle-json=CONTRACT.json --outputDir=DIR --package=PACKAGE
where CONTRACT.json is your compiled contract, DIR is the save directory of the java file, and PACKAGE is chosen name of the java package