Skip to content

Commit

Permalink
docs: provide setup and usage instructions
Browse files Browse the repository at this point in the history
This still needs to be extended with some information on how to obtain the IP addresses of each
VM.
  • Loading branch information
jacderida committed Aug 5, 2023
1 parent ce8129d commit 36106c5
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,49 @@ If you are interested in deploying your own testnets, or using the tool to deplo

Since we use Ansible, if you want to use the tool on Windows, you'll need to use WSL.

## Setup

The tool makes use of Terraform to create either droplets on Digital Ocean or EC2 instances on AWS, so you need an installation of that on your platform. It is very likely available in your platform's package manager.

We make use of Ansible for provisioning the VMs. Since Ansible is a Python application, it is advisable to install it in a virtualenv. If this sounds unfamiliar, I would recommend asking ChatGPT something along the lines of, "How can I install Ansible in a virtualenv created and managed by virtualenvwrapper?" The virtualenv must be activated any time you use the tool.

After you've installed these tools, run our `setup` command:
```
cargo run -- setup
```

This will gather a bunch of values that are written to a `.env` file, which is read when the tool starts.

You only need to run this command once.

## Deploying a Testnet

After completing the setup, you can deploy a testnet like so:
```
cargo run -- deploy --name beta
```

This will deploy a testnet named 'beta' to Digital Ocean, with 10 VMs and 20 node processes on each VM, and the latest version of the `safenode` binary.

If you want more VMs or nodes, use the `--vm-count` and `--node-count` arguments to vary those values to suit your needs:
```
cargo run -- deploy --name beta --vm-count 100 --node-count 30
```

You may want to deploy a custom version of the `safenode` binary. To do so, use the `--branch` and `--repo-owner` arguments:
```
cargo run -- deploy --name beta --vm-count 100 --node-count 30 --repo-owner jacderida --branch custom_branch
```

## Clean Up

To remove the testnet, use the following command:
```
cargo run -- clean --name beta --provider "digital-ocean"
```

This will use Terraform to tear down all the droplets it created.

## License

This repository is licensed under the BSD-3-Clause license.
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,8 @@ impl TestnetDeploy {
self.create_infra(name, vm_count, repo_owner.is_some())
.await?;
if repo_owner.is_some() {
// I think the use of `unwrap` here is justified because we've already checked they are
// in a valid state.
self.build_custom_safenode(
name,
&repo_owner.as_ref().unwrap(),
Expand Down

0 comments on commit 36106c5

Please sign in to comment.