Sophon Docs
Self-Hosting

Configuration Reference

Complete reference for environment variables, internal configuration, data directory layout, and tier behavior.

Environment Variables

These variables are set in your .env file and read by Docker Compose.

VariableDefaultTiersDescription
SOPHON_DATArequiredAllAbsolute path to host data directory. No ~ expansion — use full path. Forward slashes on Windows.
DOCKER_GID999All (Linux)Docker socket group ID. Find with getent group docker | cut -d: -f3
GATEWAY_PORT8081AllHost port for the Gateway API
DASHBOARD_PORT8080AllHost port for the Dashboard UI
POSTGRES_USERsophonPro, EnterprisePostgreSQL username
POSTGRES_PASSWORDsophonPro, EnterprisePostgreSQL password — change in production
POSTGRES_PORT5432Pro, EnterpriseHost port for PostgreSQL
QDRANT_HTTP_PORT6333Pro, EnterpriseHost port for Qdrant HTTP API
QDRANT_GRPC_PORT6334Pro, EnterpriseHost port for Qdrant gRPC
REDIS_PORT6379EnterpriseHost port for Redis
REDIS_PASSWORDsophonEnterpriseRedis password — change in production
RABBITMQ_USERsophonEnterpriseRabbitMQ username
RABBITMQ_PASSWORDsophonEnterpriseRabbitMQ password — change in production
RABBITMQ_PORT5672EnterpriseHost port for RabbitMQ AMQP
RABBITMQ_MGMT_PORT15672EnterpriseHost port for RabbitMQ management UI
VAULT_PROVIDERlocalEnterpriseCredential vault backend (local, hashicorp, aws, azure)
VAULT_ADDRESShttp://vault:8200EnterpriseHashiCorp Vault address
VAULT_TOKEN(empty)EnterpriseHashiCorp Vault token
JWT_SECRET(empty)EnterpriseJWT signing secret for multi-user auth
SSO_ENABLEDfalseEnterpriseEnable SSO/OIDC authentication

Internal Environment Variables

These are set inside the compose files and should not be changed in .env. They configure the gateway container's internal behavior.

VariableValueDescription
SOPHON__TierPersonal / Pro / EnterpriseFeature tier — controls which features are enabled
SOPHON__Databasesqlite / postgresqlDatabase backend. Personal uses SQLite; Pro/Enterprise use PostgreSQL.
SOPHON__DataDirectory/home/sophon/.sophonContainer-internal path where the data volume is mounted
SOPHON__Sandbox__HostWorkspacesPath${SOPHON_DATA}/sandbox/workspacesHost path for sandbox bind mounts (must be accessible from the Docker daemon)
ConnectionStrings__PostgreSQLHost=postgres;...PostgreSQL connection string (Pro/Enterprise)
Qdrant__Endpointhttp://qdrant:6334Qdrant gRPC endpoint (Pro/Enterprise)
Sophon__Redis__ConnectionStringredis:6379,...Redis connection with password (Enterprise)
Sophon__MessageBus__ProviderrabbitmqMessage bus backend (Enterprise)
SOPHON_GATEWAY_URLhttp://sophon-gateway:8080Internal URL the Dashboard uses to reach the Gateway

Data Directory Layout

All Sophon runtime state lives in SOPHON_DATA on the host (mounted at /home/sophon/.sophon inside the container):

~/.sophon/
├── config/
│   ├── appsettings.user.json     # User-level configuration overrides
│   ├── models.json               # LLM provider configs (API keys encrypted)
│   ├── channels.json             # Channel connections (encrypted)
│   └── tts.json                  # TTS provider configs (encrypted)
├── agents/
│   └── default/
│       ├── SOUL.md               # Agent personality
│       ├── BOOT.md               # First-run init script
│       ├── HEARTBEAT.md          # Heartbeat checklist
│       └── TOOLS.md              # Available tools config
├── skills/
│   ├── bundled/                  # Ships with Sophon (read-only)
│   ├── installed/                # From Marketplace
│   └── self-authored/            # Created by the agent
├── memory/
│   ├── daily/                    # Short-term daily logs
│   ├── MEMORY.md                 # Long-term curated facts
│   └── entities/                 # Structured entity store
├── documents/
│   ├── uploads/                  # User-uploaded files
│   ├── processed/                # Extracted text and embeddings
│   └── index/                    # Search index (FTS + vector)
├── cron/
│   └── jobs.json                 # Scheduled jobs
├── workflows/
│   └── *.json                    # Workflow definitions
├── sandbox/
│   └── workspaces/               # Ephemeral code execution (auto-cleaned)
├── security/
│   └── vault.key                 # AES-256 encryption key — CRITICAL, back up!
├── logs/
│   └── sophon-YYYYMMDD.log       # Application logs (rotated daily)
└── data/
    ├── sophon.db                 # SQLite database (Personal tier only)
    └── cache/                    # Local cache (thumbnails, embeddings)

The security/vault.key file is the AES-256 encryption key used to encrypt credentials at rest. Without this file, encrypted credentials cannot be decrypted. Always include it in backups.

Tier Behavior

FeaturePersonalProEnterprise
DatabaseSQLite (embedded)PostgreSQL 17PostgreSQL 17
AuthenticationAuto-admin (single user)JWT multi-userJWT + SSO/OIDC
Credential EncryptionAES-256 (vault.key)AES-256 (vault.key)External vault (HashiCorp/AWS/Azure)
Vector Store(none)QdrantQdrant
CacheIn-memoryIn-memoryRedis 7
Message BusIn-processIn-processRabbitMQ 4.0
Multi-Tenancy(none)(none)Full tenant isolation
Audit Logging(none)(none)Full audit trail
RBAC(none)Basic rolesFull RBAC + custom roles
Horizontal ScalingSingle instanceSingle instanceMultiple replicas (K8s)

Changing tiers is a configuration change — the same binary, different feature flags. Set SOPHON__Tier in your compose file to switch.

First-Run Behavior

On first startup, Sophon:

  1. Creates the data directory if SOPHON_DATA doesn't exist on the host
  2. Seeds the default agent — creates agents/default/SOUL.md with a starter personality
  3. Runs database migrations — creates the SQLite database (Personal) or migrates PostgreSQL (Pro/Enterprise)
  4. Generates vault.key — creates the encryption key for credential storage
  5. Enters Setup Mode — the Dashboard shows the Setup Wizard to configure your first LLM provider

No manual migration step is ever needed. EF Core migrations run automatically on startup.