Skip to content

Deploying ENSNode with Terraform

This guide will help you deploy ENSNode using Terraform to Railway. The Terraform configuration provides a complete infrastructure setup including database, ENSIndexer, ENSRainbow, and other required services.

  • Terraform installed
  • Railway account
  • Railway API token (generate from https://railway.com/account/tokens)
  • RPC URLs for the networks you want to support (Mainnet, Sepolia, Holesky, Base, Linea)
  • AWS account (for DNS management)
  • AWS S3 bucket defined inside AWS account - ensnode-terraform (for Terraform state)

Copy .env.sample to .env.local and fill in your configuration values:

Terminal window
railway_token = "your_railway_token"
mainnet_rpc_url = "your_mainnet_rpc_url"
sepolia_rpc_url = "your_sepolia_rpc_url"
holesky_rpc_url = "your_holesky_rpc_url"
base_rpc_url = "your_base_rpc_url"
linea_rpc_url = "your_linea_rpc_url"
ensnode_version = "latest" # or specific version

The Terraform configuration sets up the following components:

  • Railway
    • Railway project and environment
    • PostgreSQL database
    • ENSIndexer services
    • ENSRainbow service
  • AWS
    • DNS configuration
  1. Initialize Terraform:
Terminal window
terraform init
  1. Review the planned changes:
Terminal window
terraform plan
  1. Apply the configuration:
Terminal window
terraform apply

To destroy the infrastructure:

Terminal window
terraform destroy