-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbb.edn
374 lines (288 loc) · 10.2 KB
/
bb.edn
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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
{:paths ["src/babashka" "src/shared"]
:tasks
{:requires
([babashka.fs :as fs]
[clojure.string :as string]
[clj-yaml.core :as yaml]
[cheshire.core :as json]
[dinsro.commands :as c]
[dinsro.site :as site]
[dinsro.helm.bitcoind :as h.bitcoind]
[dinsro.helm.dinsro :as h.dinsro]
[dinsro.helm.lnd :as h.lnd]
[dinsro.helm.nbxplorer :as h.nbxplorer]
[dinsro.helm.rtl :as h.rtl]
[dinsro.helm.specter :as h.specter])
_8
{:doc "Summons bot"
:task (c/eight)}
all
{:depends [init install]}
build-dev-image
{:doc "Build dev image"
:task (c/earthly :dev-image)}
build-image
{:doc "Build production image"
:task (c/earthly :image {:interactive true})}
build-production
{:depends [compile-production-cljs package-jar]}
ci
{:task (c/earthly :ci {:interactive false
:privileged true})}
ci-local
{:depends [kondo check test eastwood]}
clean
{:doc "Clean all the things"
:task (do
(shell "rm -rf resources/main/public/js")
(shell "rm -rf resources/main/public/js")
(shell "rm -rf resources/workspaces/public/js")
(shell "rm -rf .shadow-cljs/builds")
(shell "rm -rf classes/*")
(shell "rm -rf target"))}
clean-data
{:doc "Cleans the database"
:task (shell "rm -rf data")}
clean-semantic
{:task (c/clean-semantic)}
clean-kondo-cache
{:tasks (shell "rm -rf .clj-kondo/.cache")}
clean-styles
{:tasks (shell "rm -rf resources/main/public/themes")}
check
{:doc "Check sources are formatted correctly"
:task (c/cljfmt ["src" "deps.edn" "shadow-cljs.edn"])}
compile
{:doc "Compile all source files"
:depends [compile-clj compile-cljs]}
compile-clj
{:doc "Compile clojure source files"
:depends [init]}
compile-cljs
{:doc "Compile clojurescript source files"
:depends [init]
:task (c/compile-cljs)}
compile-styles
{:task (shell "npm run build:sass")}
compile-production
{:doc "Compile all source files for production"
:depends [compile-production-clj compile-production-cljs]}
compile-production-clj
{:doc "Compile clojure source files for production"
:task (println "nop")}
compile-production-cljs
{:doc "Compile clojurescript source files for production"
:depends [install]
:task (clojure "-M:shadow-cljs release main")}
dev
{:doc "Build and start development server via docker"
:depends [purge-dev-image build-dev-image start-dev]}
dev2
{:depends [generate-dinsro-values]
:task (shell "tilt up --legacy=true")}
dev-bootstrap
{:doc "DOCKER-ONLY: Start clojurescript watch and main server"
:task (c/dev-bootstrap)}
dev-bootstrap-user
{:doc "DOCKER-ONLY: Start clojurescript watch and main server as user"
:task (c/dev-bootstrap-user)}
devcards-server
{:task (shell "bb watch-devcards")}
dinsro-values
{:doc "Display site config"
:task (do (println (h.dinsro/->dinsro-config (site/get-site-config))))}
dispatch
{:doc "Send a signal over nrepl"
:task (clojure (str "-Mdispatch -m dinsro.components.dispatch "
(string/join " " (map (fn [x] (str "\"" x "\"")) *command-line-args*))))}
display-path
{:doc "Display dependency trees for each alias"
:task (doseq [alias ["cljfmt" "dev" "eastwood" "kibit" "production" "notebooks"
"shadow-cljs" "test"]]
(shell (str "clojure -A:" alias " -Stree")))}
docs
{:task (clojure "-X:codox:notebooks:test")}
e2e
{:doc "Run end to end testing"
:task (earthly :e2e {:privileged true})}
eastwood
{:doc "Lint source code with eastwood"
:task (clojure "-M:dev:test:eastwood '{:source-paths [\"src/main\" \"src/test\"]}'")}
format
{:doc "Format source files"
:task (clojure "-M:cljfmt fix src deps.edn shadow-cljs.edn --indents indentation.edn")}
funnel
{:task (clojure "-M:funnel -vvv")}
generate-bitcoind-values
{:doc "generate a bitcoind values file"
:task
(let [name (or (first *command-line-args*) "3")
options (h.bitcoind/->value-options {:name name})
yaml (yaml/generate-string (h.bitcoind/->values options))]
(c/mkdir (format "target/conf/%s" name))
(spit (format "target/conf/%s/bitcoind_values.yaml" name) yaml))}
generate-dinsro-values
{:doc "generate a dinsro values file"
:task (c/generate-dinsro-values)}
generate-fileserver-values
{:doc "generate a fileserver values file"
:task (let [name (or (first *command-line-args*) "3")] (c/generate-fileserver-values name))}
generate-lnd-values
{:doc "generate a lnd values file"
:task (let [name (or (first *command-line-args*) "3")] (c/generate-lnd-values name))}
generate-nbxplorer-values
{:doc "generate a nbxplorer values file"
:task (let [name (or (first *command-line-args*) "3")] (c/generate-nbxplorer-values name))}
generate-nostr-rs-relay-values
{:doc "generate a nostr-rs-relay values file"
:task (c/generate-nostr-rs-relay-values)}
generate-nostream-values
{:doc "generate a nostream values file"
:task (c/generate-nostream-values)}
generate-rtl-values
{:doc "generate a rtl values file"
:task (let [name (or (first *command-line-args*) "3")] (c/generate-rtl-values name))}
generate-specter-values
{:doc "generate a specter values file"
:task (let [name (or (first *command-line-args*) "3")] (c/generate-specter-values name))}
generate-values
{:doc "generate all values"
:task (c/generate-values)}
helm-bitcoin
{:depends [generate-bitcoind-values]
:task (let [name (or (first *command-line-args*) "3")] (c/helm-bitcoin name))}
helm-dinsro
{:depends [generate-dinsro-values]
:task (c/helm-dinsro)}
helm-fileserver
{:depends [generate-fileserver-values]
:task (let [name (or (first *command-line-args*) "3")] (c/helm-fileserver name))}
helm-lnd
{:depends [generate-lnd-values]
:task (let [name (or (first *command-line-args*) "3")] (c/helm-lnd name))}
helm-nbxplorer
{:depends [generate-nbxplorer-values]
:task (let [name (or (first *command-line-args*) "3")] (c/helm-nbxplorer name))}
helm-nostr-rs-relay
{:depends [generate-nostr-rs-relay-values]
:task (c/helm-nostr-rs-relay)}
helm-nostream
{:depends [generate-nostream-values]
:task (c/helm-nostream)}
helm-rtl
{:depends [generate-rtl-values]
:task (let [name (or (first *command-line-args*) "3")] (c/helm-rtl name))}
helm-specter
{:depends [generate-specter-values]
:task (let [name (or (first *command-line-args*) "3")] (c/helm-specter name))}
init
{:doc "Initialize the system"
:depends [install init-bb]}
init-bb
{:doc "Initialize babashka"
;; While simple, this command has the side-effect of ensuring that all the
;; libraries are ready to be loaded.
:task (clojure "-e" ":compiled")}
install
{:doc "Install js dependencies"
:task (shell "yarn install --frozen-lockfile")}
install-style-dependencies
{:task (shell "sh -c \"cd node_modules/fomantic-ui; npx gulp install\"")}
kibit
{:doc "Lint source code with kibit"
:task (clojure "-M:dev:notebooks:kibit --paths src/main,src/test")}
kondo
{:doc "Lint source code with clj-kondo"
:task (shell "npx clj-kondo --parallel --lint \"src/main:src/test:src/babashka:src/dev:src/dispatch:src/notebooks:src/notebook-utils:src/shared:src/shared-cards\"")}
lint
{:depends [kondo eastwood kibit]}
outdated
{:task (clojure " -Moutdated")}
package-jar
{:doc "Build production jar"
:task (clojure "-T:build:notebooks uber")}
prepare-test-dirs
{:doc "Build test data directory"
:task (c/mkdir "/tmp/dinsro/data/test")}
repl
{:override-builtin true
:task (clojure.main/repl)}
restart
{:doc "Send a restart signal over nrepl"
:task
(binding [*command-line-args* '("(restart)")]
(run 'dispatch))}
run
{:doc "Run server in dev mode"
:override-builtin true
:task (clojure "-M:dev:notebooks:guardrails:dev-main")}
run-dev-image
{:task
(do
(c/earthly :image-dev)
(shell "docker run -p 3000:3000 -p 9630:9630 -e WATCH_SOURCES=true duck1123/dinsro:dev-latest"))}
run-docs
{:task
(do
(c/earthly :docs-image)
(shell "docker run -p 3000:3000 duck1123/dinsro:docs-latest"))}
bash-dev-image
{:task
(do
(c/earthly :image-dev)
(shell "docker run -it -p 3000:3000 duck1123/dinsro:dev-latest bash"))}
purge-dev-image
{:doc "Purge the current devimage"
:task (shell "devspace run devimage-purge")}
run-production
{:doc "Run server from jar"
:task (shell "clojure -T:build:notebooks run")}
seed
{:doc "Seed the database over nrepl"
:task (c/dispatch ["(dinsro.components.seed/seed-db!)"])}
server
{:doc "compile and run server in dev mode"
:depends [compile run]}
start-dev
{:doc "Start development"
:task (shell "devspace run dev-all")}
start-production
{:doc "Start development"
:depends [build-production run-production]}
tap
{:task (c/tap (first *command-line-args*))}
test
{:doc "Run all tests"
:depends [test-clj]}
test-clj
{:doc "Run clojure tests"
:task (shell "bin/kaocha clj --profile verbose")}
test-cljs
{:doc "Run clojurescript tests"
:task (shell "bin/kaocha cljs --profile ci")}
tilt-config
{:doc "generates a config file for Tilt"
:task (println (c/->tilt-config))}
update-chart
{:doc "Copy dinsro chart files to chart.kronkltd.net repository"
:task
(do
(shell "helm-docs -c resources/helm/dinsro")
(if (fs/exists? "../chart.kronkltd.net/stable/dinsro")
(do
(fs/delete-tree "../chart.kronkltd.net/stable/dinsro")
(fs/copy-tree "./resources/helm/dinsro" "../chart.kronkltd.net/stable/dinsro"))
(println "Target directory does not exist. Do you have a copy of the chart.kronkltd.net repo checked out next to this repo?")))}
watch
{:depends [watch-cljs]}
watch-devcards
{:task (c/watch-cljs ["devcards"])}
watch-styles
{:doc "watch and compile css styles"
:task (shell "npm run watch:sass")}
watch-cljs
{:do "watch and compile css"
:task (c/watch-cljs ["main" "workspaces" "notebooks" "test"])}
workspaces
{:doc "Starts and watches for workspaces"
:task (c/workspaces)}}}