-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.toml
More file actions
184 lines (156 loc) · 5.77 KB
/
Copy pathMakefile.toml
File metadata and controls
184 lines (156 loc) · 5.77 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
## --- [ CARGO UPDATES ] ---------------------------------------------------------
[tasks.cargo-check-updates]
workspace = false
description = "List available dependency upgrades (read-only)"
install_crate = { crate_name = "cargo-upgrades", binary = "cargo-upgrades", test_arg = "--version" }
command = "cargo"
args = ["upgrades"]
[tasks.cargo-update]
workspace = false
description = "Upgrade dependency versions in Cargo.toml"
install_crate = { crate_name = "cargo-edit", binary = "cargo-upgrade", test_arg = "--version" }
command = "cargo"
args = ["upgrade"]
## --- [ DOCUMENTATION ] ---------------------------------------------------------
# Tasks related to building and serving documentation.
[tasks.docs-build]
workspace = false
description = "Build mdBook documentation"
command = "mdbook"
args = ["build"]
[tasks.docs-serve]
workspace = false
description = "Serve mdBook documentation on port 8001"
command = "mdbook"
args = ["serve", "--port", "8001"]
## --- [ FRONTEND ] --------------------------------------------------------------
# Tasks related to building and serving the frontend.
[tasks.frontend-install]
workspace = false
description = "Install frontend npm dependencies"
command = "npm"
args = ["install"]
cwd = "frontend"
[tasks.frontend-build]
workspace = false
description = "Build frontend production assets"
dependencies = ["frontend-install"]
command = "npm"
args = ["run", "build"]
cwd = "frontend"
[tasks.frontend-dev]
workspace = false
description = "Run Vite dev server with hot reload"
command = "npm"
args = ["run", "dev"]
cwd = "frontend"
[tasks.frontend-lint]
workspace = false
description = "Lint frontend code"
command = "npm"
args = ["run", "lint"]
cwd = "frontend"
## --- [ BITCOIN ] ---------------------------------------------------------------
# Tasks related to the Bitcoin Knots daemon.
[tasks.bitcoind]
workspace = false
description = "Start bitcoind-knots in regtest mode, piping logs to the journal (foreground)"
command = "bash"
args = ["./dev/run-bitcoind.sh"]
## --- [ BIN_CONSOLE ] -----------------------------------------------------------
## Full server: serves the React web frontend (HTTP) and gRPC backend together.
[tasks.console-assets-copy]
workspace = false
description = "Copy frontend build output to lib_web/assets"
dependencies = ["frontend-build"]
script_runner = "@shell"
script = '''
rm -rf backend/libs/lib_web/assets
cp -r frontend/dist backend/libs/lib_web/assets
'''
[tasks.console-dev]
workspace = false
description = "Build frontend, copy assets, start bitcoind in background, then watch and reload the full console server (frontend + backend)"
dependencies = ["console-assets-copy"]
script_runner = "@shell"
script = '''
./dev/run-bitcoind.sh &
BITCOIND_PID=$!
trap "kill $BITCOIND_PID 2>/dev/null" EXIT
cargo watch -w backend -x "run -p bin_console"
'''
[tasks.console-release]
workspace = false
description = "Build frontend, copy assets, then compile a release binary for the full console server"
dependencies = ["console-assets-copy"]
command = "cargo"
args = ["build", "-p", "bin_console", "--release"]
[tasks.console-run-release]
workspace = false
description = "Build frontend, copy assets, then run the release console server binary"
dependencies = ["console-assets-copy"]
command = "cargo"
args = ["run", "-p", "bin_console", "--release"]
## --- [BIN_BACKEND] -----------------------------------------------------------
## Backend-only RPC server: serves only the gRPC backend — no web frontend.
[tasks.backend-dev]
workspace = false
description = "Start bitcoind in background, then watch and reload the Backend RPC server on backend changes"
script_runner = "@shell"
script = '''
./dev/run-bitcoind.sh &
BITCOIND_PID=$!
trap "kill $BITCOIND_PID 2>/dev/null" EXIT
cargo watch -w backend -x "run -p bin_backend"
'''
# cargo watch -q -c -w backend -x "run -p bin_backend"
[tasks.backend-release]
workspace = false
description = "Compile a release binary for the Backend RPC server"
command = "cargo"
args = ["build", "-p", "bin_backend", "--release"]
[tasks.backend-run-release]
workspace = false
description = "Run the release Backend RPC server binary"
command = "cargo"
args = ["run", "-p", "bin_backend", "--release"]
## --- [ DOCKER ] ----------------------------------------------------------------
## Tasks related to building container images locally. All Dockerfiles use the
## workspace root as their build context (they reference frontend/, backend/,
## and docker/ paths), so these tasks intentionally do NOT set `cwd`.
[tasks.docker-build-backend]
workspace = false
description = "Build the bitnode-backend image (bin_backend: gRPC-only, headless)"
command = "docker"
args = ["build", "--format", "docker", "-f", "docker/Dockerfile.backend", "-t", "bitnode-backend:local", "."]
[tasks.docker-build-frontend]
workspace = false
description = "Build the bitnode-frontend image (React SPA served by nginx)"
command = "docker"
args = ["build", "--format", "docker", "-f", "docker/Dockerfile.frontend", "-t", "bitnode-frontend:local", "."]
[tasks.docker-build-console]
workspace = false
description = "Build the bitnode-console image (bin_console: HTTP + gRPC, embeds frontend)"
command = "docker"
args = ["build", "--format", "docker", "-f", "docker/Dockerfile.console", "-t", "bitnode-console:local", "."]
[tasks.docker-build-node]
workspace = false
description = "Build the bitnode-node image (console + Bitcoin Knots via supervisord)"
command = "docker"
args = [
"build",
"--format", "docker",
"-f", "docker/Dockerfile.node",
"--build-arg", "BITCOIN_KNOTS_VERSION=27.1.knots20240801",
"-t", "bitnode-node:local",
".",
]
[tasks.docker-build-all]
workspace = false
description = "Build all four bitnode container images locally"
dependencies = [
"docker-build-console",
"docker-build-backend",
"docker-build-frontend",
"docker-build-node",
]