Skip to content

Commit

Permalink
Merge pull request #364 from ava-labs/simplify-install-instructions
Browse files Browse the repository at this point in the history
simplify README sections for install and build
  • Loading branch information
felipemadero authored Nov 28, 2022
2 parents 3e03e70 + 78e1cdd commit 362f137
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 54 deletions.
69 changes: 16 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,106 +11,69 @@ This tool may be especially useful for development and testing.

## Installation

### Using install script

This is the preferred way. Does not require golang to be installed on the system.

To download a binary for the latest release, run:

```sh
curl -sSfL https://raw.githubusercontent.com/ava-labs/avalanche-network-runner/main/scripts/install.sh | sh -s
```

The binary will be installed inside the `./bin` directory (relative to where the install command was run).

_Downloading binaries from the Github UI will cause permission errors on Mac._
The binary will be installed inside the `~/bin` directory.

To add the binary to your path, run

```sh
cd bin
export PATH=$PWD:$PATH
export PATH=~/bin:$PATH
```

To add it to your path permanently, add an export command to your shell initialization script (ex: .bashrc).

#### Installing in Custom Location

To download the binary into a specific directory, run:

```sh
curl -sSfL https://raw.githubusercontent.com/ava-labs/avalanche-network-runner/main/scripts/install.sh | sh -s -- -b <relative directory>
```
## Build from source code

### Install using golang
This is only needed by advanced users who want to modify or test Avalanche Network Runner in specific ways.

Requires golang to be installed on the system ([https://go.dev/doc/install](https://go.dev/doc/install)).

### Download

```sh
go install github.com/ava-labs/avalanche-network-runner@latest
git clone https://github.com/ava-labs/avalanche-network-runner.git
```

After that, the `avalanche-network-runner` binary should be present under the `$HOME/go/bin/` directory. Consider adding this directory to the `PATH` environment variable.

### Install by release download

Does not require golang to be installed on the system.

Download the desired distribution from [https://github.com/ava-labs/avalanche-network-runner/releases](https://github.com/ava-labs/avalanche-network-runner/releases).

Uncompress and locate where is convenient. Consider adding the target bin directory to the `PATH` environment variable.

### Install from source code and execute tests
### Build

#### Download
From inside the cloned directory:

```sh
git clone https://github.com/ava-labs/avalanche-network-runner.git
./scripts/build.sh
```

#### Install
The binary will be installed inside the `./bin` directory.

From inside the cloned directory:
To add the binary to your path, run

```sh
go install
export PATH=$PWD/bin:$PATH
```

After that, `avalanche-network-runner` binary should be present under `$HOME/go/bin/` directory. Consider adding this directory to the `PATH` environment variable.

#### Run Unit Tests
### Run Unit Tests

Inside the directory cloned above:

```sh
go test ./...
```

#### Run E2E tests
### Run E2E tests

The E2E test checks `avalanche-network-runner` RPC communication and control. It starts a network against a fresh RPC
server and executes a set of query and control operations on it.

To start it, execute inside the cloned directory:

```sh
./scripts/tests.e2e.sh AVALANCHEGO_VERSION1 AVALANCHEGO_VERSION2
./scripts/tests.e2e.sh
```

The E2E test checks whether a node can be restarted with a different binary version. Provide two
different versions as arguments. For Example:

```sh
./scripts/tests.e2e.sh 1.7.9 1.7.10
```

##### `RUN_E2E` environment variable

To specify that the E2E test should be run with `go test`, set environment variable `RUN_E2E` to any non-empty value.

This environment variable is correctly set when executing `./scripts/tests.e2e.sh`, but the user should consider
setting it if trying to execute E2E tests without using that script.

## Using `avalanche-network-runner`

You can import this repository as a library in your Go program, but we recommend running `avalanche-network-runner` as a binary. This creates an RPC server that you can send requests to in order to start a network, add nodes to the network, remove nodes from the network, restart nodes, etc.. You can make requests through the `avalanche-network-runner` command or by making API calls. Requests are "translated" into gRPC and sent to the server.
Expand Down
2 changes: 1 addition & 1 deletion scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ parse_args() {
#BINDIR is ./bin unless set be ENV
# over-ridden by flag below

BINDIR=${BINDIR:-~/bin}
BINDIR=${BINDIR:-$DEFAULT_INSTALL}
while getopts "b:dh?x" arg; do
case "$arg" in
b) BINDIR="$OPTARG" ;;
Expand Down

0 comments on commit 362f137

Please sign in to comment.