From 10fab44013a3b1cd7a97e05bc54d615ab91f5452 Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Tue, 6 Feb 2024 17:04:14 +0100 Subject: [PATCH 1/3] feat(poc-2): change to running the remotev1 distributed test * use discovery_distributed test and add agents variable * add init.sh * recent change on this is to always use the same working directory per job-name * tune retries/restarts and add readiness timeout variable --- nomad/poc-2.hcl | 213 +++++++++++++++++++++----------------------- nomad/poc-2/init.sh | 27 ++++++ 2 files changed, 131 insertions(+), 109 deletions(-) create mode 100644 nomad/poc-2/init.sh diff --git a/nomad/poc-2.hcl b/nomad/poc-2.hcl index 3c18ee93..a08201ee 100644 --- a/nomad/poc-2.hcl +++ b/nomad/poc-2.hcl @@ -1,21 +1,37 @@ /* - poc-2: distributed holochain gossip test + poc-2: run a cargo test that has a server and a client role - - public reachable node runs the bootstrap and turn servers - - nat'ed conductors are configured to use these public services - - a simple happ generates data and ensures it is getting data back from others + - a public reachable node runs the server role + - defined number of nat'ed nodes run the client roles, getting the server's IP and port via environment variables + + - improvement TODOs: + - add prestart tasks that only compile the binaries + - server + - clients + - start run the clients when the server is ready */ +variables { + GIT_URL = "https://github.com/steveej-forks/holochain.git" + GIT_BRANCH = "pr_distributed-test-poc" + agents = 5 + agents_readiness_timeout_secs = 720 +} + job "poc-2" { type = "batch" - group "servers" { + group "server" { network { - port "holochainBootstrap" {} - port "holochainSignal" {} + port "holochainTestRemoteV1" {} } - task "holochain-services" { + task "test-remotev1-distributed-server" { + env { + GIT_URL = "${var.GIT_URL}" + GIT_BRANCH = "${var.GIT_BRANCH}" + } + constraint { attribute = "${meta.features}" operator = "set_contains" @@ -24,125 +40,104 @@ job "poc-2" { service { provider = "nomad" - name = "holochainBootstrap" - port = "holochainBootstrap" + name = "holochainTestRemoteV1" + port = "holochainTestRemoteV1" + + // check { + // name = "remote_v1_server_up" + // type = "tcp" + // port = "holochainTestRemoteV1" + // interval = "10s" + // timeout = "2s" + // } } - service { - provider = "nomad" - name = "holochainSignal" - port = "holochainSignal" + template { + data = file("nomad/poc-2/init.sh") + destination = "local/init.sh" + perms = "555" } driver = "raw_exec" config { command = "/usr/bin/env" - args = ["bash", "-c", - < Date: Tue, 5 Mar 2024 18:03:00 +0100 Subject: [PATCH 2/3] nomad: update command and inspector --- nomad/commander.hcl | 6 +++--- nomad/inspector.hcl | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/nomad/commander.hcl b/nomad/commander.hcl index c4fcc2be..70304c97 100644 --- a/nomad/commander.hcl +++ b/nomad/commander.hcl @@ -15,7 +15,7 @@ job "commander" { constraint { attribute = "${meta.HOLO_NIXPKGS_CHANNEL}" operator = "regexp" - value = ".*holo-nixpkgs/1694.*" + value = ".*holo-nixpkgs/2021.*" } type = "sysbatch" @@ -31,13 +31,13 @@ job "commander" { command = "/usr/bin/env" args = ["bash", "-c", <<-ENDOFSCRIPT - set -e + set -xe export NIX_PATH=nixpkgs=/nix/var/nix/profiles/per-user/root/channels/holo-nixpkgs/nixpkgs/ nix-shell \ -p nixos-rebuild \ -p curl \ -p sudo \ - --command "/run/wrappers/bin/sudo /usr/bin/env hpos-update 1691" + --command "/run/wrappers/bin/sudo /usr/bin/env hpos-update 2021" # /run/wrappers/bin/sudo /usr/bin/env systemctl start holo-nixpkgs-auto-upgrade.service ENDOFSCRIPT diff --git a/nomad/inspector.hcl b/nomad/inspector.hcl index 59cc0dd5..56dcee3d 100644 --- a/nomad/inspector.hcl +++ b/nomad/inspector.hcl @@ -18,6 +18,10 @@ job "inspector" { operator = "is_set" } + constraint { + distinct_hosts = true + } + type = "system" task "sleeper" { From ddf4e775e9489d02458fca31a5cb88480d922d05 Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Thu, 21 Mar 2024 16:06:39 +0000 Subject: [PATCH 3/3] poc-2: address review comments --- nomad/poc-2.hcl | 6 +++++- nomad/poc-2/init.sh | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/nomad/poc-2.hcl b/nomad/poc-2.hcl index a08201ee..68031ae2 100644 --- a/nomad/poc-2.hcl +++ b/nomad/poc-2.hcl @@ -12,7 +12,7 @@ */ variables { - GIT_URL = "https://github.com/steveej-forks/holochain.git" + GIT_URL = "https://github.com/holochain/holochain.git" GIT_BRANCH = "pr_distributed-test-poc" agents = 5 agents_readiness_timeout_secs = 720 @@ -71,6 +71,9 @@ job "poc-2" { export TEST_SHARED_VALUES_REMOTEV1_ROLE="server" export TEST_SHARED_VALUES_REMOTEV1_URL="ws://${NOMAD_HOST_IP_holochainTestRemoteV1}:${NOMAD_HOST_PORT_holochainTestRemoteV1}" + # use practically infinite retries to bring the server back up after every run + # will not retry in case of compilation errors, only for runs. + # the test success is determined by the clients and the dev will purge the whole job (including this server) once the test is considered completed. nix develop -vL .#coreDev --command \ cargo nextest run --locked -p holochain_test_utils --no-capture --features slow_tests --status-level=pass --retries=99999999 discovery_distributed ENDOFSCRIPT @@ -130,6 +133,7 @@ job "poc-2" { <