Deployment Guide

Complete guide for deploying Prism RPC Aggregator in production and development environments.

Table of Contents


Prerequisites

Required Software

For Docker deployment:

  • Docker Engine 20.10 or later

  • Docker Compose v2.0 or later (for stack deployment)

For binary deployment:

  • Rust nightly toolchain (1.93.0 or later)

  • cargo-make for build automation

  • OpenSSL development libraries (not required at runtime - Prism uses rustls)

For all deployments:

  • Upstream RPC provider endpoints (Alchemy, Infura, QuickNode, or public endpoints)

  • Minimum 4GB RAM, 8GB+ recommended for production

  • 10GB+ disk space for database and cache

Network Requirements

  • Port 3030 (RPC endpoint) - TCP

  • Port 9090 (Prometheus metrics) - TCP, optional

  • Outbound HTTPS/WSS access to upstream RPC providers


System Requirements

Minimum Requirements

Resource
Development
Production

CPU

1 core

2+ cores

RAM

2GB

4-8GB

Disk

5GB

20GB+

Network

10 Mbps

100 Mbps+

Resource
Specification

CPU

4+ cores (for high concurrency)

RAM

8GB (16GB for large cache configurations)

Disk

SSD with 50GB+ (for database and extensive caching)

Network

Low-latency connection to upstream providers

Memory Planning

Cache size directly impacts memory usage:

See Configuration Reference for detailed cache tuning.


Building from Source

Development Build

Production Release Build

The release profile includes:

  • opt-level = 3: Maximum optimization

  • lto = true: Link-time optimization

  • codegen-units = 1: Single codegen unit for best optimization

  • strip = true: Stripped symbols for smaller binary size

Expected binary sizes:

  • server: ~25-35MB (stripped)

  • cli: ~15-20MB (stripped)

Verify Build


Docker Deployment

Quick Start

Pull and run the pre-built image:

Verify Deployment

Docker Build from Source

Docker Configuration Requirements

Important: Use bind_address = "0.0.0.0" in Docker configs:

Volume Mounts

Container Management


Docker Compose Deployment

Basic Deployment

Create docker-compose.yml:

Start the service:

Full Production Stack with Monitoring

Use the included production compose file:

The monitoring stack includes:

  • Prism: RPC aggregator on ports 3030 (RPC) and 9090 (metrics)

  • Prometheus: Metrics collection on port 9091

  • Grafana: Visualization on port 3001 (login: admin/admin)

Access points:

  • RPC Endpoint: http://localhost:3030/

  • Health Check: http://localhost:3030/health

  • Metrics: http://localhost:3030/metrics

  • Prometheus UI: http://localhost:9091

  • Grafana: http://localhost:3001

Monitoring Stack Configuration

The docker-compose.prod.yml creates:

Prometheus configuration (deploy/prometheus/prometheus.yml):

See Monitoring Guide for detailed metrics documentation.


Binary Deployment

Installation Steps

Directory structure:

Manual Execution


systemd Service Setup

Create Service File

Create /etc/systemd/system/prism.service:

Enable and Start Service

Service Management

Log Rotation

Create /etc/logrotate.d/prism:


Reverse Proxy Configuration

nginx Configuration

Basic Setup

Create /etc/nginx/sites-available/prism:

Enable and test:

Rate Limiting

Add rate limiting to nginx config:

WebSocket Support

If you need WebSocket subscriptions:

Caddy Configuration

Caddy is simpler with automatic HTTPS:

Create Caddyfile:

Run Caddy:

HAProxy Configuration

For advanced load balancing:


TLS/HTTPS Configuration

Let's Encrypt with Certbot (nginx)

Let's Encrypt with Caddy

Caddy handles this automatically:

Manual TLS Configuration

Generate self-signed certificate (development only):

Use commercial certificate:

TLS Best Practices

Strong SSL configuration for nginx:

Test SSL configuration:


Environment-Specific Configurations

Development

config/development.toml:

Staging

config/staging.toml:

Production

config/production.toml:

Loading Environment-Specific Config

For systemd, update the service file:


