💿Running With Docker
Prepare Requirements
The Docker installation package available in the official Ubuntu repository may not be the latest version. To ensure we get the latest version, we’ll install Docker from the official Docker repository. To do that, we’ll add a new package source, add the GPG key from Docker to ensure the downloads are valid, and then install the package.
First, update your existing list of packages:
Next, install a few prerequisite packages which let apt
use packages over HTTPS:
Then add the GPG key for the official Docker repository to your system:
Add the Docker repository to APT sources:
Update your existing list of packages again for the addition to be recognized:
Make sure you are about to install from the Docker repo instead of the default Ubuntu repo:
You’ll see output like this, although the version number for Docker may be different:
Output of apt-cache policy docker-ce
Notice that docker-ce
is not installed, but the candidate for installation is from the Docker repository for Ubuntu 22.04 (jammy
).
Finally, install Docker:
Docker should now be installed, the daemon started, and the process enabled to start on boot.
Build
The only requirements are git
(to checkout the repository) and docker (to build the image and run the container). Golang does not have to be installed, the docker image build process uses a build stage that provides the correct Go environment and compiles the node down to one command.
If you already cloned ceremonyclient at previous steps, you can skip to clone it again.
In the repository root folder, where the Dockerfile file is, build the docker image:
Use latest version instead of 1.4.19
.
The image that is built is light and safe. It is based on Alpine Linux with the Quilibrium node binary, not the source code, nor the Go development environment. The image also has the grpcurl
tool that can be used to query the gRPC interface.
Run
You can run Quilibrium on the same machine where you built the image, from the same repository root folder where docker-compose.yml is.
You can also copy docker-compose.yml
to a new folder on a server and run it there. In this case you have to have a way to push your image to a Docker image repo and then pull that image on the server. Github offers such an image repo and a way to push and pull images using special authentication tokens. See Working with the Container registry.
Run Quilibrium in a container:
A .config/
subfolder will be created under the current folder, this is mapped inside the container. Make sure you backup config.yml
and keys.yml
.
Customizing docker-compose.yml
If you want to change certain parameters in docker-compose.yml it is better not to edit the file directly as new versions pushed through git would overwrite your changes. A more flexible solution is to create another file called docker-compose.override.yml
right next to it and specifying the necessary overriding changes there.
For example:
The above will override the image name and also the restart policy.
To check if your overrides are being picked up run the following command:
This will output the merged and canonical compose file that will be used to run the container(s).
Interact with a running container
Drop into a shell inside a running container:
Watch the logs:
Get the node related info (peer id, version, max frame and balance):
Run the DB console:
Run the Quilibrium client
How to use gRPCurl with a Quilibrium node
The Docker image has grpcurl
installed, you can use that instance through docker exec
, for example:
List Services
List available services:
Output:
The first two are reflection related services provided by gRPC, the service provided by the Quilibrium Node is quilibrium.node.node.pb.NodeService
.
List Methods
List supported method by NodeService
:
Output:
Describe Method
To get a description of the GetNodeInfo
method:
Output:
The request and response messages are all defined in the node.proto source file. Most (not all) request messages are empty.
GetNodeInfo
How to call GetNodeInfo
:
Output:
As you can see the output has both the peer id and the max frame that the node is at.
GetTokenInfo
You can call GetTokenInfo
to see balances:
Output:
Important
The values are encoded. The strings of only As are for sure zero. TODO: determine how to decode.
GetPeerInfo
Call GetPeerInfo
to get info about all the nodes:
Output (truncated):
The output is extremely long, this is why it is piped to less
. Also, note that there is a -max-msg-sz 5000000
flag on the command. By default grpcurl
limits responses to 4MB and this flag allows larger one.
Count Nodes
Run this command to count how many nodes are there:
Last updated