diff --git a/FULL_HELP_DOCS.md b/FULL_HELP_DOCS.md index 6f3882ce6..581c2cb87 100644 --- a/FULL_HELP_DOCS.md +++ b/FULL_HELP_DOCS.md @@ -47,7 +47,8 @@ Anything after the `--` double dash (the "slop") is parsed as arguments to the c * `events` — Watch the network for contract events * `env` — Prints the current environment variables or defaults to the stdout, in a format that can be used as .env file. Environment variables have precedency over defaults * `keys` — Create and manage identities including keys and addresses -* `network` — Start and configure networks +* `network` — Configure connection to networks +* `container` — Start local networks in containers * `snapshot` — Download a snapshot of a ledger from an archive * `tx` — Sign, Simulate, and Send transactions * `xdr` — Decode and encode XDR @@ -1105,7 +1106,7 @@ Set the default identity that will be used on all commands. This allows you to s ## `stellar network` -Start and configure networks +Configure connection to networks **Usage:** `stellar network ` @@ -1117,7 +1118,7 @@ Start and configure networks * `start` — ⚠️ Deprecated: use `stellar container start` instead * `stop` — ⚠️ Deprecated: use `stellar container stop` instead * `use` — Set the default network that will be used on all commands. This allows you to skip `--network` or setting a environment variable, while reusing this value in all commands that require it -* `container` — Commands to start, stop and get logs for a quickstart container +* `container` — ⚠️ Deprecated: use `stellar container` instead @@ -1245,6 +1246,8 @@ Set the default network that will be used on all commands. This allows you to sk ## `stellar network container` +⚠️ Deprecated: use `stellar container` instead + Commands to start, stop and get logs for a quickstart container **Usage:** `stellar network container ` @@ -1253,7 +1256,7 @@ Commands to start, stop and get logs for a quickstart container * `logs` — Get logs from a running network container * `start` — Start a container running a Stellar node, RPC, API, and friendbot (faucet) -* `stop` — Stop a network container started with `network container start` +* `stop` — Stop a network container started with `stellar container start` @@ -1277,7 +1280,7 @@ Get logs from a running network container Start a container running a Stellar node, RPC, API, and friendbot (faucet). -`stellar network container start NETWORK [OPTIONS]` +`stellar container start NETWORK [OPTIONS]` By default, when starting a testnet container, without any optional arguments, it will run the equivalent of the following docker command: @@ -1307,7 +1310,7 @@ By default, when starting a testnet container, without any optional arguments, i ## `stellar network container stop` -Stop a network container started with `network container start` +Stop a network container started with `stellar container start` **Usage:** `stellar network container stop [OPTIONS] ` @@ -1321,6 +1324,84 @@ Stop a network container started with `network container start` +## `stellar container` + +Start local networks in containers + +**Usage:** `stellar container ` + +###### **Subcommands:** + +* `logs` — Get logs from a running network container +* `start` — Start a container running a Stellar node, RPC, API, and friendbot (faucet) +* `stop` — Stop a network container started with `stellar container start` + + + +## `stellar container logs` + +Get logs from a running network container + +**Usage:** `stellar container logs [OPTIONS] ` + +###### **Arguments:** + +* `` — Container to get logs from + +###### **Options:** + +* `-d`, `--docker-host ` — Optional argument to override the default docker host. This is useful when you are using a non-standard docker host path for your Docker-compatible container runtime, e.g. Docker Desktop defaults to $HOME/.docker/run/docker.sock instead of /var/run/docker.sock + + + +## `stellar container start` + +Start a container running a Stellar node, RPC, API, and friendbot (faucet). + +`stellar container start NETWORK [OPTIONS]` + +By default, when starting a testnet container, without any optional arguments, it will run the equivalent of the following docker command: + +`docker run --rm -p 8000:8000 --name stellar stellar/quickstart:testing --testnet --enable rpc,horizon` + +**Usage:** `stellar container start [OPTIONS] ` + +###### **Arguments:** + +* `` — Network to start + + Possible values: `local`, `testnet`, `futurenet`, `pubnet` + + +###### **Options:** + +* `-d`, `--docker-host ` — Optional argument to override the default docker host. This is useful when you are using a non-standard docker host path for your Docker-compatible container runtime, e.g. Docker Desktop defaults to $HOME/.docker/run/docker.sock instead of /var/run/docker.sock +* `--name ` — Optional argument to specify the container name +* `-l`, `--limits ` — Optional argument to specify the limits for the local network only +* `-p`, `--ports-mapping ` — Argument to specify the `HOST_PORT:CONTAINER_PORT` mapping + + Default value: `8000:8000` +* `-t`, `--image-tag-override ` — Optional argument to override the default docker image tag for the given network +* `--protocol-version ` — Optional argument to specify the protocol version for the local network only + + + +## `stellar container stop` + +Stop a network container started with `stellar container start` + +**Usage:** `stellar container stop [OPTIONS] ` + +###### **Arguments:** + +* `` — Container to stop + +###### **Options:** + +* `-d`, `--docker-host ` — Optional argument to override the default docker host. This is useful when you are using a non-standard docker host path for your Docker-compatible container runtime, e.g. Docker Desktop defaults to $HOME/.docker/run/docker.sock instead of /var/run/docker.sock + + + ## `stellar snapshot` Download a snapshot of a ledger from an archive diff --git a/cmd/soroban-cli/src/commands/network/container/logs.rs b/cmd/soroban-cli/src/commands/container/logs.rs similarity index 94% rename from cmd/soroban-cli/src/commands/network/container/logs.rs rename to cmd/soroban-cli/src/commands/container/logs.rs index aaccffdde..85824b06c 100644 --- a/cmd/soroban-cli/src/commands/network/container/logs.rs +++ b/cmd/soroban-cli/src/commands/container/logs.rs @@ -1,7 +1,7 @@ use futures_util::TryStreamExt; use crate::{ - commands::{global, network::container::shared::Error as ConnectionError}, + commands::{container::shared::Error as ConnectionError, global}, print, }; diff --git a/cmd/soroban-cli/src/commands/network/container.rs b/cmd/soroban-cli/src/commands/container/mod.rs similarity index 91% rename from cmd/soroban-cli/src/commands/network/container.rs rename to cmd/soroban-cli/src/commands/container/mod.rs index d14dc72e4..08203095d 100644 --- a/cmd/soroban-cli/src/commands/network/container.rs +++ b/cmd/soroban-cli/src/commands/container/mod.rs @@ -16,13 +16,13 @@ pub enum Cmd { Logs(logs::Cmd), /// Start a container running a Stellar node, RPC, API, and friendbot (faucet). /// - /// `stellar network container start NETWORK [OPTIONS]` + /// `stellar container start NETWORK [OPTIONS]` /// /// By default, when starting a testnet container, without any optional arguments, it will run the equivalent of the following docker command: /// /// `docker run --rm -p 8000:8000 --name stellar stellar/quickstart:testing --testnet --enable rpc,horizon` Start(start::Cmd), - /// Stop a network container started with `network container start`. + /// Stop a network container started with `stellar container start`. Stop(stop::Cmd), } diff --git a/cmd/soroban-cli/src/commands/network/container/shared.rs b/cmd/soroban-cli/src/commands/container/shared.rs similarity index 100% rename from cmd/soroban-cli/src/commands/network/container/shared.rs rename to cmd/soroban-cli/src/commands/container/shared.rs diff --git a/cmd/soroban-cli/src/commands/network/container/start.rs b/cmd/soroban-cli/src/commands/container/start.rs similarity index 99% rename from cmd/soroban-cli/src/commands/network/container/start.rs rename to cmd/soroban-cli/src/commands/container/start.rs index 2f16d3c1e..6c5a5c291 100644 --- a/cmd/soroban-cli/src/commands/network/container/start.rs +++ b/cmd/soroban-cli/src/commands/container/start.rs @@ -9,8 +9,8 @@ use futures_util::TryStreamExt; use crate::{ commands::{ + container::shared::{Error as ConnectionError, Network}, global, - network::container::shared::{Error as ConnectionError, Network}, }, print, }; diff --git a/cmd/soroban-cli/src/commands/network/container/stop.rs b/cmd/soroban-cli/src/commands/container/stop.rs similarity index 95% rename from cmd/soroban-cli/src/commands/network/container/stop.rs rename to cmd/soroban-cli/src/commands/container/stop.rs index 77f674c46..6211c629f 100644 --- a/cmd/soroban-cli/src/commands/network/container/stop.rs +++ b/cmd/soroban-cli/src/commands/container/stop.rs @@ -1,5 +1,5 @@ use crate::{ - commands::{global, network::container::shared::Error as BollardConnectionError}, + commands::{container::shared::Error as BollardConnectionError, global}, print, }; diff --git a/cmd/soroban-cli/src/commands/mod.rs b/cmd/soroban-cli/src/commands/mod.rs index f1febae27..f4344fb9d 100644 --- a/cmd/soroban-cli/src/commands/mod.rs +++ b/cmd/soroban-cli/src/commands/mod.rs @@ -7,6 +7,7 @@ use crate::config; pub mod cache; pub mod completion; +pub mod container; pub mod contract; pub mod env; pub mod events; @@ -113,6 +114,7 @@ impl Root { Cmd::Events(events) => events.run().await?, Cmd::Xdr(xdr) => xdr.run()?, Cmd::Network(network) => network.run(&self.global_args).await?, + Cmd::Container(container) => container.run(&self.global_args).await?, Cmd::Snapshot(snapshot) => snapshot.run(&self.global_args).await?, Cmd::Version(version) => version.run(), Cmd::Keys(id) => id.run(&self.global_args).await?, @@ -150,10 +152,14 @@ pub enum Cmd { #[command(subcommand)] Keys(keys::Cmd), - /// Start and configure networks + /// Configure connection to networks #[command(subcommand)] Network(network::Cmd), + /// Start local networks in containers + #[command(subcommand)] + Container(container::Cmd), + /// Download a snapshot of a ledger from an archive. #[command(subcommand)] Snapshot(snapshot::Cmd), @@ -201,6 +207,9 @@ pub enum Error { #[error(transparent)] Network(#[from] network::Error), + #[error(transparent)] + Container(#[from] container::Error), + #[error(transparent)] Snapshot(#[from] snapshot::Error), diff --git a/cmd/soroban-cli/src/commands/network/mod.rs b/cmd/soroban-cli/src/commands/network/mod.rs index a7519bc83..5cc2acc43 100644 --- a/cmd/soroban-cli/src/commands/network/mod.rs +++ b/cmd/soroban-cli/src/commands/network/mod.rs @@ -5,7 +5,6 @@ use crate::rpc::{self}; use super::{config::locator, global}; pub mod add; -pub mod container; pub mod default; pub mod ls; pub mod rm; @@ -32,12 +31,12 @@ pub enum Cmd { /// By default, when starting a testnet container, without any optional arguments, it will run the equivalent of the following docker command: /// /// `docker run --rm -p 8000:8000 --name stellar stellar/quickstart:testing --testnet --enable rpc,horizon` - Start(container::StartCmd), + Start(crate::commands::container::StartCmd), /// ⚠️ Deprecated: use `stellar container stop` instead /// /// Stop a network started with `network start`. For example, if you ran `stellar network start local`, you can use `stellar network stop local` to stop it. - Stop(container::StopCmd), + Stop(crate::commands::container::StopCmd), /// Set the default network that will be used on all commands. /// This allows you to skip `--network` or setting a environment variable, @@ -45,9 +44,11 @@ pub enum Cmd { #[command(name = "use")] Default(default::Cmd), + /// ⚠️ Deprecated: use `stellar container` instead + /// /// Commands to start, stop and get logs for a quickstart container #[command(subcommand)] - Container(container::Cmd), + Container(crate::commands::container::Cmd), } #[derive(thiserror::Error, Debug)] @@ -66,14 +67,14 @@ pub enum Error { // TODO: remove once `network start` is removed #[error(transparent)] - Start(#[from] container::start::Error), + Start(#[from] crate::commands::container::start::Error), // TODO: remove once `network stop` is removed #[error(transparent)] - Stop(#[from] container::stop::Error), + Stop(#[from] crate::commands::container::stop::Error), #[error(transparent)] - Container(#[from] container::Error), + Container(#[from] crate::commands::container::Error), #[error(transparent)] Config(#[from] locator::Error), @@ -103,12 +104,14 @@ impl Cmd { // TODO Remove this once `network start` is removed Cmd::Start(cmd) => { - eprintln!("⚠️ Warning: `network start` has been deprecated. Use `network container start` instead"); + eprintln!("⚠️ Warning: `network start` has been deprecated. Use `container start` instead"); cmd.run(global_args).await?; } // TODO Remove this once `network stop` is removed Cmd::Stop(cmd) => { - println!("⚠️ Warning: `network stop` has been deprecated. Use `network container stop` instead"); + println!( + "⚠️ Warning: `network stop` has been deprecated. Use `container stop` instead" + ); cmd.run(global_args).await?; } };