Skip to content

Commit 6207ecb

Browse files
committed
feat: add Nomad job to run app_install scenario locally with Nomad
1 parent b624276 commit 6207ecb

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

README.md

+35
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,41 @@ You can then start a second terminal and run one of the scenarios in the `scenar
354354
```bash
355355
RUST_LOG=info CONDUCTOR_CONFIG="CI" TRYCP_RUST_LOG="info" MIN_PEERS=2 cargo run --package trycp_write_validated -- --targets targets-ci.yaml --instances-per-target 2 --duration 60
356356
```
357+
#### Running Wind Tunnel Scenarios with Nomad
358+
359+
> [!WARN]
360+
> This is a work in progress and currently only works with the `app_install` scenario.
361+
362+
##### Running Locally
363+
364+
You can easily test the Wind Tunnel scenarios with [Nomad](https://www.nomadproject.io) by running them locally, this requires running a Nomad agent locally
365+
as both a client and a server.
366+
367+
First, enter the Nix `devShell` with `nix develop` to make sure you have all the packages install.
368+
Alternatively, [install Nomad](https://developer.hashicorp.com/nomad/install) and Holochain locally so that both `nomad` and `hc` are in your `PATH`.
369+
370+
Once Nomad is installed, run the agent in `dev` mode to spin up both a server and client, do this with:
371+
```shell
372+
nomad agent -dev
373+
```
374+
375+
Now navigate to [http://localhost:4646/ui] to view the Nomad dashboard.
376+
377+
Next, in a new terminal window, build the `app_install` scenario with:
378+
```shell
379+
nix build .#app_install
380+
```
381+
382+
Once the scenario is built you can run the Nomad job with:
383+
```shell
384+
nomad job run nomad/run-app_install-local.nomad.hcl
385+
```
386+
387+
Then, navigate to [http://localhost:4646/ui/jobs/app_install_scenario@default] where you should see one allocation (the Nomad name for an instance of the job)
388+
this allocation should have two tasks: the `start-holochain` task and the `run_scenario` task. You can view the logs of these tasks to see the results.
389+
The allocation should be marked as "Completed" after a few seconds.
390+
391+
Once you've finished testing you can kill the Nomad agent with `^C` in the first terminal running the agent.
357392

358393
### Published crates
359394

nomad/run-app_install-local.nomad.hcl

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
job "app_install_scenario" {
2+
type = "batch"
3+
group "app_install" {
4+
task "start_holochain" {
5+
lifecycle {
6+
hook = "prestart"
7+
sidecar = true
8+
}
9+
10+
driver = "raw_exec"
11+
config {
12+
command = "bash"
13+
args = ["-c", "hc s clean && echo 1234 | hc s --piped create && echo 1234 | hc s --piped -f 8888 run"]
14+
}
15+
}
16+
17+
task "run_scenario" {
18+
driver = "raw_exec"
19+
env {
20+
RUST_LOG = "info"
21+
}
22+
config {
23+
command = abspath("result/bin/app_install")
24+
args = [
25+
"--connection-string", "ws://localhost:8888",
26+
"--agents", "2",
27+
"--behaviour", "minimal:1",
28+
"--behaviour", "large:1",
29+
"--duration", "5",
30+
"--no-progress"
31+
]
32+
}
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)