-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve starting emulator docs (#1038)
* Improve starting emulator docs * Move config to above running --------- Co-authored-by: Chase Fleming <1666730+chasefleming@users.noreply.github.com>
- Loading branch information
1 parent
18866f1
commit e28d351
Showing
1 changed file
with
47 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,70 @@ | ||
--- | ||
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](https://docs.onflow.org/flow-cli/), which makes starting and configuring the emulator straightforward. | ||
|
||
```shell | ||
flow emulator | ||
## 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 | ||
``` | ||
|
||
⚠️ The emulator command expects configuration to be initialized. See [flow init](../flow.json/initialize-configuration.md) command. | ||
This initializes a default configuration file that the emulator will use. | ||
|
||
## Starting the Emulator | ||
|
||
To start the emulator with default settings, use the following command: | ||
|
||
```bash | ||
flow emulator | ||
``` | ||
|
||
This will start the emulator with the configuration defined in `flow.json`. | ||
|
||
## Example Usage | ||
### Example Output | ||
|
||
```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 | ||
``` | ||
|
||
To learn more about using the Emulator, have a look at the [README of the repository](https://github.com/onflow/flow-emulator). | ||
## Customizing the Emulator | ||
|
||
## Flags | ||
You can customize the emulator behavior by using flags. Here are some examples: | ||
|
||
### 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. | ||
Change the gRPC and REST API ports: | ||
|
||
### Configuration | ||
```bash | ||
flow emulator --port 9000 --rest-port 9001 | ||
``` | ||
|
||
Enable persistence of state across restarts: | ||
|
||
- Flag: `--config-path` | ||
- Short Flag: `-f` | ||
- Valid inputs: valid filename | ||
```bash | ||
flow emulator --persist | ||
``` | ||
|
||
Specify a filename for the configuration files, you can provide multiple configuration | ||
files by using `-f` flag multiple times. | ||
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. | ||
To explore advanced features like snapshots, rollbacks, and debugging, visit the [Flow Emulator README](https://github.com/onflow/flow-emulator). |