Installation with Docker
How to set up Klayr Service and connect it to a local Klayr Core node.
Pre-requisite Klayr Service is a web application middleware that allows interaction with various blockchain networks based on the Klayr protocol. It is recommended to set up a blockchain node first, before setting up Klayr Service.
|
1. Setting up Klayr Service
1.1. Prerequisites
1.1.1. Requirements
- Supported Platforms
-
-
Ubuntu 20.04 (LTS) x86_64
-
Ubuntu 22.04 (LTS) x86_64
-
MacOS x86_64
-
- Node.js
-
-
18
-
The following system requirements are recommended:
- Memory
-
-
Machines with a minimum of 16 GB RAM for the Mainnet.
-
Machines with a minimum of 16 GB RAM for the Testnet.
-
- Storage
-
-
Machines with a minimum of 40 GB HDD.
-
The following dependencies are required to install and run Klayr Service with Docker.
1.1.2. Development tools
Install the build-essential
package alongside several development tools.
For example, use apt
if running Ubuntu as shown in the following command below:
apt install build-essential git
Brew
Install Brew by following the most recent instruction.
If you already have Brew installed, ensure it is working and is the latest version.
brew update
brew doctor
Xcode
Install Xcode essentials coming from Apple.
xcode-select --install
1.1.3. Docker & Docker compose
-
Please refer to the Docker installation for Ubuntu.
-
To install Docker Compose, please refer to Install Docker Compose.
-
To configure Docker so it can be run without
sudo
rights, follow: Linux post install.
-
Please refer to Docker installation for Mac. Please note that Docker for Mac already includes Docker Compose.
1.2. Installation of Klayr Service
Clone the klayr-service GitHub repository and then navigate into the project folder.
git clone https://github.com/KlayrHQ/klayr-service.git
cd klayr-service
Switch to the latest release branch.
git checkout v0.7.8
2. Build Klayr Service
To build Klayr Service from local files, first, navigate to the klayr-service
repository on your system:
make build-images
Klayr Service is now ready to use on your machine.
If you skipped the step to configure Docker to run without sudo rights, you need to prepend sudo with aforementioned command: sudo make build-images
|
3. Connecting Klayr Service to a blockchain node
Before running the application copy the default docker-compose environment file:
cp docker/example.env .env
In the next step, open .env
to set the required environment variables.
vim .env
# Klayr ecosystem configuration
KLAYR_APP_WS=ws://host.docker.internal:7887
The example.env
assumes that the blockchain node e.g. Klayr Core node is running on the host machine, and not inside of a Docker container.
When running a blockchain node inside of a Docker container, the following variable needs to refer to the container. For this to work, the container running the blockchain node and the Klayr Service Blockchain Connector container must share the same docker network:
# Klayr ecosystem configuration
KLAYR_APP_WS="ws://<your_docker_container>:7887"
For a complete list of supported environment variables check the Klayr Service Configuration Reference. |
4. Starting Klayr Service
Run the following command to start Klayr Service:
make up
5. Stopping Klayr Service
You can stop Klayr Service again with the following command:
make down
More commands about how to manage Klayr Service are described on the Docker commands page.