Skip to content

Commit

Permalink
Remote Deployment Testing (#37)
Browse files Browse the repository at this point in the history
* upgrade heimdall

* Added remote functionality

* Minor Fix

* uncomment commented options

* Steps till transfer to remote

* add Process contract addresses

* Readme and eslint changes

* Fixed : Docker-Bor-Keystore

* change

* change README

* change README

* change readme

* minor change

* minor change

* change scrypt version

* remove scrypt

* revert

* downgrade package

* readme changes

* readme changes

* minor change

Co-authored-by: Shivam Sharma <[email protected]>
  • Loading branch information
temaniarpit27 and 0xsharma authored May 20, 2022
1 parent 96f5dd8 commit d29ff81
Show file tree
Hide file tree
Showing 15 changed files with 2,703 additions and 3,147 deletions.
5 changes: 3 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ module.exports = {
"space-before-function-paren": ["error", {
"anonymous": "always",
"named": "never",
"asyncArrow": "always"
"asyncArrow": "always",
"parser": "@babel/eslint-parser"
}],
}
};
};
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules
test
devnet/
.DS_Store
141 changes: 121 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,87 @@

🏗 A CLI to setup and manage Matic validator nodes

### Installation
### Installation (Host Machine)

Please make sure you have installed following dependencies:

* Git
* Node/npm v10.17.0 (or higher)
* Build Essentials
```bash
sudo apt install build-essential
```
* Node v10.17.0
```bash
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
nvm install 10.17.0
```
* Go 1.18+
* Docker (only if running on a docker based setup)
* Rabbitmq (Latest stable version, https://www.rabbitmq.com/download.html) (Not required for docker based setup)
* Solc v0.5.11 (https://solidity.readthedocs.io/en/v0.5.3/installing-solidity.html#binary-packages) (Not required for docker based setup)
* Ganache CLI (https://www.npmjs.com/package/ganache-cli) (Not required for docker based setup)
```bash
wget https://raw.githubusercontent.com/maticnetwork/node-ansible/master/go-install.sh
bash go-install.sh --remove
bash go-install.sh
```
* Docker (https://docs.docker.com/engine/install/linux-postinstall/)
* Solc v0.5.16
```bash
sudo snap install solc
```
* Python 2
```bash
sudo apt install python2
alias python="/usr/bin/python2"
```

### Installation (Remote Machine)

Please refer to [this](./installation.md) document for more information.

### Usage

Create new directory for the setup:
Please make sure you have installed following dependencies:

```bash
$ mkdir devnet
$ cd devnet
```
* Go 1.18+
* Rabbitmq
```bash
sudo apt install rabbitmq-server
```
* Npm (Only required on ganache remote machine)
```bash
sudo apt update
sudo apt install nodejs npm
```
* Ganache CLI (Only required on ganache remote machine)
```bash
sudo npm install -g ganache-cli
```

**To setup multi-node local network**
### Usage

```bash
git clone https://github.com/maticnetwork/matic-cli.git
npm i
mkdir devnet
cd devnet
../bin/matic-cli setup devnet
```

It will ask you several questions:
**-----**
**To setup multi-node local network (via docker)**
**-----**

It will ask you several questions (default values are provided):

```
Please enter Bor chain id - Input the bor chain id you want
Please enter Heimdall chain id - Input the heimdall chain id you want
Please enter Bor docker tag - Input the bor tag you want to deploy
Please enter Heimdall docker tag - Input the heimdall tag you want to deploy
Please enter Contracts branch - Input the contracts branch
Please enter number of validator nodes - Input the number of validator nodes you want to run
Please enter number of non-validator nodes - Input the number of sentry nodes you want to run
Please enter ETH url - Input the eth url to use
Please select devnet type - docker
```
After the setup is done, follow these steps:
Notes:
1. We have provided the default values where ever so to ensure smooth functioning of the process
**After the setup is done, follow these steps for local docker deployment:**
Start ganache
```bash
Expand All @@ -60,11 +104,68 @@ Start bor
bash docker-bor-start-all.sh
```

**Logs**
Logs

Logs will be at `logs/` folder

**-----**
**To setup multi-node remote network**
**-----**

It will ask you several questions:

```
Please enter Bor chain id - Input the bor chain id you want
Please enter Heimdall chain id - Input the heimdall chain id you want
Please enter Bor docker tag - Input the bor tag you want to deploy
Please enter Heimdall docker tag - Input the heimdall tag you want to deploy
Please enter Contracts branch - Input the contracts branch
Please enter number of validator nodes - Input the number of validator nodes you want to run
Please enter number of non-validator nodes - Input the number of sentry nodes you want to run
Please enter ETH url - Input the eth url to use
Please select devnet type - remote
Please enter comma separated hosts/IPs - Enter the IPs
```

Notes:
1. The host machine and remote machine has to be an linux machine with ubuntu as user
2. The first machine will be used for ganache as well so enter the ETH url as - http://<1st machine IP>:9545
3. Make sure that the host machines has access to remote machines for transferring the data
4. We have provided the default values where ever so to ensure smooth functioning of the process

**After the setup is done, follow these steps for local docker deployment:**

1. Log into first machine and run ganache:
```bash
cd ~/
bash ganache-start-remote.sh
```

2. Log into the remote machines and on each machine run the following steps in different terminals:
```bash
cd ~/node
bash heimdalld-setup.sh
heimdalld start
```

```bash
heimdalld rest-server
```

```bash
bridge start --all
```

```bash
cd ~/node
bash bor-setup.sh
bash bor-start.sh
```

**-----**
**Clean Setup**
**-----**

Remove the devnet folder and you can start the process once again

## License
Expand Down
23 changes: 7 additions & 16 deletions installation.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
### Matic CLI Dependencies

You'll require following dependencies in order to run matic-cli on a docker based setup
You'll require following dependencies in order to run matic-cli on a docker based setup

1. Git
2. NPM and Node v10.17.0 (preferrable):</br>
- If you're running on a fresh machine, we suggest installing things using node version manager (nvm).
- If you're running on a fresh machine, we suggest installing things using node version manager (nvm).
- Refer [this](https://github.com/nvm-sh/nvm#installing-and-updating) for installing/updating nvm
- Once installed, you can download the required node version using `nvm install 10.17.0` and then run `nvm use 10.17.0` to use it.
- Once installed, you can download the required node version using `nvm install 10.17.0` and then run `nvm use 10.17.0` to use it.
- Cross verify by running `node --version` which should say `v10.17.0`.
3. Go 1.18+:</br>
Follow the steps below to install the latest go version 1.18.1 (if not already installed) (Note that these are preferrable steps which we use. You can also install go by downloading the package from the official documentation)
Expand All @@ -30,21 +30,12 @@ You'll require following dependencies in order to run matic-cli on a docker base
# go version go1.18.1 linux/amd64
```
4. Docker:</br>
Refer [this](https://docs.docker.com/get-docker/) link for platform specific installation steps.
Refer [this](https://docs.docker.com/get-docker/) link for platform specific installation steps.

Please note that the rabbit mq, solidity compiler (solc) and ganache-cli is not required to be installed on the machine used for setup, as they'll be installed on docker itself.
Incase the tools fail to install, you can install them using the following commands on docker.
5. Rabbitmq:</br>
```bash
docker pull rabbitmq:3-management
```
6. Solc:</br>
```bash
docker pull ethereum/solc:0.5.11
```
7. Ganache-cli:</br>
```bash
docker pull trufflesuite/ganache-cli:latest
```
5. Solc:</br>
6. Ganache-cli:</br>
Loading

0 comments on commit d29ff81

Please sign in to comment.