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.
These Terraform scripts are currently specific to ENSNode instances hosted by NameHash Labs. While these scripts provide a good starting point for deploying your own ENSNode instance, you will need to make modifications to suit your specific deployment needs. We plan to generalize these scripts in the future to better support community deployments.
Example Terraform Configuration View the example Terraform configuration on GitHub.
Prerequisites
Section titled “Prerequisites”- 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)
Configuration
Section titled “Configuration”Copy .env.sample
to .env.local
and fill in your configuration values:
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
Infrastructure Components
Section titled “Infrastructure Components”The Terraform configuration sets up the following components:
- Railway
- Railway project and environment
- PostgreSQL database
- ENSIndexer services
- ENSRainbow service
- AWS
- DNS configuration
Deployment Steps
Section titled “Deployment Steps”- Initialize Terraform:
terraform init
- Review the planned changes:
terraform plan
- Apply the configuration:
terraform apply
Cleanup
Section titled “Cleanup”To destroy the infrastructure:
terraform destroy