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 npm dependencies from the root directory.
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.core3.config.js
# or
npm start
To check the service status, navigate to the URL http://localhost:9901/api/status. If it is running on a remote system, change the host name from localhost
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.core3.config.js
Restart all microservices of Lisk Service simultaneously.
pm2 restart ecosystem.core3.config.js
pm2 delete ecosystem.core3.config.js
# or
npm stop
make clean
Once the application is running it is now possible to run automated tests.
Unit tests are implemented in the framework part 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
npm test
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.
In order to run them successfully, it is necessary to have the template microservice running alongside.
cd service/template
node app.js
When the template micro-service and the gateway are running, it is possible to run the functional tests from the tests/
directory:
cd tests
npm 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.core3.config.js
To run the integration tests:
cd tests
npm run test:integration
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
and run them using the method from the main README.