Skip to content

Latest commit

 

History

History
173 lines (122 loc) · 5.02 KB

README.md

File metadata and controls

173 lines (122 loc) · 5.02 KB

hedera-gcs-setup

This repository is an Ansible role to quickly stand up an open-source Hedera Mirror Node.

Note: This how-to tutorial is meant to quickly get started and not to be used as an official representation by Hedera on what platform architecture must be used.

Requirements

Before getting started, you must have the following prerequisites:

Note: In order to operate a Hedera Node, you must configure a billing account, because the object storage bucket you will need to pull streams from is configured for requester pays. Meaning that mirror node operators will assume and accept the operational costs of reading and retrieving data records from the Hedera Network of your choice, either MainNet or TestNet.

This is where we will install and operate a Hedera-Mirror-Node

Getting Started

These instructions will guide you on retrieving record streams from a Hedera Network via which are stored in Google Cloud storage buckets. Don't worry about perform a git clone from here, we'll handle that with some automation.

Create our Project Directory and working files

From your local machine let's create a project directory with some files that will look like this.

Step 1)

mkdir hedera-mirror-node

Step 2)

Let's create the subdirectories

mkdir hedera-mirror-node/vars 
mkdir hedera-mirror-node/roles

Step 3) Using a text editor of your choice create an inventory file that looks something like this

hedera-mirror-node/inventory.ini

[mirrornode]
IPADDRESS ansible_ssh_user=USERNAME

Note: replace IP Address with the IP address of your ubuntu server and the USERNAME with your host username, usually it's ubuntu.

Step 4) We'll create a requirements folder to tell ansible where to download this Ansible role

hedera-mirror-node/roles/requirements.yml

---
# from github
- src: https://github.com/injectedfusion/hedera-gcs-setup
...

Step 5) Navigate inside our project directory and launch the ansible requirements

cd hedera-mirror-node

Authenticate and Authorize gcloud to access the object storage bucket with your Google account credentials

Will need to generate credentials to call the Google Cloud Storage JSON API from our Hedera Node

(Step 1) Generate a HMAC Key. Use the Google Documentation Guide for this step

(Step 2) Using a code editor of your choice create file named vars/project-id.json copy your HMAC access key and secret key, and Project ID from the previous step.

project-id.json

{
  "access_key":"GOOG1E...",
  "secret_key":"H/4...",
  "project_id":"Your-Google-Project-ID"
}

Build & Execute our Playbook

Step 1) Using your code editor of choice, create a file server_build.yml with the contents of our in the top level of your directory.

server_build.yml

---
- hosts: mirrornode
  vars_files:
    - ./vars/project-id.json
  roles:
    - hedera-gcs-setup
...

Your project directory should now look something like this

.
├── vars
│   └── project-id.json
├── inventory.ini
├── roles
│   └── requirements.yml
└── server_build.yml

Step 2) Let's install the necessary ansible role

ansible-galaxy install -r roles/requirements.yml --force

Step 3) Now we are good to build & deploy our MirrorNode

ansible-playbook -i inventory.ini server_build.yml --tags "install"

Step 4) Let's start the Mirror Node Services

ansible-playbook -i inventory.ini server_build.yml --tags "start_services"

Step 5) If your wish to stop the mirror node services

ansible-playbook -i inventory.ini server_build.yml --tags "stop_services"

Sequence Diagram

Here is Sequence Diagram of what's all happening above, zoom-in to get a better look. Sequence Diagram

License

MIT

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Author Information

Gabriel Rodriguez