Skip to content

Repository files navigation

CIRISBridge

Temporary scaffolding infrastructure for CIRIS Agent services. Designed to be retired when Veilid DHT becomes production-ready.

Overview

CIRISBridge provides multi-region infrastructure for:

  • CIRISBilling - Credit-based usage gating
  • CIRISProxy - LLM routing with Zero Data Retention
  • CIRISDNS - Self-hosted authoritative DNS (Constellation)

Architecture

         Clients
            │
    ┌───────┴───────┐
    │               │
    ▼               ▼
┌────────┐     ┌────────┐
│ Vultr  │     │Hetzner │
│  (US)  │◄───►│  (EU)  │
│Chicago │     │Germany │
└───┬────┘     └───┬────┘
    │              │
    │   Services   │
    ├──────────────┤
    │ Constellation│  DNS
    │ PostgreSQL   │  Database (primary/replica)
    │ CIRISBilling │  Credits API
    │ CIRISProxy   │  LLM Gateway
    │ Caddy        │  TLS termination
    └──────────────┘

Quick Start

Prerequisites

  • Terraform >= 1.0
  • Ansible >= 2.12
  • SSH key pair

1. Configure Credentials

# Copy and edit Terraform variables
cp terraform/terraform.tfvars.example terraform/terraform.tfvars
vim terraform/terraform.tfvars

# Copy and edit environment
cp .env.example .env
vim .env

2. Deploy Infrastructure

# Initialize and deploy
./scripts/deploy.sh infra

# This provisions:
# - Vultr VPS in Chicago (~$24/mo)
# - Hetzner VPS in Germany (~€6/mo)
# - Firewalls, SSH keys, networking

3. Deploy Services

# Deploy all services
./scripts/deploy.sh services

# Or deploy individually
./scripts/deploy.sh dns
./scripts/deploy.sh billing
./scripts/deploy.sh proxy

4. Verify Health

./scripts/health-check.sh

Directory Structure

CIRISBridge/
├── terraform/           # Infrastructure as Code
│   ├── main.tf         # Provider config, resources
│   ├── variables.tf    # Input variables
│   └── outputs.tf      # Outputs (IPs, inventory)
├── ansible/             # Configuration Management
│   ├── inventory/      # Host definitions
│   ├── playbooks/      # Deployment playbooks
│   └── roles/          # Service roles
│       ├── common/     # Base OS setup
│       ├── constellation/ # DNS — DECOMMISSIONED 2026-05-02 (Reticulum migration)
│       ├── postgres/   # Database — DECOMMISSIONED 2026-05-02 (Spock multi-master)
│       ├── caddy/      # TLS
│       ├── billing/    # CIRISBilling
│       └── proxy/      # CIRISProxy
├── scripts/             # Operations scripts
│   ├── deploy.sh       # Main deployment
│   ├── health-check.sh # Service health
│   ├── sync-records.sh # DNS sync
│   ├── backup-db.sh    # Database backup
│   └── failover-db.sh  # Manual failover
└── docs/

Cost Breakdown

Item Monthly Cost
Vultr VC2 (2 vCPU, 4GB) ~$24
Hetzner CX22 (2 vCPU, 4GB) ~€6
Hetzner Volume (20GB) ~€1
Domains (amortized) ~$3
Total ~$34/month

Test Environment

Full end-to-end test stack with automated spin up/down. Tests the complete flow: Agent → Proxy → Billing → LLM.

# Spin up test environment (~$42/month when running)
cd ansible
ansible-playbook -i inventory/test.yml runbooks/test-env.yml --tags up

# Deploy services
ansible-playbook -i inventory/test.yml playbooks/deploy-test-stack.yml

# Setup (create API key + test agent)
ansible-playbook -i inventory/test.yml runbooks/test-env.yml --tags setup-e2e

# Run end-to-end test
ansible-playbook -i inventory/test.yml runbooks/test-env.yml --tags test

# Spin down ($0/month when destroyed)
ansible-playbook -i inventory/test.yml runbooks/test-env.yml --tags down

See ansible/runbooks/README.md for detailed test environment documentation.

Operations

Health Check

./scripts/health-check.sh

Database Backup

POSTGRES_PASSWORD=xxx ./scripts/backup-db.sh

Manual Failover

./scripts/failover-db.sh status   # Check health
./scripts/failover-db.sh promote  # Promote replica

DNS Record Sync

./scripts/sync-records.sh

DNS Configuration

After deployment, configure at your registrar:

NS Records:

ciris-services-1.ai  NS  ns1.ciris-services-1.ai
ciris-services-1.ai  NS  ns1.ciris-services-2.ai

Glue Records:

ns1.ciris-services-1.ai  A  <VULTR_IP>
ns1.ciris-services-2.ai  A  <HETZNER_IP>

Retirement Path

CIRISBridge is temporary infrastructure. It will be retired when:

  1. Veilid DHT is stable for peer discovery
  2. CIRIS agents register Veilid route IDs
  3. Clients migrate to Veilid-first resolution
  4. Centralized DNS traffic drops below 5%

Target: Full retirement within 18-24 months of Veilid production readiness.

Related Repositories

Repo Purpose
CIRISBilling Credit management service
CIRISProxy LLM routing proxy
CIRISDNS DNS configuration
CIRISAgent Agent runtime

License

Apache 2.0 - See LICENSE


Transitional infrastructure—designed to step aside as decentralized alternatives mature.

About

Infrastructure meant to be deleted

Resources

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages