Skip to content

Commit

Permalink
feat: add Nomad job to run app_install scenario locally with Nomad
Browse files Browse the repository at this point in the history
  • Loading branch information
cdunster committed Dec 4, 2024
1 parent b624276 commit 6207ecb
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,41 @@ You can then start a second terminal and run one of the scenarios in the `scenar
```bash
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
```
#### Running Wind Tunnel Scenarios with Nomad

> [!WARN]
> This is a work in progress and currently only works with the `app_install` scenario.
##### Running Locally

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
as both a client and a server.

First, enter the Nix `devShell` with `nix develop` to make sure you have all the packages install.
Alternatively, [install Nomad](https://developer.hashicorp.com/nomad/install) and Holochain locally so that both `nomad` and `hc` are in your `PATH`.

Once Nomad is installed, run the agent in `dev` mode to spin up both a server and client, do this with:
```shell
nomad agent -dev
```

Now navigate to [http://localhost:4646/ui] to view the Nomad dashboard.

Next, in a new terminal window, build the `app_install` scenario with:
```shell
nix build .#app_install
```

Once the scenario is built you can run the Nomad job with:
```shell
nomad job run nomad/run-app_install-local.nomad.hcl
```

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)
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.
The allocation should be marked as "Completed" after a few seconds.

Once you've finished testing you can kill the Nomad agent with `^C` in the first terminal running the agent.

### Published crates

Expand Down
35 changes: 35 additions & 0 deletions nomad/run-app_install-local.nomad.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
job "app_install_scenario" {
type = "batch"
group "app_install" {
task "start_holochain" {
lifecycle {
hook = "prestart"
sidecar = true
}

driver = "raw_exec"
config {
command = "bash"
args = ["-c", "hc s clean && echo 1234 | hc s --piped create && echo 1234 | hc s --piped -f 8888 run"]
}
}

task "run_scenario" {
driver = "raw_exec"
env {
RUST_LOG = "info"
}
config {
command = abspath("result/bin/app_install")
args = [
"--connection-string", "ws://localhost:8888",
"--agents", "2",
"--behaviour", "minimal:1",
"--behaviour", "large:1",
"--duration", "5",
"--no-progress"
]
}
}
}
}

0 comments on commit 6207ecb

Please sign in to comment.