From f8685c3d89b3f4e266212afdc8ba6381497bec2d Mon Sep 17 00:00:00 2001 From: Mohammad Kermani Date: Sun, 3 Nov 2024 11:31:51 +0330 Subject: [PATCH 1/3] chore(global-test): add restart policy to compose files --- tests/global/src/node/docker-compose.yaml | 1 + tests/global/src/relay/docker-compose.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/global/src/node/docker-compose.yaml b/tests/global/src/node/docker-compose.yaml index 1629abc..0a28a8c 100644 --- a/tests/global/src/node/docker-compose.yaml +++ b/tests/global/src/node/docker-compose.yaml @@ -16,6 +16,7 @@ services: - ${LOGS_DIRECTORY:-./logs}:/app/tests/global/logs depends_on: - influxdb + restart: always influxdb: image: influxdb diff --git a/tests/global/src/relay/docker-compose.yaml b/tests/global/src/relay/docker-compose.yaml index 81b651b..5974720 100644 --- a/tests/global/src/relay/docker-compose.yaml +++ b/tests/global/src/relay/docker-compose.yaml @@ -12,6 +12,7 @@ services: volumes: - rosenet-relay-pk:/app/tests/global/.rosenet - ${LOGS_DIRECTORY:-./logs}:/app/tests/global/logs + restart: always volumes: rosenet-relay-pk: From a210ff340c9eef0f9a49e211a20c88fdb34dd202 Mon Sep 17 00:00:00 2001 From: Mohammad Kermani Date: Sun, 3 Nov 2024 11:32:21 +0330 Subject: [PATCH 2/3] doc(global-test): improve README --- tests/global/README.md | 72 ++++++++++++++++++++++++++++++++---------- 1 file changed, 56 insertions(+), 16 deletions(-) diff --git a/tests/global/README.md b/tests/global/README.md index 6e1fdce..6d86ff4 100644 --- a/tests/global/README.md +++ b/tests/global/README.md @@ -1,9 +1,9 @@ -# RoseNet global test +# RoseNet Global Test -## Table of contents +## Table of Contents -- [RoseNet global test](#rosenet-global-test) - - [Table of contents](#table-of-contents) +- [RoseNet Global Test](#rosenet-global-test) + - [Table of Contents](#table-of-contents) - [System Requirements](#system-requirements) - [Quick Start](#quick-start) - [Detailed Setup Instructions](#detailed-setup-instructions) @@ -16,7 +16,7 @@ - Git - Docker and Docker Compose -- Access to a server with a public ip (for relay setup) +- Access to a server with a public IP (for relay setup) ## Quick Start @@ -33,7 +33,11 @@ cd rosenet/tests/global/src/node # Create service configuration file cp .env.example .env + # Edit .env file with your configuration +vim .env # Use editor of your choice + +# Start the service docker compose up -d ``` @@ -58,6 +62,10 @@ docker compose up -d - Required: - `WHITELIST`: Comma-separated list of allowed node peer IDs + - Optional: + - `PORT`: Relay service port + - `MAX_RESERVATIONS`: Maximum number of reservation slots, indicating how many nodes can connect to this relay + - `LOGS_DIRECTORY`: The path to the directory containing logs 4. **Launch Relay** @@ -67,7 +75,7 @@ docker compose up -d 5. **Get Relay Multiaddress** - - Check debug logs at `tests/global/src/relay/logs/debug/*.log` + - Check logs at `tests/global/src/relay/logs/info/*.log` - Format your multiaddress: ``` /ip4//tcp//p2p/ @@ -75,10 +83,10 @@ docker compose up -d /dns4//tcp//p2p/ ``` - For example, having this log entry in a server with ip address of `100.100.100.100`, domain of `example.com`, and default 44123 port: + For example, having this log entry in a server with IP address of `100.100.100.100`, domain of `example.com`, and default 44123 port: ```log - 2024-10-26T07:36:54.652Z debug: [rosenet] PeerId 12D3KooWDvTUsPV6DSCJXJWJQjSoJ4q172kPRe4MHgxYqTz7J4jp generated + 2024-10-26T07:36:54.652Z info: [rosenet] PeerId 12D3KooWDvTUsPV6DSCJXJWJQjSoJ4q172kPRe4MHgxYqTz7J4jp generated ``` Your multiaddr can be represented as either `/ip4/100.100.100.100/tcp/44123/p2p/12D3KooWDvTUsPV6DSCJXJWJQjSoJ4q172kPRe4MHgxYqTz7J4jp` or `/dns4/example.com/tcp/44123/p2p/12D3KooWDvTUsPV6DSCJXJWJQjSoJ4q172kPRe4MHgxYqTz7J4jp`. @@ -89,7 +97,7 @@ docker compose up -d ```bash git clone https://github.com/rosen-bridge/rosenet.git - cd tests/global/src/node + cd rosenet/tests/global/src/node ``` 2. **Configure Environment** @@ -102,6 +110,27 @@ docker compose up -d - Required: - `RELAY_MULTIADDRS`: Comma-separated list of relay multiaddresses + - Optional (Modify only if you understand the side effects of the changes): + - Message Configurations: + - `SHOULD_SEND_DIRECT_TO_OLD_PEERS`: Whether to send direct messages to previously connected but now disconnected peers + - `DIRECT_BURST_SIZE`: Number of direct messages to send in one burst (shared between all peers) + - `PUBSUB_BURST_SIZE`: Number of pubsub messages to send in one burst (affects network traffic) + - `MIN_MESSAGE_SIZE`: Minimum size for both direct and pubsub messages + - `MAX_MESSAGE_SIZE`: Maximum size for both direct and pubsub messages + - Timing Configuration: + - `MIN_IDLE_TIME`: Minimum wait time between bursts + - `MAX_IDLE_TIME`: Maximum wait time between bursts + - `MIN_SCNEARIO_DURATION`: Minimum duration for any scenario type + - `MAX_SCNEARIO_DURATION`: Maximum duration for any scenario type + - Service Configuration: + - `SERVICE_PORT`: Node service port + - `LOGS_DIRECTORY`: Path to logs directory + - InfluxDB Configuration: + - `INFLUXDB_HOST`: Host address (e.g., for exposing UI on all interfaces) + - `INFLUXDB_PORT`: Port number + - `INFLUXDB_USERNAME`: Custom username for security + - `INFLUXDB_PASSWORD`: Custom password for security + - `INFLUXDB_ADMIN_TOKEN`: Custom admin token for security 4. **Initial Run and Whitelisting** @@ -109,28 +138,38 @@ docker compose up -d docker compose up -d ``` - > **Note**: The first run will fail as your node needs whitelisting. Check debug logs at `tests/global/src/node/logs/debug/*.log` to find your node's peer ID. + > **Note**: The service will fail until your node is whitelisted in at least one relay. Check logs at `tests/global/src/node/logs/info/*.log` to find your node's peer ID. 5. **Complete Setup** - - Get your node's peer ID from the debug logs + + - Get your node's peer ID from the logs - Have it whitelisted in at least one relay - - Restart the service: + - Restart the service if it's stopped for some reason: ```bash docker compose up -d ``` + > **Note**: Docker compose restart policy of the node is set to always. So by default, you don't need to run step 3, and only need to wait for the whitelisting. + ## Test Execution -Once properly configured, your node will automatically participate in the test network by sending and receiving pubsub and direct messages, and logging relevant activities. +Once properly configured, your node will automatically participate in the test network by sending and receiving pubsub and direct messages, and logging relevant activities. The test operates through randomly selected scenarios: + +- **Break**: No messages sent +- **Direct**: Only direct messages +- **Pubsub**: Only pubsub messages +- **Combined**: Both direct and pubsub messages + +Each scenario consists of multiple bursts, with idle periods between them to prevent resource exhaustion. All durations (idle times, bursts, and scenarios) are randomly chosen within the configured ranges, with reasonable defaults provided. ## Data Collection and Analysis -After the test is over, the results can be analyzed by checking the database of the nodes: +After the test is over, analyze the results through the node's database: 1. **Access InfluxDB Dashboard** - - URL: `http://localhost:8086` - - Credentials: + - Default URL (unless customized in environment variables): `http://localhost:8086` + - Default credentials (unless customized in environment variables): - Username: `admin` - Password: `admin1234` @@ -138,4 +177,5 @@ After the test is over, the results can be analyzed by checking the database of - Navigate to "Data Explorer" - Select bucket: `RoseNet` - Choose measurements: `direct` and `pubsub` + - Change period to an appropriate one (e.g., a week) - Export data using the CSV button From e152394f5246e9d2c9e9130bc0a28490a572b055 Mon Sep 17 00:00:00 2001 From: Mohammad Kermani Date: Sun, 3 Nov 2024 11:34:08 +0330 Subject: [PATCH 3/3] chore: add an empty changeset --- .changeset/silly-radios-shake.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .changeset/silly-radios-shake.md diff --git a/.changeset/silly-radios-shake.md b/.changeset/silly-radios-shake.md new file mode 100644 index 0000000..a845151 --- /dev/null +++ b/.changeset/silly-radios-shake.md @@ -0,0 +1,2 @@ +--- +---