Deployment

Rift can be deployed in various environments, from local development to production Kubernetes clusters.


Deployment Options

Quick setup for development and testing:

docker pull zainalpour/rift-proxy:latest
docker run -p 2525:2525 zainalpour/rift-proxy:latest

Full Docker Guide

Kubernetes

Production deployment with proper resource management:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: rift
spec:
  replicas: 3
  template:
    spec:
      containers:
        - name: rift
          image: zainalpour/rift-proxy:latest
          ports:
            - containerPort: 2525
            - containerPort: 9090

Full Kubernetes Guide

Binary

Standalone deployment without containers:

# Download
curl -L https://github.com/EtaCassiopeia/rift/releases/latest/download/rift-http-proxy-linux-x86_64 -o rift

# Run
chmod +x rift
./rift --configfile imposters.json

Deployment Patterns

Standalone Mock Server

Single Rift instance serving all imposters:

┌─────────────┐     ┌─────────────┐
│  Test Suite │────▶│    Rift     │
└─────────────┘     │  (imposters)│
                    └─────────────┘

Sidecar Pattern

One Rift per service for isolated fault injection:

┌─────────────────────────────┐
│           Pod               │
│  ┌─────────┐  ┌─────────┐  │
│  │  Rift   │◀─│   App   │  │
│  │(sidecar)│  │         │  │
│  └────┬────┘  └─────────┘  │
│       │                     │
│       ▼                     │
│  ┌─────────┐               │
│  │ Backend │               │
│  └─────────┘               │
└─────────────────────────────┘

API Gateway Pattern

Rift as a reverse proxy routing to multiple services:

                    ┌─────────────┐
┌─────────┐        │    Rift     │        ┌─────────┐
│ Client  │───────▶│  (gateway)  │───────▶│Service A│
└─────────┘        │             │        └─────────┘
                   │             │        ┌─────────┐
                   │             │───────▶│Service B│
                   └─────────────┘        └─────────┘

Environment Configuration

Required Settings

Setting Description Default
MB_PORT Admin API port 2525

Optional Settings

Setting Description Default
MB_ALLOW_INJECTION Enable JavaScript false
RUST_LOG Log level info
RIFT_METRICS_PORT Metrics port 9090

Resource Requirements

Minimum (Development)

  • CPU: 0.5 cores
  • Memory: 128MB
  • Storage: 50MB (image)
  • CPU: 2 cores
  • Memory: 512MB
  • Storage: 100MB

High Throughput

  • CPU: 4+ cores
  • Memory: 1GB+
  • Storage: 100MB

Health Checks

Admin API

curl http://localhost:2525/

Metrics Endpoint

curl http://localhost:9090/metrics

Kubernetes Probes

livenessProbe:
  httpGet:
    path: /
    port: 2525
  initialDelaySeconds: 5
  periodSeconds: 10

readinessProbe:
  httpGet:
    path: /
    port: 2525
  initialDelaySeconds: 5
  periodSeconds: 5

Table of contents