diff --git a/code/integration-tests/runtime-tests/runtime-tests.nix b/code/integration-tests/runtime-tests/runtime-tests.nix index 23cb167f250..7bdc852b473 100644 --- a/code/integration-tests/runtime-tests/runtime-tests.nix +++ b/code/integration-tests/runtime-tests/runtime-tests.nix @@ -19,13 +19,6 @@ pkgs.lib.meta.getExe self'.packages.devnet-xc-fresh-background } 2>&1 & ) | tee devnet-xc.log & - process-compose-stop() { - for i in $(process-compose process list) - do - process-compose process stop "$i" - done - } - TRIES=0 START_RESULT=1 while test $TRIES -le 64; do @@ -38,7 +31,9 @@ fi set -o errexit if test $START_RESULT -eq 0; then - process-compose-stop + set +o errexit + pkill -SIGTERM process-compose + set -o errexit break fi ((TRIES=TRIES+1)) @@ -47,7 +42,10 @@ # here nodes are up and running, binaries in path, npm is here too - process-compose-stop + sleep 8 + set +o errexit + pkill -SIGKILL process-compose + set -o errexit exit $START_RESULT ''; }; diff --git a/flake.lock b/flake.lock index f5f75a8b4f6..da63f45f2af 100644 --- a/flake.lock +++ b/flake.lock @@ -860,6 +860,21 @@ } }, "flake-utils_10": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_11": { "inputs": { "systems": "systems_8" }, @@ -2366,6 +2381,27 @@ "type": "github" } }, + "process-compose": { + "inputs": { + "flake-utils": "flake-utils_10", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1696284797, + "narHash": "sha256-eq7WEmWgkeAFEVRVp3nmE3uXpz9DoXTErMif8LxqD5E=", + "owner": "F1bonacc1", + "repo": "process-compose", + "rev": "5ec45e2925f3b17009ab75efdd4631825e57e6d7", + "type": "github" + }, + "original": { + "owner": "F1bonacc1", + "repo": "process-compose", + "type": "github" + } + }, "process-compose-flake": { "locked": { "lastModified": 1695992918, @@ -2437,6 +2473,7 @@ "nixpkgs-latest": "nixpkgs-latest", "npm-buildpackage": "npm-buildpackage", "polkadot": "polkadot", + "process-compose": "process-compose", "process-compose-flake": "process-compose-flake", "rust-overlay": "rust-overlay_4", "zombienet": "zombienet" @@ -2528,7 +2565,7 @@ }, "rust-overlay_4": { "inputs": { - "flake-utils": "flake-utils_10", + "flake-utils": "flake-utils_11", "nixpkgs": "nixpkgs_11" }, "locked": { diff --git a/flake.nix b/flake.nix index ef8ddcc020d..f7ec225883e 100644 --- a/flake.nix +++ b/flake.nix @@ -8,6 +8,11 @@ url = "github:Platonic-Systems/process-compose-flake"; }; + process-compose = { + url = "github:F1bonacc1/process-compose"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + flake-parts.url = "github:hercules-ci/flake-parts"; flake-utils.url = "github:numtide/flake-utils"; npm-buildpackage.url = "github:serokell/nix-npm-buildpackage"; @@ -114,28 +119,31 @@ ./code/runtimes.nix ./code/services/cmc-api/cmc-api.nix ./code/utils/price-feed/price-feed.nix - ./code/xcvm/flake-module.nix ./code/xcvm/evm/flake-module.nix + ./code/xcvm/flake-module.nix ./docs/flake-module.nix ./flake/all.nix - ./flake/nixos-configuration.nix + ./flake/bash.nix ./flake/cargo-tools.nix ./flake/check.nix + ./flake/cosmos.nix ./flake/darwin-configurations.nix - ./flake/bash.nix ./flake/dev-shells.nix + ./flake/devnet-tools.nix ./flake/devnet.nix ./flake/docker.nix + ./flake/ethereum.nix ./flake/fmt.nix ./flake/hermes.nix - ./flake/ethereum.nix ./flake/home-configurations.nix ./flake/ibc.nix ./flake/live.nix + ./flake/nixos-configuration.nix ./flake/osmosis.nix - ./flake/cosmos.nix + ./flake/overlays.nix ./flake/process-compose.nix ./flake/release.nix + ./flake/rust.nix ./flake/subxt.nix ./flake/zombienet.nix ./inputs/AcalaNetwork/acala.nix @@ -151,9 +159,6 @@ ./inputs/paritytech/zombienet/flake-module.nix ./inputs/Wasmswap/wasmswap-contracts.nix ./inputs/wynddao/flake-module.nix - ./tools/devnet-tools.nix - ./tools/pkgs.nix - ./tools/rust.nix ]; systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ]; diff --git a/tools/devnet-tools.nix b/flake/devnet-tools.nix similarity index 94% rename from tools/devnet-tools.nix rename to flake/devnet-tools.nix index e9ee389fcf0..61019340e30 100644 --- a/tools/devnet-tools.nix +++ b/flake/devnet-tools.nix @@ -26,7 +26,8 @@ curl ]; withDevNetContainerTools = with pkgs; - [ bottom gawk gnugrep less nettools nix self'.packages.bech32cli ] + with self'.packages; + [ bottom gawk gnugrep less nettools nix bech32cli process-compose ] ++ withBaseContainerTools ++ withUserContainerTools; withBuildTools = with pkgs; [ binutils ] ++ withBaseContainerTools; diff --git a/tools/pkgs.nix b/flake/overlays.nix similarity index 89% rename from tools/pkgs.nix rename to flake/overlays.nix index 8ca3dce1f58..9afe5feb1d2 100644 --- a/tools/pkgs.nix +++ b/flake/overlays.nix @@ -7,6 +7,7 @@ polkadot.overlays.default rust-overlay.overlays.default zombienet.overlays.default + process-compose.overlays.default ]; }; }; diff --git a/flake/process-compose.nix b/flake/process-compose.nix index da48116c13d..dbfda17e922 100644 --- a/flake/process-compose.nix +++ b/flake/process-compose.nix @@ -15,6 +15,16 @@ in { packages = rec { + + process-compose-stop = pkgs.writeShellApplication { + runtimeInputs = devnetTools.withBaseContainerTools + ++ [ pkgs.process-compose ]; + name = "process-compose-stop"; + text = '' + pkill -SIGTERM process-compose + ''; + }; + devnet-xc-fresh-background = pkgs.writeShellApplication { runtimeInputs = devnetTools.withBaseContainerTools; name = "devnet-xc-fresh-background"; @@ -196,6 +206,7 @@ command = self'.packages.eth-gen; log_location = "${devnet-root-directory}/eth-gen.log"; availability = { restart = chain-restart; }; + namespace = "ethereum"; }; eth-consensus-gen = { command = self'.packages.eth-consensus-gen; @@ -204,6 +215,7 @@ depends_on = { "eth-gen".condition = "process_completed_successfully"; }; + namespace = "ethereum"; }; eth-executor-gen = { command = self'.packages.eth-executor-gen; @@ -211,8 +223,8 @@ availability = { restart = chain-restart; }; depends_on = { "eth-gen".condition = "process_completed_successfully"; - }; + namespace = "ethereum"; }; eth-executor = { command = self'.packages.eth-executor; @@ -227,7 +239,7 @@ test -f ${devnet-root-directory}/eth/jwtsecret ''; } // parachain-startup; - + namespace = "ethereum"; }; eth-consensus = { command = self'.packages.eth-consensus; @@ -238,6 +250,7 @@ "process_completed_successfully"; "eth-executor".condition = "process_healthy"; }; + namespace = "ethereum"; }; eth-validator = { command = self'.packages.eth-validator; @@ -247,6 +260,7 @@ "eth-consensus-gen".condition = "process_completed_successfully"; }; + namespace = "ethereum"; }; centauri = { command = pkgs.writeShellApplication { @@ -262,12 +276,14 @@ }; log_location = "${devnet-root-directory}/centauri.log"; availability = { restart = chain-restart; }; + namespace = "cosmos"; }; centauri-init = { command = self'.packages.centaurid-init; depends_on."centauri".condition = "process_healthy"; log_location = "${devnet-root-directory}/centauri-init.log"; availability = { restart = chain-restart; }; + namespace = "cosmos"; }; osmosis = { @@ -278,6 +294,7 @@ }; log_location = "${devnet-root-directory}/osmosis.log"; availability = { restart = chain-restart; }; + namespace = "cosmos"; }; osmosisd-xcvm-init = { command = self'.packages.osmosisd-xcvm-init; @@ -285,6 +302,7 @@ log_location = "${devnet-root-directory}/osmosisd-xcvm-init.log"; availability = { restart = chain-restart; }; + namespace = "cosmos"; }; picasso = { @@ -296,6 +314,7 @@ curl --header "Content-Type: application/json" --data '{"id":1, "jsonrpc":"2.0", "method" : "assets_listAssets"}' http://localhost:9988 ''; } // parachain-startup; + namespace = "polkadot"; }; composable = { command = self'.packages.zombienet-composable-westend-b; @@ -306,6 +325,7 @@ curl --header "Content-Type: application/json" --data '{"id":1, "jsonrpc":"2.0", "method" : "assets_listAssets"}' http://localhost:29988 ''; } // parachain-startup; + namespace = "polkadot"; }; osmosis-centauri-hermes-init = { command = self'.packages.osmosis-centauri-hermes-init; @@ -533,62 +553,62 @@ availability = { restart = relay; }; namespace = "ibc"; }; - # eth-gen = { - # command = self'.packages.eth-gen; - # log_location = "${devnet-root-directory}/eth-gen.log"; - # availability = { restart = chain-restart; }; - # }; - # eth-consensus-gen = { - # command = self'.packages.eth-consensus-gen; - # log_location = "${devnet-root-directory}/eth-consensus-gen.log"; - # availability = { restart = chain-restart; }; - # depends_on = { - # "eth-gen".condition = "process_completed_successfully"; - # }; - # }; - # eth-executor-gen = { - # command = self'.packages.eth-executor-gen; - # log_location = "${devnet-root-directory}/eth-executor-gen.log"; - # availability = { restart = chain-restart; }; - # depends_on = { - # "eth-gen".condition = "process_completed_successfully"; - - # }; - # }; - # eth-executor = { - # command = self'.packages.eth-executor; - # log_location = "${devnet-root-directory}/eth-executor.log"; - # availability = { restart = chain-restart; }; - # depends_on = { - # "eth-executor-gen".condition = - # "process_completed_successfully"; - # }; - # readiness_probe = { - # exec.command = '' - # test -f ${devnet-root-directory}/eth/jwtsecret - # ''; - # } // parachain-startup; - - # }; - # eth-consensus = { - # command = self'.packages.eth-consensus; - # log_location = "${devnet-root-directory}/eth-consensus.log"; - # availability = { restart = chain-restart; }; - # depends_on = { - # "eth-consensus-gen".condition = - # "process_completed_successfully"; - # "eth-executor".condition = "process_healthy"; - # }; - # }; - # eth-validator = { - # command = self'.packages.eth-validator; - # log_location = "${devnet-root-directory}/eth-validator.log"; - # availability = { restart = chain-restart; }; - # depends_on = { - # "eth-consensus-gen".condition = - # "process_completed_successfully"; - # }; - # }; + eth-gen = { + command = self'.packages.eth-gen; + log_location = "${devnet-root-directory}/eth-gen.log"; + availability = { restart = chain-restart; }; + }; + eth-consensus-gen = { + command = self'.packages.eth-consensus-gen; + log_location = "${devnet-root-directory}/eth-consensus-gen.log"; + availability = { restart = chain-restart; }; + depends_on = { + "eth-gen".condition = "process_completed_successfully"; + }; + }; + eth-executor-gen = { + command = self'.packages.eth-executor-gen; + log_location = "${devnet-root-directory}/eth-executor-gen.log"; + availability = { restart = chain-restart; }; + depends_on = { + "eth-gen".condition = "process_completed_successfully"; + + }; + }; + eth-executor = { + command = self'.packages.eth-executor; + log_location = "${devnet-root-directory}/eth-executor.log"; + availability = { restart = chain-restart; }; + depends_on = { + "eth-executor-gen".condition = + "process_completed_successfully"; + }; + readiness_probe = { + exec.command = '' + test -f ${devnet-root-directory}/eth/jwtsecret + ''; + } // parachain-startup; + + }; + eth-consensus = { + command = self'.packages.eth-consensus; + log_location = "${devnet-root-directory}/eth-consensus.log"; + availability = { restart = chain-restart; }; + depends_on = { + "eth-consensus-gen".condition = + "process_completed_successfully"; + "eth-executor".condition = "process_healthy"; + }; + }; + eth-validator = { + command = self'.packages.eth-validator; + log_location = "${devnet-root-directory}/eth-validator.log"; + availability = { restart = chain-restart; }; + depends_on = { + "eth-consensus-gen".condition = + "process_completed_successfully"; + }; + }; }; }; }; diff --git a/tools/rust.nix b/flake/rust.nix similarity index 100% rename from tools/rust.nix rename to flake/rust.nix