Deploying ENSNode with Docker
The Docker images are the easiest way to run or deploy the ENSNode suite of services, both locally and in the cloud.
Below is a sample Docker Compose file linking the various services together.
services: ensindexer: container_name: ensindexer image: ghcr.io/namehash/ensnode/ensindexer:latest ports: - "42069:42069" environment: # Override environment variables to point to docker instances DATABASE_URL: postgresql://postgres:password@postgres:5432/postgres ENSRAINBOW_URL: http://ensrainbow:3223 ENSINDEXER_URL: http://ensindexer:42069 env_file: # NOTE: must define apps/ensindexer/.env.local (see apps/ensindexer/.env.local.example) # Copy .env.local.example to .env.local and configure all required values - path: ./apps/ensindexer/.env.local required: true healthcheck: test: ["CMD", "curl", "--fail", "-s", "http://localhost:42069/health"] interval: 30s timeout: 10s retries: 3 start_period: 5m start_interval: 1s depends_on: ensrainbow: condition: service_healthy postgres: condition: service_started
ensapi: container_name: ensapi image: ghcr.io/namehash/ensnode/ensapi:latest ports: - "4334:4334" environment: # Override environment variables to point to docker instances DATABASE_URL: postgresql://postgres:password@postgres:5432/postgres ENSINDEXER_URL: http://ensindexer:42069 env_file: # NOTE: must define apps/ensapi/.env.local (see apps/ensapi/.env.local.example) # Copy .env.local.example to .env.local and configure all required values - path: ./apps/ensapi/.env.local required: true healthcheck: test: ["CMD", "curl", "--fail", "-s", "http://localhost:4334/health"] interval: 30s timeout: 10s retries: 3 start_period: 1m start_interval: 1s depends_on: ensindexer: condition: service_healthy postgres: condition: service_started
ensrainbow: container_name: ensrainbow image: ghcr.io/namehash/ensnode/ensrainbow:latest ports: - "3223:3223" env_file: # NOTE: Optionally define apps/ensrainbow/.env.local (see apps/ensrainbow/.env.local.example) - path: ./apps/ensrainbow/.env.local required: false volumes: - ensrainbow_data:/app/apps/ensrainbow/data restart: unless-stopped healthcheck: test: ["CMD", "wget", "-q", "--spider", "http://localhost:3223/health"] interval: 30s timeout: 3s retries: 3 start_period: 20m start_interval: 1s
ensadmin: container_name: ensadmin image: ghcr.io/namehash/ensnode/ensadmin:latest ports: - "4173:4173" environment: # Override environment variables to point to docker instances # NOTE: must be host-accessible (i.e. http://localhost) ENSADMIN_PUBLIC_URL: http://localhost:4173 # NOTE: must be host-accessible (i.e. http://localhost) NEXT_PUBLIC_SERVER_CONNECTION_LIBRARY: http://localhost:4334 env_file: # NOTE: can define apps/ensadmin/.env.local (see apps/ensadmin/.env.local.example) - path: ./apps/ensadmin/.env.local required: false depends_on: - ensapi
postgres: container_name: postgres image: postgres:17 environment: POSTGRES_DB: postgres POSTGRES_USER: postgres POSTGRES_PASSWORD: password ports: - "5432:5432" volumes: - postgres_data:/var/lib/postgresql/data
volumes: postgres_data: driver: local ensrainbow_data: driver: local Example Docker Compose View the complete Docker Compose example on GitHub.
Note that while this example docker-compose.yml exposes each container’s port to the host machine, you may only wish to expose ENSIndexer-API 42069 (perhaps mapping it to ports 80/443) and avoid exposing services like ENSRainbow, ENSAdmin, and your Postgres to the wider internet.