From 621058aa0e42854660dc6c0866beb259b402f9bc Mon Sep 17 00:00:00 2001 From: Chase Fleming <1666730+chasefleming@users.noreply.github.com> Date: Wed, 11 Dec 2024 10:41:11 -0800 Subject: [PATCH 1/2] Improve starting emulator docs --- .../flow-cli/deployment/start-emulator.md | 71 +++++++++++++------ 1 file changed, 48 insertions(+), 23 deletions(-) diff --git a/docs/tools/flow-cli/deployment/start-emulator.md b/docs/tools/flow-cli/deployment/start-emulator.md index bf299dd3a1..a14446f6b1 100644 --- a/docs/tools/flow-cli/deployment/start-emulator.md +++ b/docs/tools/flow-cli/deployment/start-emulator.md @@ -1,47 +1,72 @@ --- title: Start Emulator -description: How to start Flow emulator from the command line +description: How to start the Flow Emulator from the command line sidebar_position: 1 --- -The Flow CLI provides a command to start an emulator. -The Flow Emulator is a lightweight tool that emulates the behaviour of the real Flow network. +The Flow Emulator is a lightweight development tool that mimics the behavior of the real Flow network. It is bundled with the [Flow CLI](../install.md), which makes starting and configuring the emulator straightforward. -```shell +## Starting the Emulator + +To start the emulator with default settings, use the following command: + +```bash flow emulator ``` -⚠️ The emulator command expects configuration to be initialized. See [flow init](../flow.json/initialize-configuration.md) command. +This will start the emulator with a default configuration. +### Example Output -## Example Usage - -```shell -> flow emulator +When you run the `flow emulator` command, you will see output similar to the following: +```bash INFO[0000] ⚙️ Using service account 0xf8d6e0586b0a20c7 serviceAddress=f8d6e0586b0a20c7 ... -... +INFO[0000] 🌱 Starting Flow Emulator +INFO[0000] 🛠 GRPC server started on 127.0.0.1:3569 +INFO[0000] 📡 HTTP server started on 127.0.0.1:8080 +``` + +### Initial Configuration + +The emulator requires a configuration file (`flow.json`). If you don’t already have one, create it using the `flow init` command: + +```bash +flow init ``` -To learn more about using the Emulator, have a look at the [README of the repository](https://github.com/onflow/flow-emulator). +This initializes a default configuration file that the emulator will use. + +## Customizing the Emulator -## Flags +You can customize the emulator behavior by using flags. Below are some commonly used flags: ### Emulator Flags -You can specify any [emulator flags found here](https://github.com/onflow/flow-emulator#configuration) and they will be applied to the emulator service. -### Configuration +**Port Configuration**: Change the gRPC and REST API ports: -- Flag: `--config-path` -- Short Flag: `-f` -- Valid inputs: valid filename +```bash +flow emulator --port 9000 --rest-port 9001 +``` + +**Persistence**: Enable persistence of state across restarts: + +```bash +flow emulator --persist +``` -Specify a filename for the configuration files, you can provide multiple configuration -files by using `-f` flag multiple times. +**Verbose Logging**: Enable detailed logs for debugging: -### Version Check +```bash +flow emulator --verbose +``` + +For a complete list of available flags, run: + +```bash +flow emulator --help +``` -- Flag: `--skip-version-check` -- Default: `false` +## Learn More -Skip version check during start up to speed up process for slow connections. \ No newline at end of file +To explore advanced features like snapshots, rollbacks, and debugging, visit the [Flow Emulator README](https://github.com/onflow/flow-emulator). \ No newline at end of file From 396f439383442b479ed1169abc514994c2a57cfd Mon Sep 17 00:00:00 2001 From: Chase Fleming <1666730+chasefleming@users.noreply.github.com> Date: Wed, 11 Dec 2024 10:50:06 -0800 Subject: [PATCH 2/2] Move config to above running --- .../flow-cli/deployment/start-emulator.md | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/docs/tools/flow-cli/deployment/start-emulator.md b/docs/tools/flow-cli/deployment/start-emulator.md index a14446f6b1..e5e55ff15b 100644 --- a/docs/tools/flow-cli/deployment/start-emulator.md +++ b/docs/tools/flow-cli/deployment/start-emulator.md @@ -4,7 +4,17 @@ description: How to start the Flow Emulator from the command line sidebar_position: 1 --- -The Flow Emulator is a lightweight development tool that mimics the behavior of the real Flow network. It is bundled with the [Flow CLI](../install.md), which makes starting and configuring the emulator straightforward. +The Flow Emulator is a lightweight development tool that mimics the behavior of the real Flow network. It is bundled with the [Flow CLI](https://docs.onflow.org/flow-cli/), which makes starting and configuring the emulator straightforward. + +## Initial Configuration + +The emulator requires a configuration file (`flow.json`). If you don’t already have one, create it using the `flow init` command: + +```bash +flow init +``` + +This initializes a default configuration file that the emulator will use. ## Starting the Emulator @@ -14,7 +24,7 @@ To start the emulator with default settings, use the following command: flow emulator ``` -This will start the emulator with a default configuration. +This will start the emulator with the configuration defined in `flow.json`. ### Example Output @@ -27,35 +37,23 @@ INFO[0000] 🛠 GRPC server started on 127.0.0.1:3569 INFO[0000] 📡 HTTP server started on 127.0.0.1:8080 ``` -### Initial Configuration - -The emulator requires a configuration file (`flow.json`). If you don’t already have one, create it using the `flow init` command: - -```bash -flow init -``` - -This initializes a default configuration file that the emulator will use. - ## Customizing the Emulator -You can customize the emulator behavior by using flags. Below are some commonly used flags: - -### Emulator Flags +You can customize the emulator behavior by using flags. Here are some examples: -**Port Configuration**: Change the gRPC and REST API ports: +Change the gRPC and REST API ports: ```bash flow emulator --port 9000 --rest-port 9001 ``` -**Persistence**: Enable persistence of state across restarts: +Enable persistence of state across restarts: ```bash flow emulator --persist ``` -**Verbose Logging**: Enable detailed logs for debugging: +Enable detailed logs for debugging: ```bash flow emulator --verbose