-
Notifications
You must be signed in to change notification settings - Fork 153
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
242 lines (217 loc) · 8.32 KB
/
Taskfile.yaml
File metadata and controls
242 lines (217 loc) · 8.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# https://taskfile.dev
version: "3"
dotenv:
- ".env"
env:
DOCKER_BUILDKIT: '1'
vars:
VERSION:
sh: cat config/version.go | grep -A 1 "func GetVersion() \[\]byte {" | grep -Eo '0x[0-9a-fA-F]+' | xargs printf "%d.%d.%d"
GIT_REPO:
sh: git config --get remote.origin.url | sed 's/\.git$//'
GIT_BRANCH:
sh: git rev-parse --abbrev-ref HEAD
GIT_COMMIT:
sh: git log -1 --format=%h
MAX_KEY_ID: 17
tasks:
status:
desc: Display configuration info.
cmds:
- echo -n "Image name:" && echo " ${QUILIBRIUM_IMAGE_NAME:-quilibrium}"
- echo -n "Version :" && echo " {{.VERSION}}"
- echo -n "Repo :" && echo " {{.GIT_REPO}}"
- echo -n "Branch :" && echo " {{.GIT_BRANCH}}"
- echo -n "Commit :" && echo " {{.GIT_COMMIT}}"
- echo -n "Max Key ID:" && echo " {{.MAX_KEY_ID}}"
silent: true
build_node_arm64_macos:
desc: Build the Quilibrium node binary for MacOS ARM. Assumes it's ran from the same platform. Outputs to node/build.
cmds:
- vdf/generate.sh
- bls48581/generate.sh
- verenc/generate.sh
- bulletproofs/generate.sh
- ferret/generate.sh
- channel/generate.sh
- rpm/generate.sh
- node/build.sh -o build/arm64_macos/node
build_qclient_arm64_macos:
desc: Build the QClient node binary for MacOS ARM. Outputs to client/build
cmds:
- vdf/generate.sh
- bls48581/generate.sh
- verenc/generate.sh
- bulletproofs/generate.sh
- ferret/generate.sh
- channel/generate.sh
- rpm/generate.sh
- client/build.sh -o build/arm64_macos/qclient
backup:
desc: Create a backup file with the critical configuration files.
prompt: You will be prompted for root access. Make sure you verify the generated backup file. Continue?
preconditions:
- sh: 'test -d .config'
msg: '.config does not exists!'
- sh: 'test -f .config/config.yml'
msg: '.config/config.yml does not exists!'
- sh: 'test -f .config/keys.yml'
msg: '.config/keys.yml does not exists!'
- sh: '! test -f backup.tar.gz'
msg: 'A previous backup.tar.gz found in the current folder!'
sources:
- '.config/config.yml'
- '.config/keys.yml'
generates:
- 'backup.tar.gz'
cmds:
- |
export TMP_DIR=$(mktemp -d)
export TASK_DIR=$(pwd)
sudo cp .config/config.yml $TMP_DIR
sudo cp .config/keys.yml $TMP_DIR
sudo chown $(whoami):$(id -gn) $TMP_DIR/*
cd $TMP_DIR
tar -czf $TASK_DIR/backup.tar.gz *
cd $TASK_DIR
sudo rm -rf $TMP_DIR
echo "Backup saved to: backup.tar.gz"
echo "Do not assume you have a backup unless you verify it!!!"
silent: true
restore:
desc: Restores a backup file with the critical configuration files.
preconditions:
- sh: '! test -d .config'
msg: '.config already exists, restore cannot be performed safely!'
- sh: 'test -f backup.tar.gz'
msg: 'backup.tar.gz not found in the current folder!'
sources:
- 'backup.tar.gz'
generates:
- '.config/config.yml'
- '.config/keys.yml'
cmds:
- |
mkdir .config
tar -xzf backup.tar.gz -C .config
echo "Backup restored from: backup.tar.gz"
silent: true
test:port:
desc: Test if the P2P port is visible to the world.
preconditions:
- sh: 'test -x "$(command -v nc)"'
msg: 'nc is not installed, install with "sudo apt install netcat"'
- sh: 'test -n "$NODE_PUBLIC_NAME"'
msg: 'The public DNS name or IP address of the server must be set in NODE_PUBLIC_NAME.'
cmds:
- 'nc -vzu ${NODE_PUBLIC_NAME} ${QUILIBRIUM_P2P_PORT:=8336}'
build_node_arm64_linux:
desc: Build the Quilibrium node binary for ARM64 Linux. Outputs to node/build.
cmds:
- docker build --platform linux/arm64 -f docker/Dockerfile.source --output node/build/arm64_linux --target=node .
build_qclient_arm64_linux:
desc: Build the QClient node binary for ARM64 Linux. Outputs to client/build.
cmds:
- docker build --platform linux/arm64 -f docker/Dockerfile.source --output client/build/arm64_linux --target=qclient .
build_node_amd64_linux:
desc: Build the Quilibrium node binary for AMD64 Linux. Outputs to node/build.
cmds:
- docker build --platform linux/amd64 -f docker/Dockerfile.source --output node/build/amd64_linux --target=node .
build_conntest_amd64_linux:
desc: Build the Quilibrium node connection test binary for AMD64 Linux. Outputs to conntest/build.
cmds:
- docker build --platform linux/amd64 -f docker/Dockerfile.conntest.source --output conntest/build/amd64_linux --target=conntest .
build_node_amd64_avx512_linux:
desc: Build the Quilibrium node binary for AMD64 Linux with AVX-512 extensions. Outputs to node/build.
cmds:
- docker build --platform linux/amd64 -f docker/Dockerfile.sourceavx512 --output node/build/amd64_avx512_linux --target=node .
build_qclient_amd64_linux:
desc: Build the QClient node binary for AMD64 Linux. Outputs to client/build.
cmds:
- docker build --platform linux/amd64 -f docker/Dockerfile.source --output client/build/amd64_linux --target=qclient .
build_qclient_amd64_avx512_linux:
desc: Build the QClient node binary for AMD64 Linux with AVX-512 extensions. Outputs to client/build.
cmds:
- docker build --platform linux/amd64 -f docker/Dockerfile.sourceavx512 --output client/build/amd64_avx512_linux --target=qclient .
build:source:
desc: Build the Quilibrium docker image from source.
cmds:
- |
docker build \
-f docker/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}}-source \
-t ${QUILIBRIUM_IMAGE_NAME:-quilibrium}:source \
.
status:
- |
docker image inspect \
${QUILIBRIUM_IMAGE_NAME:-quilibrium}:{{.VERSION}}-source \
>/dev/null 2>/dev/null
build:release:
desc: Build the Quilibrium docker image from release binaries.
aliases:
- build
cmds:
- |
docker build \
-f docker/Dockerfile.release \
--build-arg NODE_VERSION={{.VERSION}} \
--build-arg GIT_REPO={{.GIT_REPO}} \
--build-arg GIT_BRANCH={{.GIT_BRANCH}} \
--build-arg GIT_COMMIT={{.GIT_COMMIT}} \
--build-arg MAX_KEY_ID={{.MAX_KEY_ID}} \
-t ${QUILIBRIUM_IMAGE_NAME:-quilibrium}:{{.VERSION}}-release \
-t ${QUILIBRIUM_IMAGE_NAME:-quilibrium}:release \
.
status:
- |
docker image inspect \
${QUILIBRIUM_IMAGE_NAME:-quilibrium}:{{.VERSION}}-release \
>/dev/null 2>/dev/null
docker:login:
desc: Login to Docker hub
aliases:
- login
cmds:
- echo $DOCKER_TOKEN | docker login -u $DOCKER_USERNAME --password-stdin
push:
desc: Push Quilibrium docker image to the container registry.
cmds:
- docker push ${QUILIBRIUM_IMAGE_NAME:-quilibrium}:{{.VERSION}}
- docker push ${QUILIBRIUM_IMAGE_NAME:-quilibrium}:latest
test:qclient:
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 docker/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