Skip to content

Latest commit

 

History

History
59 lines (42 loc) · 1.83 KB

README.md

File metadata and controls

59 lines (42 loc) · 1.83 KB

Infrastructure as Code (IaC) with Terraform & Ansible

This setup uses Terraform to provision servers on Hetzner Cloud (Hcloud) and Ansible to configure and deploy Polkadot full nodes.

Prerequisite

  • ED25519 ssh key generated with default filename ~/.ssh/id_ed25519.pub or (ssh-keygen -t ed25519 -C "your_email@example.com")
  • HCloud API Token

Terraform

Provision two servers on Hetzner Cloud with the required specifications to run Polkadot full nodes.

Steps:

  1. Source the environment variables

    source .env.sh
    
  2. Apply the Terraform configuration:

    terraform apply    
    

Ansible

Initial Configuration

Use the init_polkadot_server.yml playbook for initial server setup, which: configures the data path and exposes necessary ports.

    ansible-playbook -i inventory.yml init_polkadot_server.yml --ask-become

NB: This playbook is idempotent, meaning it can be safely re-run without causing issues.

Updating Polkadot Release

After the initial configuration, you can deploy a specific Polkadot release.

Option 1: Using vars.yml

If you follow Gitops principle, specify the desired Polkadot version in the vars.yml file, for eg:

polkadot_version: "polkadot-stable2409"

Run the update playbook:

ansible-playbook -i inventory.yml update_polkadot_fullnode.yml --ask-become

Option 2: Using Extra Variables

Override the polkadot_version variable directly when running the playbook

ansible-playbook -i inventory.yml update_polkadot_fullnode.yml --extra-vars "polkadot_version=polkadot-stable2409-1"

Summary

Ensure your inventory.yml file contains the correct server details generated by Terraform. The Terraform and Ansible processes are modular and can be independently re-executed as needed.