Skip to content

Commit 447ddf3

Browse files
committed
workbench: add ssh and rsync to fetch logs from Nomad cloud
1 parent 71e994c commit 447ddf3

File tree

10 files changed

+1032
-158
lines changed

10 files changed

+1032
-158
lines changed

nix/workbench/backend/nomad-job.nix

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
, execTaskDriver
1212
, generatorTaskName
1313
, oneTracerPerNode ? false
14+
, withSsh ? false
1415
}:
1516

1617
let
@@ -593,6 +594,7 @@ let
593594
withGenerator = taskName == generatorTaskName;
594595
# Only for the tracer task or also nodes if oneTracerPerNode
595596
withTracer = oneTracerPerNode || taskName == "tracer";
597+
inherit withSsh;
596598
# ''{{ env "NOMAD_TASK_DIR" }}/supervisor.sock''
597599
inherit unixHttpServerPort;
598600
};
@@ -729,6 +731,43 @@ let
729731
perms = "744"; # Only for every "start.sh" script. Default: "644"
730732
}
731733
]
734+
++
735+
# ssh
736+
(lib.optionals withSsh (
737+
let
738+
ssh-service = import
739+
../service/ssh.nix
740+
{
741+
inherit pkgs;
742+
bashInteractive = containerSpecs.containerPkgs.bashInteractive.nix-store-path;
743+
coreutils = containerSpecs.containerPkgs.coreutils.nix-store-path;
744+
openssh_hacks = containerSpecs.containerPkgs.openssh_hacks.nix-store-path;
745+
}
746+
;
747+
in [
748+
## ssh start.sh script.
749+
{
750+
env = false;
751+
destination = "${task_statedir}/ssh/start.sh";
752+
data = escapeTemplate ssh-service.start.value;
753+
change_mode = "noop";
754+
error_on_missing_key = true;
755+
perms = "744"; # Only for every "start.sh" script. Default: "644"
756+
}
757+
## ssh config file.
758+
{
759+
env = false;
760+
destination = "${task_statedir}/ssh/sshd_config";
761+
data = escapeTemplate ssh-service.config.value;
762+
change_mode = "noop";
763+
error_on_missing_key = true;
764+
perms = "744"; # Only for every "start.sh" script. Default: "644"
765+
}
766+
# The deployer script must add the templates for the private keys:
767+
# - ${task_statedir}/ssh/sshd.id_ed25519
768+
# - ${task_statedir}/ssh/nobody.id_ed25519.pub
769+
]
770+
))
732771
;
733772

734773
# Specifies logging configuration for the stdout and stderr of the

0 commit comments

Comments
 (0)