diff --git a/docs/guides/advanced/01_initialization.md b/docs/guides/advanced/01_initialization.md index f46c5ca7a33b..f3ea2ff19974 100644 --- a/docs/guides/advanced/01_initialization.md +++ b/docs/guides/advanced/01_initialization.md @@ -19,7 +19,7 @@ re-running any `zkstack` command. #### Containers -The first step to initialize a ZK Stack ecosystem is to run the command `zkstack containers`. This command gets the +The first step to initialize a ZK Stack ecosystem is to run the command `zkstack ecosystem containers`. This command gets the docker images for `postgres` and `reth`. If the `--observability` option is passed to the command, or the corresponding option is selected in the interactive prompt, then Prometheus, Grafana and other observability-related images are downloaded and run. diff --git a/docs/guides/development.md b/docs/guides/development.md index fb8dd44a6c7a..39573340a12f 100644 --- a/docs/guides/development.md +++ b/docs/guides/development.md @@ -50,7 +50,7 @@ The project root directory includes configuration files for an ecosystem with a ecosystem, first start the required containers: ```bash -zkstack containers +zkstack ecosystem containers ``` Next, run: @@ -79,7 +79,7 @@ zkstack dev clean all You can then reinitialize the ecosystem as described in the [Configure Ecosystem](#configure-ecosystem) section. ```bash -zkstack containers +zkstack ecosystem containers zkstack ecosystem init ``` diff --git a/docs/guides/launch.md b/docs/guides/launch.md index b0a610571964..c19156335c54 100644 --- a/docs/guides/launch.md +++ b/docs/guides/launch.md @@ -13,7 +13,7 @@ Prepare dev environment prerequisites: see Run the required containers with: ```bash -zkstack containers +zkstack ecosystem containers ``` Setup: @@ -33,7 +33,7 @@ To completely reset the dev environment: - Repeat the setup procedure above ```bash - zkstack containers + zkstack ecosystem containers zkstack ecosystem init ``` @@ -43,7 +43,7 @@ If you want to run [Dockprom](https://github.com/stefanprodan/dockprom/) stack ( containers - add `--observability` parameter during initialisation. ```bash -zkstack containers --observability +zkstack ecosystem containers --observability ``` or select `yes` when prompted during the interactive execution of the command. @@ -198,5 +198,5 @@ It appears that no containers are currently running, which is likely the reason Ensure that the necessary containers have been started and are functioning correctly to resolve the issue. ```bash -zkstack containers +zkstack ecosystem containers ``` diff --git a/zkstack_cli/README.md b/zkstack_cli/README.md index 76fa09fca2dd..51bc0f7c1e8f 100644 --- a/zkstack_cli/README.md +++ b/zkstack_cli/README.md @@ -69,7 +69,7 @@ zkstack ecosystem create If you choose not to start database & L1 containers after creating the ecosystem, you can later run: ```bash -zkstack containers +zkstack ecosystem containers ``` Execute subsequent commands from within the created ecosystem folder: @@ -133,7 +133,7 @@ zkstack ecosystem init --observability To start observability containers: ```bash -zkstack containers --observability +zkstack ecosystem containers --observability ``` ### ZK Chain diff --git a/zkstack_cli/crates/zkstack/completion/_zkstack.zsh b/zkstack_cli/crates/zkstack/completion/_zkstack.zsh index 4074f1df3408..25a6b7ecf651 100644 --- a/zkstack_cli/crates/zkstack/completion/_zkstack.zsh +++ b/zkstack_cli/crates/zkstack/completion/_zkstack.zsh @@ -3834,7 +3834,7 @@ _zkstack__chain__update-token-multiplier-setter_commands() { (( $+functions[_zkstack__containers_commands] )) || _zkstack__containers_commands() { local commands; commands=() - _describe -t commands 'zkstack containers commands' commands "$@" + _describe -t commands 'zkstack ecosystem containers commands' commands "$@" } (( $+functions[_zkstack__dev_commands] )) || _zkstack__dev_commands() { diff --git a/zkstack_cli/crates/zkstack/src/commands/args/mod.rs b/zkstack_cli/crates/zkstack/src/commands/args/mod.rs index 71319df3e586..e25a1b7e5b1f 100644 --- a/zkstack_cli/crates/zkstack/src/commands/args/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/args/mod.rs @@ -1,6 +1,5 @@ -pub use self::{autocomplete::*, containers::*, update::*, wait::*}; +pub use self::{autocomplete::*, update::*, wait::*}; mod autocomplete; -mod containers; mod update; mod wait; diff --git a/zkstack_cli/crates/zkstack/src/commands/args/containers.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/containers.rs similarity index 100% rename from zkstack_cli/crates/zkstack/src/commands/args/containers.rs rename to zkstack_cli/crates/zkstack/src/commands/ecosystem/args/containers.rs diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/mod.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/mod.rs index c25eebda3d6d..c84f4255af0f 100644 --- a/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/mod.rs @@ -1,4 +1,5 @@ pub mod build_transactions; pub mod change_default; +pub mod containers; pub mod create; pub mod init; diff --git a/zkstack_cli/crates/zkstack/src/commands/containers.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/containers.rs similarity index 95% rename from zkstack_cli/crates/zkstack/src/commands/containers.rs rename to zkstack_cli/crates/zkstack/src/commands/ecosystem/containers.rs index 9c83f7010e49..0c9478e34cd3 100644 --- a/zkstack_cli/crates/zkstack/src/commands/containers.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/containers.rs @@ -8,7 +8,6 @@ use config::{ }; use xshell::Shell; -use super::args::ContainersArgs; use crate::{ commands::ecosystem::setup_observability, messages::{ @@ -18,7 +17,9 @@ use crate::{ }, }; -pub fn run(shell: &Shell, args: ContainersArgs) -> anyhow::Result<()> { +use super::args::containers::ContainersArgs; + +pub async fn run(shell: &Shell, args: ContainersArgs) -> anyhow::Result<()> { let args = args.fill_values_with_prompt(); let ecosystem = ZkStackConfig::ecosystem(shell).context(MSG_FAILED_TO_FIND_ECOSYSTEM_ERR)?; diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/create.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/create.rs index 6ca3df550f81..2fb894859a0a 100644 --- a/zkstack_cli/crates/zkstack/src/commands/ecosystem/create.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/create.rs @@ -12,7 +12,6 @@ use xshell::Shell; use crate::{ commands::{ chain::create_chain_inner, - containers::{initialize_docker, start_containers}, ecosystem::{ args::create::EcosystemCreateArgs, create_configs::{ @@ -29,6 +28,8 @@ use crate::{ }, }; +use super::containers::{initialize_docker, start_containers}; + pub fn run(args: EcosystemCreateArgs, shell: &Shell) -> anyhow::Result<()> { match ZkStackConfig::ecosystem(shell) { Ok(_) => bail!(MSG_ECOSYSTEM_ALREADY_EXISTS_ERR), diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/mod.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/mod.rs index 3f4aa7565e19..bb4ec8fb9ca8 100644 --- a/zkstack_cli/crates/zkstack/src/commands/ecosystem/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/mod.rs @@ -1,4 +1,4 @@ -use args::build_transactions::BuildTransactionsArgs; +use args::{build_transactions::BuildTransactionsArgs, containers::ContainersArgs}; use clap::Subcommand; use xshell::Shell; @@ -10,6 +10,7 @@ mod args; pub(crate) mod build_transactions; mod change_default; mod common; +pub(crate) mod containers; mod create; pub mod create_configs; pub(crate) mod init; @@ -34,6 +35,9 @@ pub enum EcosystemCommands { /// downloading Grafana dashboards from the era-observability repo #[command(alias = "obs")] SetupObservability, + /// Run containers for local development + #[command(alias = "up")] + Containers(ContainersArgs), } pub(crate) async fn run(shell: &Shell, args: EcosystemCommands) -> anyhow::Result<()> { @@ -43,5 +47,6 @@ pub(crate) async fn run(shell: &Shell, args: EcosystemCommands) -> anyhow::Resul EcosystemCommands::Init(args) => init::run(args, shell).await, EcosystemCommands::ChangeDefaultChain(args) => change_default::run(args, shell), EcosystemCommands::SetupObservability => setup_observability::run(shell), + EcosystemCommands::Containers(args) => containers::run(shell, args).await, } } diff --git a/zkstack_cli/crates/zkstack/src/commands/mod.rs b/zkstack_cli/crates/zkstack/src/commands/mod.rs index 9e63173e94bb..27d396b9a2e1 100644 --- a/zkstack_cli/crates/zkstack/src/commands/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/mod.rs @@ -1,7 +1,6 @@ pub mod args; pub mod autocomplete; pub mod chain; -pub mod containers; pub mod dev; pub mod ecosystem; pub mod explorer; diff --git a/zkstack_cli/crates/zkstack/src/main.rs b/zkstack_cli/crates/zkstack/src/main.rs index d721ceaab71f..257c57c5417a 100644 --- a/zkstack_cli/crates/zkstack/src/main.rs +++ b/zkstack_cli/crates/zkstack/src/main.rs @@ -1,6 +1,6 @@ use clap::{command, Parser, Subcommand}; use commands::{ - args::{AutocompleteArgs, ContainersArgs, UpdateArgs}, + args::{AutocompleteArgs, UpdateArgs}, dev::DevCommands, }; use common::{ @@ -58,9 +58,6 @@ pub enum ZkStackSubcommands { /// External Node related commands #[command(subcommand, alias = "en")] ExternalNode(ExternalNodeCommands), - /// Run containers for local development - #[command(alias = "up")] - Containers(ContainersArgs), /// Run dapp-portal Portal, /// Run block-explorer @@ -127,7 +124,6 @@ async fn run_subcommand(zkstack_args: ZkStack) -> anyhow::Result<()> { ZkStackSubcommands::Chain(args) => commands::chain::run(&shell, *args).await?, ZkStackSubcommands::Dev(args) => commands::dev::run(&shell, args).await?, ZkStackSubcommands::Prover(args) => commands::prover::run(&shell, args).await?, - ZkStackSubcommands::Containers(args) => commands::containers::run(&shell, args)?, ZkStackSubcommands::ExternalNode(args) => { commands::external_node::run(&shell, args).await? }