This guide covers deploying the ILN Indexer in various environments.
- Node.js 20+
- npm or yarn
- SQLite (bundled with better-sqlite3)
- Stellar RPC node access
# Clone the repository
git clone https://github.com/Invoice-Liquidity-Network/Invoice-Liquidity-Network.git
cd Invoice-Liquidity-Network
# Install dependencies
npm install
# Navigate to indexer
cd indexer
# Copy environment template
cp .env.example .env
# Edit .env with your configuration
# At minimum, set CONTRACT_ID and RPC_URL
# Start in development mode (with hot reload)
npm run dev# Build the project
npm run build
# Start the server
npm startCreate a Dockerfile in the indexer directory:
FROM node:20-alpine
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install production dependencies
RUN npm ci --only=production
# Copy built files
COPY dist/ ./dist/
# Copy database path
RUN mkdir -p /data
# Set environment variables
ENV DB_PATH=/data/indexer.db
ENV PORT=3001
# Expose port
EXPOSE 3001
# Health check
HEALTHCHECK --interval=30s --timeout=3s \
CMD curl -f http://localhost:3001/health || exit 1
# Start the server
CMD ["node", "dist/index.js"]Build and run:
# Build the Docker image
docker build -t iln-indexer .
# Run the container
docker run -d \
--name iln-indexer \
-p 3001:3001 \
-v indexer-data:/data \
-e CONTRACT_ID=YOUR_CONTRACT_ID \
-e RPC_URL=YOUR_RPC_URL \
-e NETWORK_PASSPHRASE="Test SDF Network ; September 2015" \
iln-indexerCreate docker-compose.yml:
version: '3.8'
services:
indexer:
build: .
ports:
- "3001:3001"
volumes:
- indexer-data:/data
environment:
- CONTRACT_ID=${CONTRACT_ID}
- RPC_URL=${RPC_URL}
- NETWORK_PASSPHRASE=${NETWORK_PASSPHRASE:-Test SDF Network ; September 2015}
- REDIS_URL=redis://redis:6379
depends_on:
- redis
restart: unless-stopped
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- redis-data:/data
restart: unless-stopped
volumes:
indexer-data:
redis-data:Run:
# Create .env file
cat > .env << EOF
CONTRACT_ID=your_contract_id
RPC_URL=https://soroban-testnet.stellar.org
NETWORK_PASSPHRASE=Test SDF Network ; September 2015
EOF
# Start services
docker-compose up -dThe project includes railway.toml for Railway deployment:
# Install Railway CLI
npm install -g @railway/cli
# Login
railway login
# Link to project
railway link
# Set environment variables
railway variables set CONTRACT_ID=your_contract_id
railway variables set RPC_URL=https://soroban-testnet.stellar.org
# Deploy
railway upSee Configuration for complete environment variable reference.
- Backup Strategy: Regularly backup the SQLite database
- Storage: Use persistent storage (volume mount or managed disk)
- Location: Keep database on fast storage (SSD preferred)
- RPC Access: Ensure reliable access to Stellar RPC nodes
- Rate Limits: Be aware of RPC rate limits
- Fallback: Consider multiple RPC endpoints for redundancy
- Health Checks: Monitor
/healthendpoint - Logs: Aggregate logs for analysis
- Alerts: Set up alerts for:
- Service downtime
- High error rates
- Database issues
- Sync delays
The indexer is designed for single-instance deployment due to:
- SQLite single-writer constraint
- Cursor management
- Event deduplication
For high-traffic scenarios:
- Use Redis for caching
- Consider read replicas for API queries
- Monitor database size and prune old events
# Pull latest changes
git pull
# Rebuild
npm run build
# Restart the service
# For direct Node.js:
pkill -f "node dist/index.js"
npm start
# For Docker:
docker-compose down
docker-compose up -d --build
# For Railway:
railway upSee Troubleshooting Guide for common issues and solutions.