diff --git a/Makefile b/Makefile index 7e0dc77a729..e833f85422e 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ trace-documentation: ### ### Workbench ### -workbench-ci: workbench-ci-test ci-test-auto ci-test-autonix ci-test-autonomadpodman +workbench-ci: workbench-ci-test ci-test-auto ci-test-autonix CI_TARGETS := hlint workbench-ci haddock-hoogle ci: ci-report ci-targets ci-report: diff --git a/flake.lock b/flake.lock index 9768a46c506..7fc9f8d9016 100644 --- a/flake.lock +++ b/flake.lock @@ -450,24 +450,6 @@ "type": "github" } }, - "flake-utils_5": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "ghc-8.6.5-iohk": { "flake": false, "locked": { @@ -1050,25 +1032,6 @@ "type": "github" } }, - "nix2container_2": { - "inputs": { - "flake-utils": "flake-utils_5", - "nixpkgs": "nixpkgs_6" - }, - "locked": { - "lastModified": 1712990762, - "narHash": "sha256-hO9W3w7NcnYeX8u8cleHiSpK2YJo7ecarFTUlbybl7k=", - "owner": "nlewo", - "repo": "nix2container", - "rev": "20aad300c925639d5d6cbe30013c8357ce9f2a2e", - "type": "github" - }, - "original": { - "owner": "nlewo", - "repo": "nix2container", - "type": "github" - } - }, "nixago": { "inputs": { "flake-utils": [ @@ -1326,21 +1289,6 @@ } }, "nixpkgs_6": { - "locked": { - "lastModified": 1712920918, - "narHash": "sha256-1yxFvUcJfUphK9V91KufIQom7gCsztza0H4Rz2VCWUU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "92323443a56f4e9fc4e4b712e3119f66d0969297", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_7": { "locked": { "lastModified": 1708343346, "narHash": "sha256-qlzHvterVRzS8fS0ophQpkh0rqw0abijHEOAKm0HmV0=", @@ -1464,7 +1412,6 @@ "nixpkgs" ], "iohkNix": "iohkNix", - "nix2container": "nix2container_2", "nixpkgs": [ "haskellNix", "nixpkgs-unstable" @@ -1593,7 +1540,7 @@ "std", "blank" ], - "nixpkgs": "nixpkgs_7", + "nixpkgs": "nixpkgs_6", "paisano": "paisano", "paisano-tui": "paisano-tui", "terranix": [ @@ -1631,21 +1578,6 @@ "type": "github" } }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "tullia": { "inputs": { "nix-nomad": "nix-nomad", @@ -1687,7 +1619,7 @@ }, "utils_2": { "inputs": { - "systems": "systems_2" + "systems": "systems" }, "locked": { "lastModified": 1710146030, diff --git a/flake.nix b/flake.nix index 5ba7786b3a9..4052b906485 100644 --- a/flake.nix +++ b/flake.nix @@ -56,8 +56,6 @@ std.url = "github:divnix/std"; - nix2container.url = "github:nlewo/nix2container"; - cardano-automation = { url = "github:input-output-hk/cardano-automation"; inputs = { @@ -78,7 +76,6 @@ , ops-lib , cardano-mainnet-mirror , std - , nix2container , cardano-automation , em , ... @@ -106,7 +103,7 @@ iohkNix.overlays.cardano-lib iohkNix.overlays.utils (final: prev: { - inherit customConfig nix2container; + inherit customConfig; bench-data-publish = cardano-automation.outputs.packages.${final.system}."bench-data-publish:exe:bench-data-publish"; em = import em { inherit (final) system; nixpkgsSrcs = nixpkgs.outPath; diff --git a/lib.mk b/lib.mk index 9241a42a92e..f0fe8572888 100644 --- a/lib.mk +++ b/lib.mk @@ -42,8 +42,6 @@ $$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nix, $$(prof) $$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-autonix, $$(prof), true,false, true,false, false, supervisor))) $$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nomadexec, $$(prof), true,false,false,false, false, nomadexec))) $$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nomadexec-auto, $$(prof), true,false, true,false, false, nomadexec))) -$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nomadpodman, $$(prof), true,false,false,false, false, nomadpodman))) -$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nomadpodman-auto, $$(prof), true,false, true,false, false, nomadpodman))) endef define define_profile_targets_nomadcloud diff --git a/nix/pkgs.nix b/nix/pkgs.nix index 7605f1312b9..c0e16143cff 100644 --- a/nix/pkgs.nix +++ b/nix/pkgs.nix @@ -23,8 +23,6 @@ let import ./workbench/backend/nomad/cloud.nix params; nomadexec = params: import ./workbench/backend/nomad/exec.nix params; - nomadpodman = params: - import ./workbench/backend/nomad/podman.nix params; supervisor = params: import ./workbench/backend/supervisor.nix params; } diff --git a/nix/workbench/backend/nomad-job.nix b/nix/workbench/backend/nomad-job.nix index 11ff8b1684d..57bcdaed097 100644 --- a/nix/workbench/backend/nomad-job.nix +++ b/nix/workbench/backend/nomad-job.nix @@ -7,9 +7,8 @@ , lib , stateDir , profileData -, containerSpecs -, execTaskDriver , generatorTaskName +, containerPkgs , oneTracerPerNode ? false , withSsh ? false }: @@ -21,8 +20,8 @@ let # Nomad creates a working directory for each allocation on a client. This # directory can be found in the Nomad data_dir at ./alloc/«alloc_id». The # allocation working directory is where Nomad creates task directories and - # directories shared between tasks, write logs for tasks, and downloads - # artifacts or templates. + # directories shared between tasks, write logs for tasks, downloads artifacts + # and renders templates. # https://developer.hashicorp.com/nomad/docs/concepts/filesystem # # For example: @@ -36,34 +35,26 @@ let # Templates are rendered into the task working directory. Drivers without # filesystem isolation (such as raw_exec) or drivers that build a chroot in # the task working directory (such as exec) can have templates rendered to - # arbitrary paths in the task. But task drivers such as docker can only access - # templates rendered into the NOMAD_ALLOC_DIR, NOMAD_TASK_DIR, or - # NOMAD_SECRETS_DIR. To work around this restriction, you can create a mount - # from the template destination to another location in the task. + # arbitrary paths in the task. ## - https://developer.hashicorp.com/nomad/docs/job-specification/template#template-destinations ## - https://developer.hashicorp.com/nomad/docs/runtime/environment#task-directories ## - https://developer.hashicorp.com/nomad/docs/concepts/filesystem - # Task's filesystem / working directory (maybe container or chroot) defaults: + # Workbench's ${stateDir} will be created/populated inside NOMAD_TASK_DIR. # - # When using the isolated fork task driver ("exec") - ## Default values below are stored in the job's "meta" stanza to be able to - ## overrided them with 'jq' from a workbench shell. These values in "meta" - ## are used to programatically create a "template" with "env = true;" so they - ## are automagically reachable as envars inside the Task's entrypoint and - ## 'supervisord' programs. + ## Some workbench default values are stored in the job's "meta" stanza to be + ## able to override them with 'jq' from a workbench shell. These values in + ## "meta" are used to programmatically create a "template" with "env = true;" + ## so they are automagically reachable as envars inside the Task's entrypoint + ## and/or 'supervisord' programs. ## Values go: Nix (defaults) -> meta -> template -> envars - # - ## See ./oci-images.nix for further details if using the `podman` driver. - ## For the `exec` driver almost everything is here. - # - # A symlink to the supervisord nix-installed inside the OCI image/chroot. - # We need to be able to `nomad exec supervisorctl ...` , for this the path + # Symlink to the supervisord that is nix-installed inside the deployed chroot. + # We need to be able to do `nomad exec supervisorctl ...` , for this the path # of the installed supervisor binaries is needed. task_supervisor_nix = "${stateDir}/supervisor/nix-store"; # Location of the supervisord config file inside the container. - # This file can be mounted as a volume or created as a template. + # This file is created as a template. task_supervisord_conf = "${stateDir}/supervisor/supervisord.conf"; # The URL to the listening inet or socket of the supervisord server: # The problem is that if we use "127.0.0.1:9001" as parameter (without the @@ -82,8 +73,8 @@ let entrypoint = let - coreutils = containerSpecs.containerPkgs.coreutils.nix-store-path; - supervisor = containerSpecs.containerPkgs.supervisor.nix-store-path; + coreutils = containerPkgs.coreutils.nix-store-path; + supervisor = containerPkgs.supervisor.nix-store-path; in escapeTemplate '' # Store entrypoint's envars and "uname" in a file for debugging purposes. @@ -111,11 +102,8 @@ let }" \ > "''${NOMAD_TASK_DIR}"/entrypoint.dirs - # Only needed for "exec" ? - if test "''${TASK_DRIVER}" = "exec" - then - cd "''${NOMAD_TASK_DIR}" - fi + # Move to stateDir's parent directory. + cd "''${NOMAD_TASK_DIR}" # Create a symlink to 'supervisor' Nix Store folder so we can call it from # 'ssh' or 'nomad exec' without having it in PATH or knowing the currently @@ -141,7 +129,7 @@ let # About the JSON Job Specification and my odd assumptions: # - # TL;DR; We are using what HashiCorp calls an unespecified format but it's the + # TL;DR; We are using what HashiCorp calls an unspecified format but it's the # same format the SRE team is using. # # At least in Nomad version v1.4.3, the CLI command to submit new jobs @@ -250,7 +238,6 @@ let meta = { # Only top level "KEY=STRING" are allowed, no child objects/attributes! WORKBENCH_STATEDIR = stateDir; - TASK_DRIVER = if execTaskDriver then "exec" else "podman"; SUPERVISORD_LOGLEVEL = task_supervisord_loglevel; ONE_TRACER_PER_NODE = oneTracerPerNode; }; @@ -411,8 +398,8 @@ let # Actually using the interface specified on Nomad Client startup that # for local runs it's forced to "lo" and whatever is automatically # fingerprinted or provided for cloud runs. - # TODO: Use "bridge" mode for podman, this will allow to run isolated - # local cluster with no addresses or ports clashing. + # TODO: Use "bridge" mode for local ?? this will allow to run isolated + # local cluster with no addresses or ports clashing ?? mode = "host"; # Specifies a TCP/UDP port allocation and can be used to specify both # dynamic ports and reserved ports. @@ -453,18 +440,14 @@ let # jobs like load balancers. static = ''${toString portNum}''; - # TODO: When switching the network mode to "bridge" for - # podman use "Mapped Ports" to be able to run isolated - # local cluster with no addresses or ports clashing. + # The "exec" driver does not accept "Mapped Ports". + # to = ''${toString portNum}''; # Applicable when using "bridge" mode to configure port # to map to inside the task's network namespace. Omitting # this field or setting it to -1 sets the mapped port # equal to the dynamic port allocated by the scheduler. # The NOMAD_PORT_