Skip to content

Commit

Permalink
feat: remove replica and bootstrap commands (#3220)
Browse files Browse the repository at this point in the history
This just removes the commands from the command tree and disables the tests.  In the next version we can delete them, but I want one release where anyone who still relies on these will have to notice, before deleting the code.
  • Loading branch information
ericswanson-dfinity authored Jul 6, 2023
1 parent 41dc038 commit 209042d
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 99 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## DFX

### feat!: Removed dfx replica and dfx bootstrap commands

Use `dfx start` instead. If you have a good reason why we should keep these commands, please contribute to the discussion at https://github.com/dfinity/sdk/discussions/3163

### fix: Wait for new module hash when installing wallet

A previous change made dfx wait after installing a canister until the replica updated its reported module hash, but this change did not affect wallets. Now dfx waits for wallets too, to eliminate a class of wallet installation errors.
Expand Down
48 changes: 1 addition & 47 deletions docs/cli-reference/dfx-bootstrap.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,4 @@
# dfx bootstrap {#_dfx_bootstrap}

> **NOTE**: The bootstrap command is deprecated. Please use the [dfx start](./dfx-start.md) command instead. If you have a good reason to use the bootstrap command, please contribute to the [discussion](https://github.com/dfinity/sdk/discussions/3163).
> **NOTE**: The bootstrap command has been removed. Please use the [dfx start](./dfx-start.md) command instead. If you have a good reason to use the bootstrap command, please contribute to the [discussion](https://github.com/dfinity/sdk/discussions/3163).
Use the `dfx bootstrap` command to start the bootstrap web server defined in the `dfx.json` configuration file or specified using command-line options.

The bootstrap web server you specify is used to serve the front-end static assets for your project.

## Basic usage {#_basic_usage}

``` bash
dfx bootstrap [option]
```

## Options {#_options}

You can specify the following options for the `dfx bootstrap` command.

| Option | Description |
-----------------------|-----------------|
| `ip` <ip_address\> | Specifies the IP address that the bootstrap server listens on. If you don't specify an IP address, the `address` setting you have configured in the `dfx.json` configuration file is used. By default, the server address is 127.0.0.1. |
| \--network <network\> | Specifies the network to connect to if you want to override the default local network endpoint (`http://127.0.0.1:8080/api`).|
| \--port <port\> | Specifies the port number that the bootstrap server listens on. By default, port number 8081 is used. |
| \--timeout <timeout\> | Specifies the maximum amount of time, in seconds, the bootstrap server will wait for upstream requests to complete. By default, the bootstrap server waits for a maximum of 30 seconds. |

## Examples {#_examples}

You can use the `dfx bootstrap` command to start a web server for your application using custom settings, including a specific server address, port number, and static asset location.

For example, to start the bootstrap server using a specific IP address and port number, you would run a command similar to the following:

``` bash
dfx bootstrap --ip 192.168.47.1 --port 5353
```

The command displays output similar to the following:

``` bash
binding to: V4(192.168.47.1:5353)
replica(s): \http://127.0.0.1:8080/api
Webserver started...
```

To use the default server address and port number but specify a custom location for static assets and longer timeout period, you might run a command similar to the following:

``` bash
dfx bootstrap --root $HOME/ic-projects/assets --timeout 60
```

You can use CTRL-C to stop the bootstrap server.
39 changes: 1 addition & 38 deletions docs/cli-reference/dfx-replica.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,4 @@
# dfx replica

> **NOTE**: The replica command is deprecated. Please use the [dfx start](./dfx-start.md) command instead. If you have a good reason to use the replica command, please contribute to the [discussion](https://github.com/dfinity/sdk/discussions/3163).
> **NOTE**: The replica command has been removed. Please use the [dfx start](./dfx-start.md) command instead. If you have a good reason to use the replica command, please contribute to the [discussion](https://github.com/dfinity/sdk/discussions/3163).
Use the `dfx replica` command to start a local canister execution environment (without a web server). This command enables you to deploy canisters locally and to test your dapps during development.

By default, all local dfx projects will use a single shared local canister execution environment, and you can run `dfx replica` from any directory. See [Local Server Configuration](#local-server-configuration) and [Project-Specific Local Networks](dfx-start.md#project-specific-local-networks) for exceptions.

## Basic usage

``` bash
dfx replica [option] [flag]
```

## Flags

You can use the following optional flags with the `dfx replica` command.

| Flag | Description |
|-------------------|-----------------------------------------------------------------------------------------------|
| `--emulator` | Starts the [IC reference emulator](https://github.com/dfinity/ic-hs) rather than the replica. |
| `--enable-bitcoin`| Enables bitcoin integration. |
| `--enable-canister-http` | Enables canister HTTP requests. (deprecated: now enabled by default) |

## Options

You can use the following option with the `dfx replica` command.

| Option | Description |
|---------------------------|-------------------------------------------------------------------------------|
| `--port port` | Specifies the port the local canister execution environment should listen to. |
| `--bitcoin-node host:port` | Specifies the address of a bitcoind node. Implies `--enable-bitcoin`. |
| `--artificial-delay milliseconds` | Specifies the delay that an update call should incur. Default: 600ms |

## Examples

You can start the local canister execution environment by running the following command:

``` bash
dfx replica
```
12 changes: 10 additions & 2 deletions e2e/tests-dfx/bitcoin.bash
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ teardown() {
bitcoin-cli -regtest stop

dfx_stop
stop_dfx_replica
stop_dfx_bootstrap
# stop_dfx_replica
# stop_dfx_bootstrap
standard_teardown
}

Expand Down Expand Up @@ -90,6 +90,7 @@ set_local_network_bitcoin_enabled() {
}

@test "dfx restarts replica when ic-btc-adapter restarts - replica and bootstrap" {
skip "dfx replica and bootstrap are deprecated"
dfx_new hello
dfx_replica --enable-bitcoin
dfx_bootstrap
Expand Down Expand Up @@ -145,6 +146,8 @@ set_local_network_bitcoin_enabled() {
}

@test "dfx replica --bitcoin-node <node> implies --enable-bitcoin" {
skip "dfx replica and bootstrap are deprecated"

dfx_new hello
dfx_replica "--bitcoin-node" "127.0.0.1:18444"
dfx_bootstrap
Expand Down Expand Up @@ -172,6 +175,7 @@ set_local_network_bitcoin_enabled() {
}

@test "dfx replica --enable-bitcoin with no other configuration succeeds" {
skip "dfx replica and bootstrap are deprecated"
dfx_new hello

dfx_replica --enable-bitcoin
Expand Down Expand Up @@ -208,6 +212,7 @@ set_local_network_bitcoin_enabled() {
}

@test "can enable bitcoin through default configuration - dfx replica" {
skip "dfx replica and bootstrap are deprecated"
dfx_new hello
define_project_network
set_project_default_bitcoin_enabled
Expand All @@ -218,6 +223,7 @@ set_local_network_bitcoin_enabled() {
}

@test "can enable bitcoin through shared local network - dfx replica" {
skip "dfx replica and bootstrap are deprecated"
dfx_new hello
set_shared_local_network_bitcoin_enabled

Expand All @@ -241,6 +247,8 @@ set_local_network_bitcoin_enabled() {
}

@test "dfx replica+bootstrap with both bitcoin and canister http enabled" {
skip "dfx replica and bootstrap are deprecated"

dfx_new hello

dfx_replica --enable-bitcoin --enable-canister-http
Expand Down
8 changes: 6 additions & 2 deletions e2e/tests-dfx/bootstrap.bash
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,24 @@ setup() {
}

teardown() {
stop_dfx_replica
stop_dfx_bootstrap
# stop_dfx_replica
# stop_dfx_bootstrap

standard_teardown
}

@test "forbid starting webserver with a forwarded port" {
skip "dfx replica and bootstrap are deprecated"

[ "$USE_IC_REF" ] && skip "skipped for ic-ref"

assert_command_fail dfx bootstrap --port 4943
assert_match "Cannot forward API calls to the same bootstrap server"
}

@test "bootstrap supports http requests" {
skip "dfx replica and bootstrap are deprecated"

dfx_replica
dfx_bootstrap

Expand Down
12 changes: 10 additions & 2 deletions e2e/tests-dfx/canister_http.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ setup() {

teardown() {
dfx_stop
stop_dfx_replica
stop_dfx_bootstrap
# stop_dfx_replica
# stop_dfx_bootstrap
standard_teardown
}

Expand Down Expand Up @@ -100,6 +100,7 @@ set_shared_local_network_canister_http_empty() {
}

@test "dfx restarts replica when ic-https-outcalls-adapter restarts - replica and bootstrap" {
skip "dfx replica and bootstrap are deprecated"
dfx_new hello
dfx_replica
dfx_bootstrap
Expand Down Expand Up @@ -155,6 +156,7 @@ set_shared_local_network_canister_http_empty() {
}

@test "dfx replica --enable-canister-http with no other configuration succeeds" {
skip "dfx replica and bootstrap are deprecated"
dfx_new hello

dfx_replica --enable-canister-http
Expand Down Expand Up @@ -222,6 +224,7 @@ set_shared_local_network_canister_http_empty() {


@test "can enable http through project default configuration - dfx replica" {
skip "dfx replica and bootstrap are deprecated"
dfx_new hello
define_project_network
set_project_default_canister_http_enabled
Expand All @@ -232,6 +235,7 @@ set_shared_local_network_canister_http_empty() {
}

@test "can disable http through project default configuration - dfx replica" {
skip "dfx replica and bootstrap are deprecated"
dfx_new hello
define_project_network
set_project_default_canister_http_enabled false
Expand All @@ -242,6 +246,7 @@ set_shared_local_network_canister_http_empty() {
}

@test "can enable http through project local network - dfx replica" {
skip "dfx replica and bootstrap are deprecated"
dfx_new hello
define_project_network
set_project_local_network_canister_http_enabled
Expand All @@ -252,6 +257,7 @@ set_shared_local_network_canister_http_empty() {
}

@test "can disable http through project local network - dfx replica" {
skip "dfx replica and bootstrap are deprecated"
dfx_new hello
define_project_network
set_project_local_network_canister_http_enabled false
Expand All @@ -262,6 +268,7 @@ set_shared_local_network_canister_http_empty() {
}

@test "can enable http through shared local network - dfx replica" {
skip "dfx replica and bootstrap are deprecated"
dfx_new hello
set_shared_local_network_canister_http_enabled

Expand All @@ -271,6 +278,7 @@ set_shared_local_network_canister_http_empty() {
}

@test "can disable http through shared local network - dfx replica" {
skip "dfx replica and bootstrap are deprecated"
dfx_new hello
set_shared_local_network_canister_http_enabled false

Expand Down
4 changes: 2 additions & 2 deletions e2e/tests-dfx/inter.bash
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ setup() {

teardown() {
dfx_stop
stop_dfx_replica
stop_dfx_bootstrap
# stop_dfx_replica
# stop_dfx_bootstrap
standard_teardown
}

Expand Down
1 change: 1 addition & 0 deletions e2e/tests-dfx/signals.bash
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ teardown() {
}

dfx_replica_kills_replica() {
skip "dfx replica and bootstrap are deprecated"
signal=$1

dfx_patchelf
Expand Down
6 changes: 0 additions & 6 deletions src/dfx/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use anyhow::bail;
use clap::Subcommand;

mod beta;
mod bootstrap;
mod build;
mod cache;
mod canister;
Expand All @@ -26,7 +25,6 @@ mod nns;
mod ping;
mod quickstart;
mod remote;
mod replica;
mod schema;
mod sns;
mod start;
Expand All @@ -39,7 +37,6 @@ mod wallet;
pub enum Command {
#[command(hide = true)]
Beta(beta::BetaOpts),
Bootstrap(bootstrap::BootstrapOpts),
Build(build::CanisterBuildOpts),
Cache(cache::CacheOpts),
Canister(canister::CanisterOpts),
Expand All @@ -63,7 +60,6 @@ pub enum Command {
Ping(ping::PingOpts),
Quickstart(quickstart::QuickstartOpts),
Remote(remote::RemoteOpts),
Replica(replica::ReplicaOpts),
Schema(schema::SchemaOpts),
Sns(sns::SnsOpts),
Start(start::StartOpts),
Expand All @@ -76,7 +72,6 @@ pub enum Command {
pub fn exec(env: &dyn Environment, cmd: Command) -> DfxResult {
match cmd {
Command::Beta(v) => beta::exec(env, v),
Command::Bootstrap(v) => bootstrap::exec(env, v),
Command::Build(v) => build::exec(env, v),
Command::Cache(v) => cache::exec(env, v),
Command::Canister(v) => canister::exec(env, v),
Expand All @@ -96,7 +91,6 @@ pub fn exec(env: &dyn Environment, cmd: Command) -> DfxResult {
Command::Ping(v) => ping::exec(env, v),
Command::Quickstart(v) => quickstart::exec(env, v),
Command::Remote(v) => remote::exec(env, v),
Command::Replica(v) => replica::exec(env, v),
Command::Schema(v) => schema::exec(v),
Command::Sns(v) => sns::exec(env, v),
Command::Start(v) => start::exec(env, v),
Expand Down

0 comments on commit 209042d

Please sign in to comment.