Skip to content

Commit

Permalink
adding quickstart to simulator
Browse files Browse the repository at this point in the history
Signed-off-by: Atanas Atanasov <[email protected]>
  • Loading branch information
ata-nas committed Nov 1, 2024
1 parent 077e308 commit 0644e6d
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 46 deletions.
24 changes: 18 additions & 6 deletions server/docs/quickstart.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Quickstart of the Server

## Table of Contents

1. [Configuration](#configuration)
1. [Running locally](#running-locally)
1. [Build the Server](#build-the-server)
Expand All @@ -14,32 +15,43 @@ Refer to the [Configuration](configuration.md) for configuration options.

## Running locally:

Assuming your working directory is the repo root:
- Server subproject qualifier: `:server`
- Assuming your working directory is the repo root

> **NOTE:** using the `-p` flag for `./gradlew` so not to specify the target subproject
> on each task when running multiple tasks, but using the qualifier `:server:` when
> we have only one task to run.
### Build the Server

> **NOTE:** if you have not done so already, it is
> generally recommended to build the entire repo first:
> ```bash
> ./gradlew clean build -x test
> ```
1. To quickly build the Server sources (without running tests), do the following:
```bash
./gradlew clean build -x test
./gradlew -p server clean build -x test
```
1. To build the Server docker image, do the following:
```bash
./gradlew createDockerImage
./gradlew :server:createDockerImage
```
### Run the Server
1. To start the Server, do the following:
```bash
./gradlew startDockerContainer
./gradlew :server:startDockerContainer
```
### Run the Server with Debug
1. To start the Server with debug enabled, do the following:
```bash
./gradlew startDockerDebugContainer
./gradlew :server:startDockerDebugContainer
```
1. Attach your remote jvm debugger to port 5005.
Expand All @@ -48,5 +60,5 @@ Assuming your working directory is the repo root:
1. To stop the Server do the following:
```bash
./gradlew stopDockerContainer
./gradlew :server:stopDockerContainer
```
38 changes: 8 additions & 30 deletions simulator/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Block Stream Simulator

## Table of Contents
1. [Overview](#overview)
1. [Project Design Structure](#project-design-structure)
1. [Configuration](#configuration)
1. [Quickstart](#quickstart)

## Overview

The Block Stream Simulator is designed to simulate block streaming for Hedera Hashgraph.
It uses various configuration sources and dependency injection to manage its components.

## Prerequisites

- Java 21
- Gradle
- IntelliJ IDEA (recommended for development)

## Project Design Structure

Uses Dagger2 for dependency injection, the project has a modular structure and divides the Dagger dependencies into modules, but all modules used can be found at the root Injection Module:
Expand All @@ -33,28 +33,6 @@ The BlockStreamSimulatorApp consumes other services that are injected using Dagg

Refer to the [Configuration](docs/configuration.md) for configuration options.

## Building the Project

To build the project, run the following command:

```sh
./gradlew :simulator:build
```

## Running the Project
## Quickstart

Usually you will want to run a Block-Node server before the simulator, for that you can use the following commnad:

```sh
./gradlew :server:run
```
However we recommend running the block-node server as a docker container:
```sh
./gradlew :server:build :server:createDockerImage :server:startDockerContainer
```

Once the project is built, you can run it using the following command:

```sh
./gradlew :simulator:run
```
Refer to the [Quickstart](docs/quickstart.md) for a quick guide on how to get started with the application.
19 changes: 9 additions & 10 deletions simulator/docs/configuration.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
## Configuration
# Configuration

There are 2 configuration sets:
1. BlockStreamConfig: contains the configuration for the Block Stream Simulator logic and the generation module.
2. GrpcConfig: contains the configuration for the gRPC communication with the Block-Node.
There are 3 configuration sets:
1. [BlockStreamConfig](#blockstreamconfig): contains the configuration for the Block Stream Simulator logic.
1. [GeneratorConfig](#generatorconfig): contains the configuration for the Block Stream Simulator generation module.
1. [GrpcConfig](#grpcconfig): contains the configuration for the gRPC communication with the Block-Node.

### BlockStreamConfig
## BlockStreamConfig
Uses the prefix `blockStream` so all properties should start with `blockStream.`

| Key | Description | Default Value |
Expand All @@ -15,7 +16,7 @@ Uses the prefix `blockStream` so all properties should start with `blockStream.`
| `millisecondsPerBlock` | if streamingMode is `MILLIS_PER_BLOCK` this will be the time to wait between blocks in milliseconds | `1_000` |
| `blockItemsBatchSize` | the number of block items to send in a single batch, however if a block has less block items, it will send all the items in a block | `1_000` |

### GeneratorConfig
## GeneratorConfig
Uses the prefix `generator` so all properties should start with `generator.`
| Key | Description | Default Value |
|--------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------|
Expand All @@ -25,12 +26,10 @@ Uses the prefix `generator` so all properties should start with `generator.`
| `paddedLength` | on the `BlockAsFileLargeDataSets` implementation, the length of the padded left zeroes `000001.blk.gz` | 36 |
| `fileExtension` | on the `BlockAsFileLargeDataSets` implementation, the extension of the files to be streamed | `.blk.gz` |



### GrpcConfig
## GrpcConfig
Uses the prefix `grpc` so all properties should start with `grpc.`

| Key | Description | Default Value |
|-----------------|----------------------------|---------------|
| `serverAddress` | The host of the Block-Node | `localhost` |
| `port` | The port of the Block-Node | `8080` |
| `port` | The port of the Block-Node | `8080` |
58 changes: 58 additions & 0 deletions simulator/docs/quickstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Quickstart of the Simulator

## Table of Contents

1. [Configuration](#configuration)
1. [Running locally](#running-locally)
1. [Build the Simulator](#build-the-simulator)
1. [Run the Server first](#run-the-server-first)
1. [Run the Simulator](#run-the-simulator)
1. [Run the Simulator with Debug](#run-the-simulator-with-debug)

## Configuration

Refer to the [Configuration](configuration.md) for configuration options.

## Running locally:

- Simulator subproject qualifier:`:simulator`
- Assuming your working directory is the repo root

> **NOTE:** using the `-p` flag for `./gradlew` so not to specify the target subproject
> on each task when running multiple tasks, but using the qualifier `:simulator:` when
> we have only one task to run.
### Build the Simulator

> **NOTE:** if you have not done so already, it is
> generally recommended to build the entire repo first:
> ```bash
> ./gradlew clean build -x test
> ```
1. To quickly build the Simulator sources (without running tests), do the following:
```bash
./gradlew -p simulator clean build -x test
```
### Run the Server first
Usually, you would want to run the [Server](../../server/README.md) first, refer to the
[Quickstart of the Server](../../server/docs/quickstart.md) for a quick guide on how to
get started with the application.
### Run the Simulator
1. To start the Simulator, do the following:
```bash
./gradlew :simulator:run
```
### Run the Simulator with Debug
1. To start the Simulator with debug enabled, do the following:
```bash
./gradlew :simulator:run --debug-jvm
```
1. Attach your remote jvm debugger to port 5005.

0 comments on commit 0644e6d

Please sign in to comment.