5.2 KiB
5.2 KiB
Deployment
Deploy your indexer to Envio's hosted service for production-ready infrastructure without operational overhead.
Hosted Service Overview
Envio's hosted service provides:
- Git-based deployments - Push to deploy (like Vercel)
- Zero infrastructure management - No servers to maintain
- Static production endpoints - Consistent URLs, zero-downtime deploys
- Built-in monitoring - Logs, sync status, deployment health
- Alerting - Discord, Slack, Telegram, Email notifications
- GraphQL API - Production-ready query endpoint
- Multi-chain support - Single codebase, multiple networks
Pre-Deployment Checklist
Before deploying, verify your indexer works locally:
# 1. Install dependencies
pnpm install
# 2. Generate types
pnpm codegen
# 3. Type check
pnpm tsc --noEmit
# 4. Run locally
pnpm dev
# 5. Test with TUI off to see all logs
TUI_OFF=true pnpm dev
Verify:
- No TypeScript errors
- Entities are being created/updated
- No runtime errors in logs
- GraphQL queries return expected data (localhost:8080)
Deployment Steps
1. Push to GitHub
Your indexer must be in a GitHub repository.
2. Connect to Envio
- Go to envio.dev/explorer
- Install the Envio Deployments GitHub App
- Select your repository
3. Configure Deployment
- Root directory: Where your indexer lives (for monorepos)
- Config file: Path to
config.yaml - Deployment branch: Which branch triggers deploys
4. Deploy
Push to your deployment branch. The hosted service will:
- Clone your repo
- Install dependencies
- Run codegen
- Build and deploy
- Start indexing
Environment Variables
Set secrets in the Envio dashboard, not in your repo:
# Common env vars for hosted service
RPC_URL=https://... # If using custom RPC
ETH_RPC_URL=https://... # For multichain
POLYGON_RPC_URL=https://...
Production Config Tips
# config.yaml for production
name: my-production-indexer
rollback_on_reorg: true # Always enable for production
networks:
- id: 1
start_block: 18000000 # Don't start from 0 unless needed
confirmed_block_threshold: 250
contracts:
- name: MyContract
address: "0x..."
handler: src/EventHandlers.ts
events:
- event: Transfer(address indexed from, address indexed to, uint256 value)
# Only include fields you actually use
field_selection:
transaction_fields:
- "from"
- "hash"
Monitoring
The hosted service dashboard shows:
- Sync progress - Current block vs chain head
- Logs - Real-time and historical
- Deployment status - Build logs, errors
- Health metrics - Uptime, performance
Alerting
Configure alerts for:
- Indexer stopped or crashed
- Sync falling behind
- Deployment failed
- Errors in handlers
Channels: Discord, Slack, Telegram, Email
GraphQL Endpoint
Your production endpoint:
https://indexer.hyperindex.xyz/YOUR_INDEXER_SLUG/v1/graphql
Example query:
query {
Transfer(limit: 10, order_by: { blockNumber: desc }) {
id
from
to
value
}
_meta {
block {
number
}
}
}
Version Management
- Multiple versions - Keep old versions running while testing new ones
- One-click rollback - Instantly switch to previous version
- Zero-downtime deploys - New version starts, traffic switches when ready
Self-Hosting Alternative
For custom infrastructure needs:
# Basic self-hosting with Docker
git clone https://github.com/enviodev/local-docker-example
cd local-docker-example
docker-compose up
Note: Self-hosting requires managing:
- PostgreSQL database
- Docker/container orchestration
- Monitoring and alerting
- Scaling and backups
Recommended only for teams with infrastructure expertise.
Deployment Workflow
┌─────────────────┐
│ Local Dev │
│ pnpm dev │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Test Locally │
│ TUI_OFF=true │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Push to GitHub │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Auto Deploy │
│ (Hosted Svc) │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Monitor │
│ Dashboard │
└─────────────────┘
Best Practices
- Test locally first - Always verify before deploying
- Use environment variables - Never commit secrets
- Enable reorg support -
rollback_on_reorg: true - Set reasonable start_block - Don't index from genesis unless needed
- Monitor after deploy - Watch logs for first few minutes
- Configure alerts - Know immediately if something breaks