-
Notifications
You must be signed in to change notification settings - Fork 88
/
Makefile.toml
705 lines (607 loc) · 24.3 KB
/
Makefile.toml
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
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
# List of top-level tasks intended for use:
#
# - `cargo make dev-flow` or just `cargo make`: runs a full development flow, including fixing format and clippy, building and running tests and generating OpenAPI specs
# - `cargo make build`: builds everything in debug mode
# - `cargo make build-release`: builds everything in release mode. customizable with PLATFORM_OVERRIDE env variable for docker builds
# - `cargo make check`: runs rustfmt and clippy checks without applying any fix
# - `cargo make fix`: runs rustfmt and clippy checks and applies fixes
# - `cargo make unit-tests`: runs unit tests only
# - `cargo make worker-executor-tests`: runs worker executor tests only
# - `cargo make integration-tests`: runs integration tests only
# - `cargo make cli-tests`: runs CLI tests only
# - `cargo make sharding-tests`: runs sharding integration tests only
# - `cargo make sharding-tests-debug`: runs sharding integration tests with file logging enabled, also accepts test name filter arguments
# - `cargo make test`: runs all unit tests, worker executor tests and integration tests
# - `cargo make check-openapi`: generates openapi spec from the code and checks if it is the same as the one in the openapi directory (for CI)
# - `cargo make generate-openapi`: generates openapi spec from the code and saves it to the openapi directory
# - `cargo make publish`: publishes packages to crates.io
# - `cargo make run`: runs all services locally, requires redis, lnav and nginx
# - `cargo make check-configs`: generates configs from code deafults and checks if it is up-to-date
# - `cargo make generate-configs`: generates configs from code defaults
# - `cargo make elastic-up`: starts elastic, kibana, filebeat (in detached mode) and loads logs into elastic
# - `cargo make elastic-stop`: stops the elastic env
# - `cargo make elastic-down`: stops and removes the elastic env, including all stored data
[config]
default_to_workspace = false # by default, we run cargo commands on top level instead of per member
skip_core_tasks = true # we are not using the predefined cargo-make flows, instead redefine here for more clarity
[env]
JUNIT_OPTS = ""
AWS_EC2_METADATA_DISABLED = "true"
[env.ci]
CARGO_INCREMENTAL = "false"
# CARGO_LOG="cargo::core::compiler::fingerprint=trace"
JUNIT_OPTS = "--format junit --logfile target/report.xml"
[tasks.default]
description = "This is the task that gets executed by 'cargo make' when no task is specified"
run_task = "dev-flow"
[tasks.dev]
description = "Alias to the dev-flow task"
alias = "dev-flow"
[tasks.dev-flow]
description = "Runs a full development flow, including fixing format and clippy, building and running tests"
dependencies = [
"fix",
"check",
"build",
# "test"
]
[tasks.build]
description = "Builds everything in debug mode"
command = "cargo"
args = ["build", "--workspace", "--all-targets"]
[tasks.build-bins-non-ci]
condition = { env_not_set = [
"CI",
] } # on CI we always 'cargo make build' first so no need to recompile bins
run_task = "build-bins"
[tasks.build-bins]
description = "Builds all executables in debug mode"
command = "cargo"
args = ["build", "--workspace", "--bins"]
[tasks.build-worker-service]
description = "Builds the worker-service"
command = "cargo"
args = ["build", "-p", "golem-worker-service"]
[tasks.build-component-service]
description = "Builds the component-service"
command = "cargo"
args = ["build", "-p", "golem-component-service"]
[tasks.build-release]
description = """This is the top-level task that builds everything in release mode. PLATFORM_OVERRIDE env variable can be used
to build for other target than the current one, can be linux/amd64 or linux/arm64. This is used for cross-compiling
for docker images."""
dependencies = [
"set-version",
"build-release-default",
"build-release-override-linux-amd64",
"build-release-override-linux-arm64",
]
# There are three variants of build-release, and only one of them will run based on the value of
# the PLATFORM_OVERRIDE environment variable
[tasks.build-release-default]
description = "Build the project in release mode"
condition = { env_not_set = ["PLATFORM_OVERRIDE"] }
command = "cargo"
args = ["build", "--release"]
[tasks.build-release-override-linux-amd64]
description = "Build the project in release mode with target platform override to linux/amd64"
condition = { env = { "PLATFORM_OVERRIDE" = "linux/amd64" } }
command = "cargo"
args = ["build", "--release", "--target", "x86_64-unknown-linux-gnu"]
[tasks.build-release-override-linux-arm64]
description = "Build the project in release mode with target platform override to linux/arm64"
condition = { env = { "PLATFORM_OVERRIDE" = "linux/arm64" } }
install_crate = "cross"
command = "cross"
args = ["build", "--release", "--target", "aarch64-unknown-linux-gnu"]
## ** CHECK **
[tasks.check]
description = "Runs rustfmt and clippy checks without applying any fix"
dependencies = ["check-clippy", "check-rustfmt"]
[tasks.check-rustfmt]
description = "Runs rustfmt checks without applying any fix"
install_crate = "rustfmt"
command = "cargo"
args = ["fmt", "--all", "--", "--check"]
[tasks.check-clippy]
description = "Runs clippy checks without applying any fix"
install_crate = "clippy"
command = "cargo"
args = ["clippy", "--all-targets", "--", "--no-deps", "-Dwarnings"]
## ** FIX **
[tasks.fix]
description = "Runs rustfmt and clippy checks and applies fixes"
dependencies = ["fix-clippy", "fix-rustfmt"]
[tasks.fix-rustfmt]
description = "Runs rustfmt checks and applies fixes"
install_crate = "rustfmt"
command = "cargo"
args = ["fmt", "--all"]
[tasks.fix-clippy]
description = "Runs clippy checks and applies fixes"
install_crate = "clippy"
command = "cargo"
args = [
"clippy",
"--fix",
"--allow-dirty",
"--allow-staged",
"--",
"--no-deps",
"-Dwarnings",
]
## ** TEST **
[tasks.test]
description = "Runs all unit tests, worker executor tests and integration tests"
dependencies = [
"unit-tests",
"worker-executor-tests",
"cli-tests",
"sharding-tests",
"integration-tests",
]
[tasks.unit-tests]
description = "Runs unit tests only"
script = '''
cargo test --workspace --lib --all-features --exclude wasm-rpc-stubgen-tests-integration -- --nocapture --report-time $JUNIT_OPTS
cargo test -p golem-wasm-ast --tests --all-features -- --nocapture --report-time $JUNIT_OPTS
'''
[tasks.worker-executor-tests]
description = "Runs worker executor tests only"
env = { "WASMTIME_BACKTRACE_DETAILS" = "1", "RUST_BACKTRACE" = "1", "RUST_LOG" = "info" }
command = "cargo"
args = [
"test",
"--package",
"golem-worker-executor-base",
"--test",
"*",
"--",
"--nocapture",
]
[tasks.worker-executor-tests-group1]
description = "Runs worker executor tests only (group 1/8)"
env = { "RUST_BACKTRACE" = "1", "WASMTIME_BACKTRACE_DETAILS" = "1", "RUST_LOG" = "info", "RUST_TEST_TIME_INTEGRATION" = "5000,30000" }
script = '''
cargo test --package golem-worker-executor-base --test integration :tag: -- --nocapture --report-time $JUNIT_OPTS
cargo test --package golem-worker-executor-base --test integration :tag:group1 -- --nocapture --report-time $JUNIT_OPTS
'''
[tasks.worker-executor-tests-group2]
description = "Runs worker executor tests only (group 2/8)"
env = { "RUST_BACKTRACE" = "1", "WASMTIME_BACKTRACE_DETAILS" = "1", "RUST_LOG" = "info", "RUST_TEST_TIME_INTEGRATION" = "5000,30000" }
script = '''
cargo test --package golem-worker-executor-base --test integration :tag:group2 -- --nocapture --report-time $JUNIT_OPTS
'''
[tasks.worker-executor-tests-group3]
description = "Runs worker executor tests only (group 3/8)"
env = { "RUST_BACKTRACE" = "1", "WASMTIME_BACKTRACE_DETAILS" = "1", "RUST_LOG" = "info", "RUST_TEST_TIME_INTEGRATION" = "5000,30000" }
script = '''
cargo test --package golem-worker-executor-base --test integration :tag:group3 -- --nocapture --report-time $JUNIT_OPTS
'''
[tasks.worker-executor-tests-group4]
description = "Runs worker executor tests only (group 4/8)"
env = { "RUST_BACKTRACE" = "1", "WASMTIME_BACKTRACE_DETAILS" = "1", "RUST_LOG" = "info", "RUST_TEST_TIME_INTEGRATION" = "5000,30000" }
script = '''
cargo test --package golem-worker-executor-base --test integration :tag:group4 -- --nocapture --report-time $JUNIT_OPTS --test-threads=1
'''
# NOTE: temporarily set test-threads=1 to debug flakyness
[tasks.worker-executor-tests-group5]
description = "Runs worker executor tests only (group 5/8)"
env = { "RUST_BACKTRACE" = "1", "WASMTIME_BACKTRACE_DETAILS" = "1", "RUST_LOG" = "info", "RUST_TEST_TIME_INTEGRATION" = "5000,30000" }
script = '''
cargo test --package golem-worker-executor-base --test integration :tag:group5 -- --nocapture --report-time $JUNIT_OPTS
'''
[tasks.worker-executor-tests-group6]
description = "Runs worker executor tests only (group 6/8)"
env = { "RUST_BACKTRACE" = "1", "WASMTIME_BACKTRACE_DETAILS" = "1", "RUST_LOG" = "info", "RUST_TEST_TIME_INTEGRATION" = "5000,30000" }
script = '''
cargo test --package golem-worker-executor-base --test integration :tag:group6 -- --nocapture --report-time $JUNIT_OPTS
'''
[tasks.worker-executor-tests-group7]
description = "Runs worker executor tests only (group 7/8)"
env = { "RUST_BACKTRACE" = "1", "WASMTIME_BACKTRACE_DETAILS" = "1", "RUST_LOG" = "info", "RUST_TEST_TIME_INTEGRATION" = "5000,30000" }
script = '''
cargo test --package golem-worker-executor-base --test integration :tag:group7 -- --nocapture --report-time $JUNIT_OPTS
'''
[tasks.worker-executor-tests-group8]
description = "Runs worker executor tests only (group 8/8)"
env = { "RUST_BACKTRACE" = "1", "WASMTIME_BACKTRACE_DETAILS" = "1", "RUST_LOG" = "info", "RUST_TEST_TIME_INTEGRATION" = "5000,30000" }
script = '''
cargo test --package golem-worker-executor-base --test integration :tag:group8 -- --nocapture --report-time $JUNIT_OPTS
'''
[tasks.integration-tests]
description = "Runs integration tests only"
dependencies = ["build-bins"]
env = { "RUST_LOG" = "info", "RUST_BACKTRACE" = "1" }
script = '''
cargo test --package integration-tests --test integration -- --nocapture --report-time $JUNIT_OPTS
cargo test --package golem-component-service-base --test tests -- --nocapture --report-time $JUNIT_OPTS
cargo test --package golem-worker-service-base --test services_tests -- --nocapture --report-time $JUNIT_OPTS
cargo test --package golem-worker-service-base --test api_gateway_end_to_end_tests -- --nocapture --report-time $JUNIT_OPTS
cargo test --package golem-service-base --test integration -- --nocapture --report-time $JUNIT_OPTS
cargo test --package wasm-rpc-stubgen-tests-integration --tests -- --nocapture --test-threads=1 --report-time
'''
# $JUNIT_OPTS temporarily removed from wasm-rpc-stubgen-tests-integration to help debugging on CI
[tasks.sharding-tests]
description = "Runs sharding integration tests only"
dependencies = ["build-bins"]
env = { "RUST_LOG" = "info", "RUST_BACKTRACE" = "1" }
script = '''
cargo test --package integration-tests --test sharding -- --report-time
'''
# $JUNIT_OPTS temporarily removed to help debugging on CI
[tasks.sharding-tests-debug]
dependencies = ["build-bins"]
script = '''
rm -rf logs data
mkdir -pv logs data
export RUST_LOG=info,golem_test_framework::components=WARN
export RUST_BACKTRACE=1
export GOLEM__TRACING__FILE_DIR=../logs
export GOLEM__TRACING__FILE_TRUNCATE=false
export GOLEM__TRACING__FILE__ENABLED=true
cargo test \
--package integration-tests \
--test sharding ${@} \
-- --nocapture --test-threads=1
'''
[tasks.cli-tests]
description = "Runs CLI tests only"
dependencies = ["build-bins"]
env = { "RUST_LOG" = "info", "RUST_BACKTRACE" = "1" }
script = '''
cargo test --package golem-cli --test integration -- --test-threads=1 --report-time $JUNIT_OPTS
'''
## ** CHECK-OPENAPI **
[tasks.check-openapi]
description = "Generates openapi spec from the code and checks if it is the same as the ones in the openapi directory"
dependencies = [
"build-bins-non-ci",
"generate-worker-service-openapi",
"generate-component-service-openapi",
"merge-openapi",
"diff-openapi",
]
[tasks.diff-openapi]
description = "Checks if the generated openapi spec is the same as the one in the openapi directory"
dependencies = ["merge-openapi"]
script = '''
if diff openapi/golem-service.yaml target/golem-service.yaml >/dev/null 2>&1
then
echo "Latest Golem OpenAPI spec version detected."
else
echo "openapi/golem-service.yaml is not the same as produced by golem-service-yaml." 1>&2
echo "Run cargo make generate-openapi to generate new spec." 1>&2
exit 1
fi
'''
## ** GENERATE-OPENAPI **
[tasks.generate-openapi]
dependencies = [
"build-worker-service",
"build-component-service",
"generate-worker-service-openapi",
"generate-component-service-openapi",
"merge-openapi",
"store-openapi",
]
description = "Generates openapi spec from the code and saves it to the openapi directory"
[tasks.generate-worker-service-openapi]
description = "Generates openapi spec for worker service"
cwd = "./target/debug"
script = '''
mkdir -pv ../data
./golem-worker-service --dump-openapi-yaml > ../golem-worker-service.yaml
'''
[tasks.generate-component-service-openapi]
description = "Generates openapi spec for component service"
cwd = "./target/debug"
script = '''
mkdir -pv ../data
./golem-component-service --dump-openapi-yaml > ../golem-component-service.yaml
'''
[tasks.merge-openapi]
install_crate = { crate_name = "golem-openapi-client-generator", version = "0.0.10" }
dependencies = [
"generate-worker-service-openapi",
"generate-component-service-openapi",
]
command = "golem-openapi-client-generator"
args = [
"merge",
"--spec-yaml",
"./target/golem-component-service.yaml",
"./target/golem-worker-service.yaml",
"--output-yaml",
"./target/golem-service.yaml",
]
[tasks.store-openapi]
description = "Stores the generated openapi spec in the openapi directory"
dependencies = ["merge-openapi"]
command = "cp"
args = ["-v", "./target/golem-service.yaml", "./openapi/golem-service.yaml"]
## ** PUBLISH **
[tasks.publish]
description = "Publishes packages to crates.io"
dependencies = [
"build-release",
"publish-golem-wasm-ast",
"publish-golem-wasm-rpc",
"publish-golem-wasm-rpc-stubgen",
"publish-golem-api-grpc",
"publish-golem-rib",
"publish-golem-common",
"publish-golem-client",
"publish-golem-service-base",
"publish-golem-test-framework",
"publish-golem-cli",
]
[tasks.set-version]
description = "Sets the version in all Cargo.toml files to the value of the VERSION environment variable"
condition = { env_set = ["VERSION"] }
script = '''
grep -rl --include 'Cargo.toml' '0\.0\.0' | xargs sed -i "s/0\.0\.0/${VERSION}/g"
'''
[tasks.set-version.mac]
condition = { env_set = ["VERSION"] }
script = '''
grep -rl --include '.*Cargo\.toml' '0\.0\.0' | xargs sed -i "" "s/0\.0\.0/${VERSION}/g"
'''
[tasks.set-version.windows]
script_runner = "powershell"
script_extension = "ps1"
condition = { env_set = ["VERSION"] }
script = '''
$cargoFiles = Get-ChildItem . Cargo.toml -rec
foreach ($file in $cargoFiles)
{
(Get-Content $file.PSPath) |
Foreach-Object { $_ -replace "0.0.0", $Env:VERSION } |
Set-Content $file.PSPath
}
'''
[tasks.publish-golem-wasm-ast]
description = "Publishes golem-wasm-ast package to crates.io"
command = "cargo"
args = [
"publish",
"-p",
"golem-wasm-ast",
"--all-features",
"--allow-dirty",
"--no-verify",
]
[tasks.publish-golem-wasm-rpc]
description = "Publishes golem-wasm-rpc package to crates.io"
command = "cargo"
args = [
"publish",
"-p",
"golem-wasm-rpc",
"--all-features",
"--allow-dirty",
"--no-verify",
]
[tasks.publish-golem-wasm-rpc-stubgen]
description = "Publishes golem-wasm-rpc-stubgen package to crates.io"
command = "cargo"
args = [
"publish",
"-p",
"golem-wasm-rpc-stubgen",
"--all-features",
"--allow-dirty",
"--no-verify",
]
[tasks.publish-golem-client]
description = "Publishes golem-client package to crates.io"
command = "cargo"
args = ["publish", "-p", "golem-client", "--all-features", "--allow-dirty"]
[tasks.publish-golem-api-grpc]
description = "Publishes golem-api-grpc package to crates.io"
command = "cargo"
args = [
"publish",
"-p",
"golem-api-grpc",
"--all-features",
"--allow-dirty",
"--no-verify",
]
[tasks.publish-golem-common]
description = "Publishes golem-common package to crates.io"
command = "cargo"
args = [
"publish",
"-p",
"golem-common",
"--all-features",
"--allow-dirty",
"--no-verify",
]
[tasks.publish-golem-service-base]
description = "Publishes golem-service-base package to crates.io"
command = "cargo"
args = [
"publish",
"-p",
"golem-service-base",
"--all-features",
"--allow-dirty",
"--no-verify",
]
[tasks.publish-golem-test-framework]
description = "Publishes golem-test-framework package to crates.io"
command = "cargo"
args = [
"publish",
"-p",
"golem-test-framework",
"--all-features",
"--allow-dirty",
"--no-verify",
]
[tasks.publish-golem-cli]
description = "Publishes golem-cli package to crates.io"
command = "cargo"
args = ["publish", "-p", "golem-cli", "--all-features", "--allow-dirty"]
[tasks.publish-golem-rib]
description = "Publishes golem-rib package to crates.io"
command = "cargo"
args = [
"publish",
"-p",
"golem-rib",
"--all-features",
"--allow-dirty",
"--no-verify",
]
## ** PACKAGE RELEASE **
# There are three variants of package-release, and only one of them will run based on the value of
# the PLATFORM_OVERRIDE environment variable
[tasks.package-release]
description = "Packages the project's release artifact"
dependencies = [
"package-release-default",
"package-release-override-linux-amd64",
"package-release-override-linux-arm64",
]
[tasks.package-release-base]
private = true
description = "Packages the project's release artifact. Must have the PLATFORM_TARGET env var set."
cwd = "target"
command = "tar"
args = [
"-cvf",
"${PLATFORM_TARGET}.tar",
"${PLATFORM_TARGET}/release/golem-shard-manager",
"${PLATFORM_TARGET}/release/worker-executor",
"${PLATFORM_TARGET}/release/golem-component-service",
"${PLATFORM_TARGET}/release/golem-worker-service",
"${PLATFORM_TARGET}/release/golem-component-compilation-service",
]
[tasks.package-release-default]
description = "Packages the project's release artifact"
condition = { env_not_set = ["PLATFORM_OVERRIDE"] }
env = { "PLATFORM_TARGET" = "." }
extend = "package-release-base"
dependencies = ["build-release-default"]
[tasks.package-release-override-linux-amd64]
description = "Packages the project's release artifact with target platform override to linux/amd64"
condition = { env = { "PLATFORM_OVERRIDE" = "linux/amd64" } }
env = { "PLATFORM_TARGET" = "x86_64-unknown-linux-gnu" }
extend = "package-release-base"
dependencies = ["build-release-override-linux-amd64"]
[tasks.package-release-override-linux-arm64]
description = "Packages the project in release artifact with target platform override to linux/arm64"
condition = { env = { "PLATFORM_OVERRIDE" = "linux/arm64" } }
env = { "PLATFORM_TARGET" = "aarch64-unknown-linux-gnu" }
extend = "package-release-base"
dependencies = ["build-release-override-linux-arm64"]
[tasks.run]
description = "Runs all the services locally"
dependencies = ["build"]
condition = { fail_message = "Requires lnav, nginx and redis on path. Install them with your package manager." }
condition_script = ["nginx -v", "lnav --version", "redis-server --version"]
script = '''
mkdir -pv data logs
redis-server --port 6380 --save "" --appendonly no &> logs/redis.log &
redis_pid=$!
export RUST_BACKTRACE=1
export GOLEM__TRACING__FILE_DIR="${GOLEM__TRACING__FILE_DIR:=../logs}"
export GOLEM__TRACING__FILE__ANSI="${GOLEM__TRACING__FILE__ANSI:=true}"
export GOLEM__TRACING__FILE__ENABLED="${GOLEM__TRACING__FILE__ENABLED:=true}"
export GOLEM__TRACING__FILE__JSON="${GOLEM__TRACING__FILE__JSON:=false}"
export GOLEM__TRACING__STDOUT__ENABLED="${GOLEM__TRACING__STDOUT__ENABLED:=false}"
pushd golem-shard-manager || exit
RUST_LOG=info,h2=warn,hyper=warn,tower=warn GOLEM_SHARD_MANAGER_PORT=9002 ../target/debug/golem-shard-manager &
shard_manager_pid=$!
popd || exit
pushd golem-component-compilation-service || exit
RUST_LOG=info,h2=warn,hyper=warn,tower=warn ../target/debug/golem-component-compilation-service &
component_compilation_service_pid=$!
popd || exit
pushd golem-component-service || exit
RUST_LOG=info,h2=warn,hyper=warn,tower=warn ../target/debug/golem-component-service &
component_service_pid=$!
popd || exit
pushd golem-worker-service || exit
RUST_LOG=info,h2=warn,hyper=warn,tower=warn ../target/debug/golem-worker-service &
worker_service_pid=$!
popd || exit
pushd golem-worker-executor || exit
RUST_LOG=info ../target/debug/worker-executor &
worker_executor_pid=$!
popd || exit
nginx -c $CARGO_MAKE_WORKING_DIRECTORY/golem-router/golem-services.local.conf &> logs/nginx.log &
router_pid=$!
echo "Started services"
echo " - worker executor: $worker_executor_pid"
echo " - worker service: $worker_service_pid"
echo " - component service: $component_service_pid"
echo " - component compilation service: $component_compilation_service_pid"
echo " - shard manager: $shard_manager_pid"
echo " - router: $router_pid"
echo " - redis: $redis_pid"
echo ""
echo "Kill all manually:"
echo "kill -9 $worker_executor_pid $worker_service_pid $component_service_pid $component_compilation_service_pid $shard_manager_pid $router_pid $redis_pid"
lnav logs
kill $worker_executor_pid || true
kill $worker_service_pid || true
kill $component_service_pid || true
kill $component_compilation_service_pid || true
kill $shard_manager_pid || true
kill $router_pid || true
kill $redis_pid || true
'''
## ** GENERATE CONFIGS **
[tasks.generate-configs]
description = "Generates default and exmaple config files"
dependencies = ["build-bins-non-ci"]
script = '''
export RUST_BACKTRACE=1
./target/debug/golem-shard-manager --dump-config-default-toml > golem-shard-manager/config/shard-manager.toml
./target/debug/golem-shard-manager --dump-config-default-env-var > golem-shard-manager/config/shard-manager.sample.env
./target/debug/golem-component-compilation-service --dump-config-default-toml > golem-component-compilation-service/config/component-compilation-service.toml
./target/debug/golem-component-compilation-service --dump-config-default-env-var > golem-component-compilation-service/config/component-compilation-service.sample.env
./target/debug/golem-component-service --dump-config-default-toml > golem-component-service/config/component-service.toml
./target/debug/golem-component-service --dump-config-default-env-var > golem-component-service/config/component-service.sample.env
./target/debug/golem-worker-service --dump-config-default-toml > golem-worker-service/config/worker-service.toml
./target/debug/golem-worker-service --dump-config-default-env-var > golem-worker-service/config/worker-service.sample.env
./target/debug/worker-executor --dump-config-default-toml > golem-worker-executor/config/worker-executor.toml
./target/debug/worker-executor --dump-config-default-env-var > golem-worker-executor/config/worker-executor.sample.env
'''
## ** CHECK CONFIGS **
[tasks.check-configs]
description = "Generates configs from code and checks if it's committed"
dependencies = ["generate-configs"]
script = '''
git diff --exit-code \
golem-shard-manager/config/shard-manager.toml \
golem-shard-manager/config/shard-manager.sample.env \
golem-component-compilation-service/config/component-compilation-service.toml \
golem-component-compilation-service/config/component-compilation-service.sample.env \
golem-component-service/config/component-service.toml \
golem-component-service/config/component-service.sample.env \
golem-worker-service/config/worker-service.toml \
golem-worker-service/config/worker-service.sample.env \
golem-worker-executor/config/worker-executor.toml \
golem-worker-executor/config/worker-executor.sample.env
'''
## ** Elastic tasks **
[tasks.elastic-up]
description = "Starts elastic, kibana and filebeat and loads logs into elastic"
script = '''
docker compose --project-directory log-tools/elastic up --detach
'''
[tasks.elastic-stop]
description = "Stops the elastic environment"
script = '''
docker compose --project-directory log-tools/elastic stop
'''
[tasks.elastic-down]
description = "Stops and removes the elastic environment, including all data"
script = '''
docker compose --project-directory log-tools/elastic down --volumes
'''