build and document qclient for docker (#165)

* specify value of cpus and memory as string

* build and document qclient

* fix health check command
This commit is contained in:
Marius Scurtescu 2024-04-22 23:53:58 -07:00 committed by GitHub
parent de115fbfad
commit 6068cd8f26
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 6 deletions

View File

@ -54,6 +54,9 @@ docker build --build-arg GIT_COMMIT=$(git log -1 --format=%h) -t quilibrium -t q
Use latest version instead of `1.4.2`.
> [!TIP]
> You can use the `task build` command instead. See the [Task](#task) section below.
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.
@ -105,6 +108,9 @@ Run Quilibrium in a container:
docker compose up -d
```
> [!TIP]
> You can alternatively use the `task up` command. See the [Task](#task-1) section above.
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`.
@ -159,10 +165,10 @@ services:
resources:
limits:
cpus: '4' # Maximum CPU count that the container can use
memory: 16G # Maximum memory that the container can use
memory: '16G' # Maximum memory that the container can use
reservations:
cpus: '2' # CPU count that the container initially requests
memory: 8G # Memory that the container initially request
memory: '8G' # Memory that the container initially request
```
@ -213,3 +219,9 @@ Run the DB console:
docker compose exec node node -db-console
```
Run the Quilibrium client:
```shell
docker compose exec node qclient help
docker compose exec node qclient token help
docker compose exec node qclient token balance
```

View File

@ -11,6 +11,10 @@ WORKDIR /opt/ceremonyclient/node
RUN go install ./...
RUN go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
WORKDIR /opt/ceremonyclient/client
RUN go build -o qclient ./main.go
FROM alpine:3.19
ARG NODE_VERSION
@ -34,6 +38,7 @@ COPY --from=build /go/bin/node /usr/local/bin
COPY --from=build /go/bin/grpcurl /usr/local/bin
COPY --from=build /opt/ceremonyclient/node/ceremony.json /root
COPY --from=build /opt/ceremonyclient/node/retroactive_peers.json /root
COPY --from=build /opt/ceremonyclient/client/qclient /usr/local/bin
WORKDIR /root

View File

@ -10,10 +10,10 @@ services:
deploy:
resources:
limits:
memory: 32G
memory: '32G'
reservations:
cpus: 12
memory: 16G
cpus: '12'
memory: '16G'
environment:
- DEFAULT_LISTEN_GRPC_MULTIADDR=/ip4/0.0.0.0/tcp/8337
- DEFAULT_LISTEN_REST_MULTIADDR=/ip4/0.0.0.0/tcp/8338
@ -23,7 +23,7 @@ services:
- '127.0.0.1:${QUILIBRIUM_GRPC_PORT:-8337}:8337/tcp' # gRPC
- '127.0.0.1:${QUILIBRIUM_REST_PORT:-8338}:8338/tcp' # REST
healthcheck:
test: ["CMD", "node", "--peer-id"]
test: ["CMD", "grpcurl", "-plaintext", "localhost:8337", "list", "quilibrium.node.node.pb.NodeService"]
interval: 30s
timeout: 5s
retries: 3