mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-02-21 10:27:26 +08:00
feat: automate docker build and deploy workflows via Taskfile
This commit is contained in:
parent
bf5a96ce13
commit
1d978cf211
@ -34,53 +34,55 @@ sudo ufw reload
|
||||
Quilibrium nodes require a valid configuration and cryptographic keys to participate in the network. For containerized deployments, it is recommended to generate these separately from the main node execution.
|
||||
|
||||
### Generating Config
|
||||
You can use the `config-gen` utility included in the Docker image or build it from source.
|
||||
You can use the `config-gen` utility included
|
||||
|
||||
**Using Go (from repo root):**
|
||||
**Using Task (Recommended):**
|
||||
```bash
|
||||
go run ./utils/config-gen --config $(pwd)/.config
|
||||
task config:gen
|
||||
```
|
||||
|
||||
**Using Docker:**
|
||||
You can override the directory using `CONFIG_DIR`:
|
||||
```bash
|
||||
docker run --rm -it \
|
||||
--entrypoint config-gen \
|
||||
-v $(pwd)/.config:/root/.config \
|
||||
quilibrium --config /root/.config
|
||||
task config:gen CONFIG_DIR=/path/to/config
|
||||
```
|
||||
|
||||
## 3. Build from Source
|
||||
|
||||
Using `DOCKER_BUILDKIT`, we can build a highly optimized, slim image specifically for the node.
|
||||
|
||||
### The Build Command
|
||||
Navigate to your monorepo directory and execute:
|
||||
|
||||
**Using Task:**
|
||||
```bash
|
||||
task build:node:source
|
||||
```
|
||||
|
||||
**Using Docker directly:**
|
||||
```bash
|
||||
DOCKER_BUILDKIT=1 docker build \
|
||||
--target node-only \
|
||||
-f Dockerfile.source \
|
||||
--build-arg GIT_COMMIT=$(git log -1 --format=%h) \
|
||||
-t quilibrium \
|
||||
-t quilibrium:$(git describe --tags --abbrev=0 2>/dev/null || echo "latest") .
|
||||
-t quilibrium:node-only .
|
||||
```
|
||||
|
||||
### Why these flags?
|
||||
- `--target node-only`: Excludes unnecessary build tools from the final image.
|
||||
- `--build-arg GIT_COMMIT`: Embeds the specific version hash into the binary for network identification.
|
||||
- `-t quilibrium:tag`: Tags the image with a specific version for easy management and rollbacks.
|
||||
|
||||
## 4. Deployment
|
||||
|
||||
For servers with dedicated public IPs, **Host Networking** is the recommended deployment method. It eliminates Docker NAT overhead and ensures the node is easily reachable by peers.
|
||||
|
||||
### Run the Container
|
||||
|
||||
**Using Task:**
|
||||
```bash
|
||||
task deploy:node
|
||||
```
|
||||
|
||||
**Using Docker directly:**
|
||||
```bash
|
||||
docker run -d --name q-node \
|
||||
--network host \
|
||||
--restart unless-stopped \
|
||||
-v $(pwd)/.config:/root/.config \
|
||||
quilibrium -signature-check=false
|
||||
quilibrium:node-only -signature-check=false
|
||||
```
|
||||
|
||||
## 5. Managing the Container
|
||||
|
||||
@ -260,6 +260,9 @@ RUN apt-get update && apt-get install -y \
|
||||
libmpfr6 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV QUILIBRIUM_SIGNATURE_CHECK=true
|
||||
ENV GOEXPERIMENT=arenas
|
||||
|
||||
COPY --from=build-node /usr/bin/node /usr/local/bin/node
|
||||
WORKDIR /root
|
||||
ENTRYPOINT ["node"]
|
||||
@ -295,6 +298,7 @@ ARG GIT_BRANCH
|
||||
ARG GIT_COMMIT
|
||||
|
||||
ENV GOEXPERIMENT=arenas
|
||||
ENV QUILIBRIUM_SIGNATURE_CHECK=false
|
||||
|
||||
LABEL org.opencontainers.image.title="Quilibrium Network Node"
|
||||
LABEL org.opencontainers.image.description="Quilibrium is a decentralized alternative to platform as a service providers."
|
||||
|
||||
@ -168,3 +168,35 @@ tasks:
|
||||
desc: Test the Quilibrium docker image.
|
||||
cmds:
|
||||
- client/test/run_tests.sh -d 'ubuntu' -v '24.04'
|
||||
|
||||
config:gen:
|
||||
desc: Generate configuration and keys using Go.
|
||||
cmds:
|
||||
- go run ./utils/config-gen --config {{.CONFIG_DIR | default ".config"}}
|
||||
|
||||
|
||||
build:node:source:
|
||||
desc: Build the optimized Quilibrium node-only docker image.
|
||||
cmds:
|
||||
- |
|
||||
docker build \
|
||||
--target node-only \
|
||||
-f Dockerfile.source \
|
||||
--build-arg NODE_VERSION={{.VERSION}} \
|
||||
--build-arg GIT_REPO={{.GIT_REPO}} \
|
||||
--build-arg GIT_BRANCH={{.GIT_BRANCH}} \
|
||||
--build-arg GIT_COMMIT={{.GIT_COMMIT}} \
|
||||
-t ${QUILIBRIUM_IMAGE_NAME:-quilibrium}:{{.VERSION}}-node-only \
|
||||
-t ${QUILIBRIUM_IMAGE_NAME:-quilibrium}:node-only \
|
||||
.
|
||||
|
||||
deploy:node:
|
||||
desc: Run the Quilibrium node using host networking and external config.
|
||||
cmds:
|
||||
- |
|
||||
docker run -d --name q-node \
|
||||
--network host \
|
||||
--restart unless-stopped \
|
||||
-v {{.CONFIG_DIR | default "$(pwd)/.config"}}:/root/.config \
|
||||
${QUILIBRIUM_IMAGE_NAME:-quilibrium}:node-only \
|
||||
-signature-check=false
|
||||
|
||||
Loading…
Reference in New Issue
Block a user