Building and running Lisk Service from source is an alternative way to run it on the server or development environment. This technique is useful on systems whereby there is no possibility of using Docker, and also for development purposes.
In order to run a local version of Lisk Service, the following development dependencies listed below have to be installed:
- Ubuntu 18.04 LTS Bionic Beaver Development Dependencies
- Ubuntu 20.04 LTS Focal Fossa Development Dependencies
- Debian 10 Buster Development Dependencies
- MacOS 10.15 Catalina Development Dependencies
Instead of getting the tar.gz archive with the previous version as described in the main README, clone the entire repository with the git version control system.
# Clone Lisk Service repository
git clone https://github.com/LiskHQ/lisk-service.git
# Change directory to the new repository
cd lisk-service
# Switch to the recent stable as a base
git checkout vx.y.z
# ...or use the development branch
git checkout development
Where x.y.z
is the latest release version, ex. 1.0.1
Install all yarn dependencies from the root directory.
npm i -g yarn
make build-local
The ecosystem.mainnet.config.js
contains a sample configuration, which refers to the mainnet. Please ensure it reflects your local environment. All configuration parameters are described in the document Configuration Options.
pm2 start ecosystem.config.js
# or
yarn start
To check the service status, navigate to the URL http://127.0.0.1:9901/api/status. If it is running on a remote system, change the host IP from 127.0.0.1
to the external IP address of your machine.
After starting the process, the runtime status and log location can be found by executing the following command:
pm2 list
pm2 stop ecosystem.config.js
Restart all microservices of Lisk Service simultaneously.
pm2 restart ecosystem.config.js
pm2 delete ecosystem.config.js
# or
yarn stop
make clean
Once the application is running it is now possible to run automated tests.
Unit tests are implemented in the framework and every microservice of the project. They are designed to test the most fundamental, product-independent logic that is used to build a micro-service on top of the framework.
cd framework
yarn run test:unit
cd ../services/blockchain-app-registry
yarn run test:unit
cd ../services/blockchain-connector
yarn run test:unit
cd ../services/blockchain-indexer
yarn run test:unit
cd ../services/fee-estimator
yarn run test:unit
cd ../services/market
yarn run test:unit
cd ../services/export
yarn run test:unit
cd ../services/gateway
yarn run test:unit
Functional tests ensure that a project build on the top of the framework is able to process requests and collect responses involving the API gateway.
cd framework
yarn run test:functional
cd ../services/blockchain-app-registry
yarn run test:functional
cd ../services/blockchain-connector
yarn run test:functional
cd ../services/blockchain-indexer
yarn run test:functional
cd ../services/fee-estimator
yarn run test:functional
cd ../services/market
yarn run test:functional
cd ../services/export
yarn run test:functional
cd ../services/gateway
yarn run test:functional
Integration tests work in a similar manner to functional tests. In this case the real blockchain data coming from a custom test blockchain is used. Please ensure that Lisk Core and all microservices are running.
To run Lisk Core with a custom blockchain:
cd jenkins/lisk-core
make up
To run Lisk Service with PM2
pm2 start ecosystem.config.js
To run the integration tests:
cd tests
yarn run test
It is now possible to use your preferred editor to make changes in the source files. Take a look at the template project in order to find some suitable examples.
Once completed, it is also possible to build Docker images with make build-images
and run them using the method from the main README.