How to setup a Cranker

Need Help - View our video tutorial - https://www.youtube.com/watch?v=87EeXr3WthI

Recommended to use AWS lightsail Ubuntu 18.04

Demonstration uses Ubuntu 18.04 LTS OS on a basic instance. For best results use a vps with 2GB ram.

(make sure the username on the vps is “ubuntu” if it is not then you will have to edit multiple files in the setup to account for a different username)

  • Spin up remote vps

  • Download SSH key pem file

Record Public IP address, it will be used on the host machine.

(recommend setting this to a static IP address)

Host Machine Setup

1: update linux

sudo apt-get update
sudo apt-get upgrade

2: Create a new .pem file and copy and paste the public key from the .pem file you previously downloaded from AWS.

touch key.pem
nano key.pem

(insert entire contents of downloaded .pem file)

Ctrl+x and save
Chmod 600 key.pem (it will not work if you don't change these permissions)

You will need to know the file path of this key.pem file in the next step. You can use this command to display the path, then copy it down.

realpath key.pem

3: Clone repo

git clone https://github.com/Bonfida/audaces-perps.git

4: Edit the hosts.yaml file

cd /bonfida-perps/cranker/ansible
nano hosts.yaml

Next to ansible_host enter the IP address of the vps you created.

Next to ansible_ssh_private_key_file enter the full path of the .pem file we created in step 2.

(you can set up multiple vps at the same time, but for now we are only doing one. You can delete the other blank hosts.)

5:Add your wallet

For the example we are using sollet.io, navigate to www.sollet.io, create or restore a wallet.

Press the ^ on the right side to expand the window, and click on the “export” button on the bottom right.

Slide the “reveal” button to show the text, and copy the full text.

Navigate to the wallet.json file ( you will need to create the file)

cd bonfida-perps/cranker
touch wallet.json
nano wallet.json

Paste the text you copied from sollet.io wallet export.

  • Ctrl-x to save

  • Create the file .env in cranker/pm2 folder.

touch .env

This is the environment file that contains the variable SLACK_URL. You can leave it blank if you are not planning to receive Slack alerts when the node encounters an error

6: launch the ansible playbook

Navigate to /bonfida-perps/cranker/ansible directory.

Enter the command:

ansible-playbook -i hosts.yaml setup.yaml

(this will only be used the first time launching the playbook to do the initial setup of the vps. After this any changes that need to be pushed can use the command:

ansible-playbook -i hosts.yaml update.yaml

Push the .env and wallet.json files to your remote machine by running the following Ansible playbook:

ansible-playbook -i hosts.yaml env_files.yaml

Node setup

7. SSH into your node and navigate to index.js in the pm2 folder

cd audaces-perps/cranker/pm2
nano index.js

Edit the fee payer line by adding in the path to your wallet file which should be located in bonfida-perps/cranker

Edit the Endpoint line by adding your chosen endpoint, example uses:

Monitoring

To check output of logs you can use the command:

pm2 monit

Or:

pm2 logs -f