Terraphim AI Installation and Deployment Guide
This guide covers all available methods to install and deploy Terraphim AI, from quick setup to advanced configurations.
🚀 Quick Start
Option 1: Universal Installer (Recommended)
The universal installer provides a single-command installation for all platforms with automatic platform detection and security verification.
# Install terraphim-agent (default)
|
# Install both agent and CLI tools
|
# Install to custom directory
| Features:
- ✅ Cross-platform support (Linux, macOS, Windows/WSL)
- ✅ Automatic platform detection
- ✅ Security verification with checksums
- ✅ Pre-built binaries when available
- ✅ Fallback to source compilation
- ✅ Multiple installation options
Installation Options:
Option 2: Docker (Container-based)
Docker provides an isolated environment with all dependencies handled automatically.
# One-command Docker installation
| What this does:
- Downloads the latest Terraphim AI Docker image
- Creates necessary directories for data and configuration
- Starts the server on
http://localhost:8000 - Enables automatic restart
After installation:
- Web Interface: http://localhost:8000
- API Endpoint: http://localhost:8000/api
- Health Check: http://localhost:8000/health
Option 2: System Package Managers
Debian/Ubuntu (18.04+)
# Download and install server
# Download and install TUI (optional)
# Start the server
Arch Linux/Manjaro
# Install server
# Install TUI (optional)
# Start the server
Option 3: Source Installation
For users who prefer building from source or need custom configurations:
# Automated source installation
|
# Or manual installation
📋 System Requirements
Minimum Requirements
- Operating System: Linux (Ubuntu 18.04+, CentOS 7+, Arch Linux)
- Memory: 4GB RAM minimum, 8GB recommended
- Storage: 1GB available space
- Network: Internet connection for first-time setup
Recommended Requirements
- Operating System: Ubuntu 20.04+ or Arch Linux
- Memory: 8GB RAM or more
- Storage: 5GB available space
- CPU: Multi-core processor for better performance
⚙️ Configuration
Default Configuration
Terraphim AI creates a default configuration at ~/.config/terraphim/config.json:
Adding Data Sources
Edit your configuration to add more haystacks:
Available Haystack Types
| Service | Description | Use Case |
|---------|-------------|----------|
| Ripgrep | Local file search | Personal documents, code repositories |
| AtomicServer | Atomic Data protocol | Knowledge bases, structured data |
| QueryRs | Reddit + Rust docs | Community knowledge, documentation |
| ClickUp | Task management | Project data, task tracking |
| Logseq | Personal knowledge management | Notes, personal knowledge graphs |
| MCP | Model Context Protocol | AI tool integration |
Environment Variables
# Override configuration location
# Set data directory
# Set logging level
# debug, info, warn, error
# Server configuration
🐳 Docker Deployment
Basic Docker Setup
# Pull and run the image
Docker Compose
Create docker-compose.yml:
version: '3.8'
services:
terraphim:
image: ghcr.io/terraphim/terraphim-server:v0.2.3
container_name: terraphim-server
ports:
- "8000:8000"
volumes:
- ./config:/home/terraphim/.config/terraphim
- ./data:/home/terraphim/data
environment:
- LOG_LEVEL=info
- RUST_LOG=info
restart: unless-stopped
healthcheck:
test:
interval: 30s
timeout: 10s
retries: 3
start_period: 40sStart with:
Custom Docker Build
FROM ubuntu:22.04
# Install dependencies
RUN apt-get update && apt-get install -y \
build-essential \
pkg-config \
libssl-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:$PATH"
# Build application
WORKDIR /app
COPY . .
RUN cargo build --release --package terraphim_server
# Create non-root user
RUN useradd --create-home --shell /bin/bash terraphim
RUN chown -R terraphim:terraphim /home/terraphim
USER terraphim
# Expose port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
# Run application
CMD ["terraphim_server"]🖥️ Usage
Web Interface
Access the web interface at http://localhost:8000:
- Search: Semantic search across your data sources
- Configuration: Manage roles and data sources
- Knowledge Graph: Visualize concept relationships
- Chat: AI-powered assistance
Terminal Interface (TUI)
The TUI provides a command-line interface with advanced features:
# Show help
# Search with TUI
# Multi-term search
# List available roles
# Switch role
# Interactive mode
# REPL mode
API Usage
Health Check
Search API
Summarization API
Chat API
🔧 Advanced Configuration
Multiple Roles
Create different configurations for different use cases:
LLM Integration
Configure AI providers for enhanced features:
Or with OpenRouter:
Storage Backends
Local Storage (Default)
- Memory: In-memory storage for testing
- DashMap: High-performance concurrent storage
- SQLite: Local database storage
- ReDB: Embedded key-value database
Cloud Storage (Optional)
# AWS S3 configuration
🔍 Troubleshooting
Common Issues
Server Won't Start
# Check logs
# Or with Docker
# Check configuration
Permission Errors
# Fix permissions
Port Already in Use
# Check what's using port 8000
|
# Kill the process
# Or use a different port
Search Returns No Results
- Verify your haystack configuration
- Check if files exist in specified locations
- Validate glob patterns match your file types
- Ensure file permissions allow reading
Memory Issues
# Monitor memory usage
# Increase swap space if needed
Debug Mode
Enable verbose logging:
# Enable debug logging
# Enable backtrace for errors
# Start server with debug
Performance Tuning
Optimize Search Performance
- Use SSD storage for data directories
- Limit haystack size to responsive amounts
- Choose appropriate relevance function:
TitleScorer: Fastest, basic text matchingBM25/BM25F: Good balance of speed and relevanceTerraphimGraph: Slowest but most accurate
Memory Optimization
# Limit memory usage
🚀 Production Deployment
Systemd Service (Linux)
Create /etc/systemd/system/terraphim-server.service:
[Unit]
Description=Terraphim AI Server
After=network.target
[Service]
Type=simple
User=terraphim
Group=terraphim
WorkingDirectory=/home/terraphim
ExecStart=/usr/local/bin/terraphim_server --config /home/terraphim/.config/terraphim/config.json
Restart=always
RestartSec=5
# Environment variables
Environment=RUST_LOG=info
Environment=LOG_LEVEL=info
# Security
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/home/terraphim/.local/share/terraphim
[Install]
WantedBy=multi-user.targetEnable and start:
Nginx Reverse Proxy
Create /etc/nginx/sites-available/terraphim:
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# WebSocket support for real-time features
location /ws {
proxy_pass http://localhost:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}Enable site:
SSL/TLS with Let's Encrypt
# Install certbot
# Get certificate
# Auto-renewal
# Add: 0 12 * * * /usr/bin/certbot renew --quiet📚 Additional Resources
🤝 Getting Help
- GitHub Issues: Report bugs
- Discussions: Community forum
- Discord: Real-time chat
- Discourse: Community discussions
Terraphim AI v0.2.3 - Privacy-first AI assistant with semantic search capabilities.