Health Checks & Readiness Probes

Health Check Endpoint

Endpoint: GET /health

Response (healthy):

Response (degraded):

Docker Health Check

Built-in Docker health check (already in Dockerfile):

Custom health check in docker-compose.yml:

Kubernetes Probes

Liveness probe (container is alive):

Readiness probe (ready to accept traffic):

Startup probe (container has started):

Load Balancer Health Checks

AWS ALB/NLB:

GCP Load Balancer:

Monitoring Script

Create /usr/local/bin/prism-health-check.sh:

Make executable and use in cron:


Resource Sizing

CPU Sizing

Workload
vCPUs
Notes

Development

1-2

Sufficient for testing

Low traffic (<100 req/s)

2

Light production workload

Medium traffic (100-500 req/s)

4

Typical production

High traffic (500-2000 req/s)

8-16

High concurrency, multiple upstreams

Memory Sizing

Base memory: ~200-500MB (without cache)

Cache memory estimation:

Example configurations:

Profile
Cache Config
Est. Memory
Use Case

Minimal

Small cache (5k entries)

1-2GB

Development, testing

Standard

Default cache (10k-50k)

2-4GB

Low-medium traffic

Large

Large cache (50k-100k)

4-8GB

High traffic, DeFi apps

XL

Extra large (200k+)

8-16GB

Very high traffic

Disk Sizing

Component
Size
Notes

Binaries

~50MB

Server + CLI

Configuration

<1MB

TOML files

Database

10-100MB

SQLite auth database (grows with API keys)

Logs

Variable

Depends on retention policy

System overhead

1GB

OS and dependencies

Recommended disk space:

  • Minimum: 10GB

  • Production: 50GB+ with log rotation

Network Sizing

Bandwidth estimation:

Cache hit rate significantly reduces upstream bandwidth:

  • 80% cache hit rate: ~10x reduction in upstream traffic

  • 95% cache hit rate: ~20x reduction in upstream traffic

Resource Limits

Docker Compose:

systemd:

Add to service file:

ulimit (manual runs):


Production Checklist

Pre-Deployment

Security

Monitoring

Performance

Reliability

Operations


Troubleshooting

Service Won't Start

Check logs:

Common issues:

  1. Port already in use:

  2. Configuration errors:

  3. Permission denied:

  4. Database errors:

Upstream Connection Failures

Test upstream connectivity:

Common issues:

  1. Invalid API keys: Update keys in config

  2. Firewall blocking: Check outbound HTTPS/WSS access

  3. Rate limiting: Use multiple providers or upgrade plan

  4. DNS issues: Test DNS resolution

High Memory Usage

Check memory usage:

Reduce memory:

Cache Not Working

Check cache status:

Verify cache is enabled:

Only these methods are cached:

  • eth_getBlockByHash

  • eth_getBlockByNumber

  • eth_getLogs

  • eth_getTransactionByHash

  • eth_getTransactionReceipt

High CPU Usage

Check CPU:

Possible causes:

  1. Too many concurrent requests: Reduce max_concurrent_requests

  2. Complex log queries: Enable caching, increase cache sizes

  3. Insufficient CPU: Scale up instance

TLS/SSL Errors

Test certificate:

Common issues:

  1. Expired certificate: Renew with certbot

  2. Certificate mismatch: Ensure CN/SAN matches domain

  3. Missing intermediate certs: Install CA bundle

Database Errors

Check database:

Reset database (WARNING: deletes all API keys):

Performance Issues

Check metrics:

Optimize:

  1. Enable caching: Set [cache] enabled = true

  2. Add more upstreams: Distribute load

  3. Tune cache sizes: Increase for better hit rates

  4. Enable hedging: Reduce tail latency (see Routing Strategies)

Getting Help

Collect diagnostics:

Resources:


Next Steps

After successful deployment:

  1. Configure Advanced Features

  2. Set Up Monitoring

  3. Optimize Performance

  4. Harden Security


Production deployment complete! Your Prism instance is now ready to handle Ethereum JSON-RPC requests with intelligent caching, routing, and monitoring.

Last updated