mirror of
				https://source.quilibrium.com/quilibrium/ceremonyclient.git
				synced 2025-11-03 23:47:27 +00:00 
			
		
		
		
	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:
		
							parent
							
								
									de115fbfad
								
							
						
					
					
						commit
						6068cd8f26
					
				@ -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`.
 | 
					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
 | 
					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
 | 
					source code, nor the Go development environment. The image also has the `grpcurl` tool that can be used to
 | 
				
			||||||
query the gRPC interface.
 | 
					query the gRPC interface.
 | 
				
			||||||
@ -105,6 +108,9 @@ Run Quilibrium in a container:
 | 
				
			|||||||
docker compose up -d
 | 
					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.
 | 
					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`.
 | 
					Make sure you backup `config.yml` and `keys.yml`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -159,10 +165,10 @@ services:
 | 
				
			|||||||
      resources:
 | 
					      resources:
 | 
				
			||||||
        limits:
 | 
					        limits:
 | 
				
			||||||
          cpus: '4'  # Maximum CPU count that the container can use
 | 
					          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:
 | 
					        reservations:
 | 
				
			||||||
          cpus: '2'  # CPU count that the container initially requests
 | 
					          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
 | 
					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
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
@ -11,6 +11,10 @@ WORKDIR /opt/ceremonyclient/node
 | 
				
			|||||||
RUN go install ./...
 | 
					RUN go install ./...
 | 
				
			||||||
RUN go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
 | 
					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
 | 
					FROM alpine:3.19
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ARG NODE_VERSION
 | 
					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 /go/bin/grpcurl /usr/local/bin
 | 
				
			||||||
COPY --from=build /opt/ceremonyclient/node/ceremony.json /root
 | 
					COPY --from=build /opt/ceremonyclient/node/ceremony.json /root
 | 
				
			||||||
COPY --from=build /opt/ceremonyclient/node/retroactive_peers.json /root
 | 
					COPY --from=build /opt/ceremonyclient/node/retroactive_peers.json /root
 | 
				
			||||||
 | 
					COPY --from=build /opt/ceremonyclient/client/qclient /usr/local/bin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
WORKDIR /root
 | 
					WORKDIR /root
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -10,10 +10,10 @@ services:
 | 
				
			|||||||
    deploy:
 | 
					    deploy:
 | 
				
			||||||
      resources:
 | 
					      resources:
 | 
				
			||||||
        limits:
 | 
					        limits:
 | 
				
			||||||
          memory: 32G
 | 
					          memory: '32G'
 | 
				
			||||||
        reservations:
 | 
					        reservations:
 | 
				
			||||||
          cpus: 12
 | 
					          cpus: '12'
 | 
				
			||||||
          memory: 16G
 | 
					          memory: '16G'
 | 
				
			||||||
    environment:
 | 
					    environment:
 | 
				
			||||||
      - DEFAULT_LISTEN_GRPC_MULTIADDR=/ip4/0.0.0.0/tcp/8337
 | 
					      - DEFAULT_LISTEN_GRPC_MULTIADDR=/ip4/0.0.0.0/tcp/8337
 | 
				
			||||||
      - DEFAULT_LISTEN_REST_MULTIADDR=/ip4/0.0.0.0/tcp/8338
 | 
					      - 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_GRPC_PORT:-8337}:8337/tcp' # gRPC
 | 
				
			||||||
      - '127.0.0.1:${QUILIBRIUM_REST_PORT:-8338}:8338/tcp' # REST
 | 
					      - '127.0.0.1:${QUILIBRIUM_REST_PORT:-8338}:8338/tcp' # REST
 | 
				
			||||||
    healthcheck:
 | 
					    healthcheck:
 | 
				
			||||||
      test: ["CMD", "node", "--peer-id"]
 | 
					      test: ["CMD", "grpcurl", "-plaintext", "localhost:8337", "list", "quilibrium.node.node.pb.NodeService"]
 | 
				
			||||||
      interval: 30s
 | 
					      interval: 30s
 | 
				
			||||||
      timeout: 5s
 | 
					      timeout: 5s
 | 
				
			||||||
      retries: 3
 | 
					      retries: 3
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user