Production Setup Guide

Complete guide for deploying Soothe in production environments.

Overview

This guide covers production deployment using the Helm chart (recommended), systemd for bare metal deployments, and Kubernetes for large-scale environments.

Prerequisites

System Requirements

Minimum (10 users, <50 threads):

  • CPU: 2 cores
  • RAM: 4 GB
  • Storage: 20 GB SSD
  • Network: Stable LAN connection

Recommended (50 users, <200 threads):

  • CPU: 4 cores
  • RAM: 8 GB
  • Storage: 50 GB SSD
  • Network: Dedicated database connection

Large Scale (500 users, >200 threads):

Software Requirements

  • Kubernetes (kubectl) and Helm 3+
  • PostgreSQL 17+ (or use the chart’s pgvector StatefulSet)
  • Python 3.11+ (for systemd deployment)

Network Requirements

  • Database port (5432) accessible from daemon
  • Daemon port (18765) accessible from clients (if WebSocket enabled)
  • Outbound HTTPS for LLM provider APIs

The fastest way to deploy Soothe in production.

Step 1: Prepare Provider Credentials

config/production/example.env has been removed. Export provider keys in the host shell so make helm-prod-up can forward them into the release. Alternatively, pass a gitignored values-secrets.yaml with HELM_EXTRA_VALUES="-f /secure/path/values-secrets.yaml", or set existingSecret to reference an externally managed Kubernetes Secret.

Required host environment variables:

# LLM provider credentials
export OPENAI_API_KEY=<your_openai_or_compatible_key>
export OPENAI_BASE_URL=<your_openai_compatible_base_url>  # Optional: for OpenAI-compatible providers

# Optional: web search / other tools
export TAVILY_API_KEY=<your_tavily_key>
export TYPESAFE_API_KEY=<your_typesafe_key>

PostgreSQL credentials are supplied by the chart Secret (secrets.POSTGRES_USER / secrets.POSTGRES_PASSWORD), defaulting to postgres/postgres; override them in your values file or via existingSecret. The daemon’s DSNs are provided by the chart and its mounted nano.yml — no manual connection-string file is needed.

Security: Never commit secrets to version control. Values come from the host shell environment or an externally managed Secret, not from a tracked file.

Step 2: Review Agent Configuration

The daemon’s nano.yml is config/production/nano.yml; the Makefile mounts it into the chart as a ConfigMap via --set-file daemon.config.nanoYml=..., so no copy to ~/.soothe/config/ is needed. Review it before deploying:

vim config/production/nano.yml  # Optional customization

Default configuration (uses environment variables):

providers:
  - name: openai-custom
    provider_type: openai
    api_base_url: "${OPENAI_BASE_URL}"
    api_key: "${OPENAI_API_KEY}"
    models:
      - qwen-max
      - qwen3.7-plus
      - text-embedding-v3

router_profiles:
  - name: production
    router:
      default: "openai-custom:qwen-max"
active_router_profile: production
embedding_profile:
  - model_role: "openai-custom:text-embedding-v3"
    embedding_dims: 1024

persistence:
  default_backend: postgresql
  postgres_base_dsn: "${SOOTHE_POSTGRES_BASE_DSN}"

vector_stores:
  - name: pgvector
    provider_type: pgvector
    dsn: "${SOOTHE_POSTGRES_VECTORS_DSN}"
    pool_size: 4

vector_store_router:
  default: "pgvector:soothe_default"

Key points:

  • Environment variables referenced with ${ENV_VAR}
  • PostgreSQL backend for production durability
  • pgvector for vector similarity search

Step 3: Deploy Stack

# Validate the chart and render manifests locally
make helm-lint && make helm-template

# Start services
make helm-prod-up

# Verify deployment
make helm-prod-status

# Expected output (pods in namespace soothe-prod):
# NAME                  READY   STATUS
# soothe-pgvector-0     1/1     Running
# soothe-daemon-...     1/1     Running

Step 4: Verify Database Initialization

Soothe auto-provisions PostgreSQL databases on first daemon startup when postgres_base_dsn is configured (RFC-802). No manual SQL init script is required for production.

# Start daemon and wait for provisioning (check logs)
kubectl -n soothe-prod logs deploy/soothe-daemon | grep -i "PostgreSQL database"

# Verify databases created
kubectl -n soothe-prod exec -it statefulset/soothe-pgvector -- psql -U postgres -l

# Expected databases (after soothed has started):
# soothe_checkpoints | postgres | UTF8
# soothe_metadata    | postgres | UTF8
# soothe_vectors     | postgres | UTF8 | pgvector extension
# soothe_memory      | postgres | UTF8

RFC-802 Multi-database architecture:

  • soothe_checkpoints: LangGraph + StrangeLoop state
  • soothe_metadata: Thread lifecycle metadata
  • soothe_vectors: Embedding vectors (pgvector)
  • soothe_memory: Long-term semantic memory

Step 5: Verify Daemon Health

# Check daemon logs
kubectl -n soothe-prod logs deploy/soothe-daemon

# Expose the daemon locally, then test connectivity (run the port-forward in another shell)
kubectl -n soothe-prod port-forward svc/soothe-daemon 18765:18765
soothe --daemon-host 127.0.0.1 --daemon-port 18765 -p "Hello"

Step 6: Test Full Stack

# Send test query
soothe -p "List all Python files in the workspace"  # CLI auto-connects to daemon

# Verify thread created in database
kubectl -n soothe-prod exec -it statefulset/soothe-pgvector -- psql -U postgres -d soothe_metadata \
  -c "SELECT thread_id, status FROM threads LIMIT 5"

Production Helm Configuration

Key settings (see deploy/helm/soothe/values.yaml, values-dev.yaml, and values-prod.yaml for the full defaults):

  • Chart-based install/upgrade via make helm-prod-up / make helm-dev-up
  • Liveness/readiness probes on the workloads
  • PVC-backed persistent storage (retained on uninstall)
  • Daemon nano.yml mounted from a ConfigMap via --set-file
  • Provider secrets injected from the host environment (or existingSecret)

Persistent Volumes

The chart provisions PVCs in soothe-prod: soothe-daemon-state, soothe-daemon-workspaces, and the pgvector StatefulSet PVC data-soothe-pgvector-0. They are retained by make helm-prod-down; to wipe all data, delete them explicitly:

kubectl -n soothe-prod delete pvc --all

Backup strategy:

# Backup pgvector data
kubectl -n soothe-prod exec statefulset/soothe-pgvector -- \
  tar czf - -C /var/lib/postgresql/data . > postgres_backup_$(date +%Y%m%d).tar.gz

# Backup daemon state
kubectl -n soothe-prod exec deploy/soothe-daemon -- \
  tar czf - -C /var/lib/soothe . > daemon_backup_$(date +%Y%m%d).tar.gz

See Backup Recovery for comprehensive backup strategies.

systemd Deployment (Bare Metal)

For environments without Kubernetes or requiring direct hardware access.

Quick Setup

  1. Install PostgreSQL: sudo apt install postgresql-17 postgresql-17-pgvector
  2. Install Python 3.11+: sudo apt install python3.11 python3.11-venv
  3. Create user: sudo useradd -r -s /bin/false soothe
  4. Install Soothe: sudo /opt/soothe/venv/bin/pip install soothe-daemon soothe
  5. Configure: Create /var/lib/soothe/config/nano.yml and /etc/default/soothe with environment variables
  6. Create systemd service: See config/production/soothed.service template

systemd Service Template

Key settings (/etc/systemd/system/soothed.service):

  • User=soothe — Run as dedicated user
  • EnvironmentFile=/etc/default/soothe — Load secrets from env file
  • ExecStart=/opt/soothe/venv/bin/soothed start --foreground
  • Restart=on-failure — Auto-restart

See config/production/soothed.service for the full template with security hardening options.

Kubernetes Deployment

NoNewPrivileges=true PrivateTmp=true ProtectSystem=strict ProtectHome=true ReadWritePaths=/var/lib/soothe /var/log/soothe

Resource limits

LimitNOFILE=65536 MemoryMax=4G

[Install] WantedBy=multi-user.target


### Step 7: Enable and Start Service

```bash
# Reload systemd
sudo systemctl daemon-reload

# Enable service (auto-start on boot)
sudo systemctl enable soothed

# Start service
sudo systemctl start soothed

# Check status
sudo systemctl status soothed

# View logs
sudo journalctl -u soothed -f

systemd Best Practices

Resource limits:

# Memory limit (prevent OOM)
MemoryMax=4G

# CPU limit (if multiple services)
CPUQuota=50%

# File descriptor limit (for many connections)
LimitNOFILE=65536

Security hardening:

# Prevent privilege escalation
NoNewPrivileges=true

# Isolate filesystem
ProtectSystem=strict
ProtectHome=true
PrivateTmp=true

# Allow only specific paths
ReadWritePaths=/var/lib/soothe /var/log/soothe

Restart behavior:

# Restart on failure
Restart=on-failure
RestartSec=5s

# Or always restart (more aggressive)
Restart=always
RestartSec=10s

Kubernetes Deployment

For large-scale, high-availability deployments.

See Scaling Strategies for complete Kubernetes deployment guide including:

  • StatefulSet for PostgreSQL
  • Deployment for Soothe daemon
  • Service and Ingress configuration
  • Horizontal Pod Autoscaler
  • ConfigMap and Secrets management

Network Configuration

Database Connection

PostgreSQL DSN format:

postgresql://user:password@host:port/database

Example:

persistence:
  postgres_base_dsn: postgresql://postgres:secret@postgres-host:5432

Production recommendations:

  • Use TLS for database connections (sslmode=require)
  • Use connection pooling (psycopg pool)
  • Set reasonable timeouts (connect_timeout=10)
  • Use read replicas for query-heavy loads

Example with TLS:

persistence:
  postgres_base_dsn: postgresql://user:pass@host:5432?sslmode=require&connect_timeout=10

Daemon Transports

Configure in ~/.soothe/config/daemon.yml:

WebSocket (local and remote):

transports:
  websocket:
    enabled: true
    host: "127.0.0.1"  # Bind to localhost; use reverse proxy for remote
    port: 8765
    cors_origins: ["https://your-app.com"]

Important: Use reverse proxy for remote WebSocket access. See Security Hardening.

Request timeouts

Long agent turns (multi-hour builds, large refactors) are bounded by thread_pool.request_timeout_seconds in daemon.yml (default 1209600 = 14 days). Autopilot goals use the parallel wall-clock knob agent.autopilot.goal_deadline_seconds in nano.yml (same default). Set either to 0 / null only when you accept unbounded runs.

# daemon.yml
thread_pool:
  request_timeout_seconds: 1209600  # 14d; 0 = no timeout

# nano.yml
agent:
  autopilot:
    goal_deadline_seconds: 1209600  # 14d; null disables

Firewall Rules

Production firewall configuration:

# Allow PostgreSQL from daemon only (Kubernetes cluster network)
# No external PostgreSQL access needed

# Allow daemon WebSocket from reverse proxy
sudo ufw allow from 10.0.0.0/8 to any port 8765 proto tcp

# Block direct daemon access from external
sudo ufw deny 8765

# Allow reverse proxy HTTPS
sudo ufw allow 443/tcp

Workspace Mount Configuration (RFC-621)

For container deployments, workspace paths need mapping between host and container.

Helm Workspace Volumes

In the Helm chart the daemon’s workspaces live on the soothe-daemon-workspaces PVC; there is no host bind-mount to configure. The daemon config is mounted from a ConfigMap via --set-file in the Makefile targets. For a locally run Docker daemon you can still bind-mount a host directory (-v ${SOOTHE_WORKSPACE_HOST_ROOT:-${HOME}}:/var/lib/soothe/workspaces).

Configuration Mapping

config/production/nano.yml resolves host_root from SOOTHE_WORKSPACE_HOST_ROOT (default $HOME) when the daemon runs locally with a bind mount:

workspace_mount:
  host_root: ${SOOTHE_WORKSPACE_HOST_ROOT}
  container_root: /var/lib/soothe/workspaces

How it works:

  • Client sends workspace path: /Users/yourname/Workspace/project1
  • Daemon maps to container path: /var/lib/soothe/workspaces/project1
  • File operations work correctly in container

Production Workspace Strategies

Strategy 1: Shared workspace mount:

# Mount entire workspace directory
- /home/team/workspace:/var/lib/soothe/workspaces

Strategy 2: Per-project mounts:

# Mount specific projects
- /var/www/project-a:/var/lib/soothe/workspaces/project-a
- /var/www/project-b:/var/lib/soothe/workspaces/project-b

Strategy 3: Dynamic mounts (Kubernetes):

Verification Checklist

After deployment, verify:

Database Connectivity

# Test PostgreSQL connection
psql -h postgres-host -U user -d soothe_checkpoints -c "SELECT 1"

# Verify pgvector extension
psql -h postgres-host -U user -d soothe_vectors -c "SELECT * FROM pg_extension WHERE extname='vector'"

# Check databases exist
psql -h postgres-host -U user -l | grep soothe

Daemon Health

# Check daemon status
soothed status

# Verify transports
soothed status --verbose

# Test WebSocket
curl http://localhost:8765/health

Configuration

# Verify environment variables
kubectl -n soothe-prod exec deploy/soothe-daemon -- env | grep SOOTHE

# Check config loaded
kubectl -n soothe-prod logs deploy/soothe-daemon | grep "config loaded"

Thread Creation

# Create test thread
soothe -p "Hello, this is a test"  # CLI auto-connects to daemon

# Verify in database
psql -h postgres-host -U user -d soothe_metadata \
  -c "SELECT thread_id, created_at FROM threads ORDER BY created_at DESC LIMIT 1"

Troubleshooting Production Deployment

PostgreSQL Connection Issues

Error: Connection refused or could not connect to server

Solution:

  1. Check PostgreSQL is running: kubectl -n soothe-prod get statefulset/soothe-pgvector
  2. Verify readiness: kubectl -n soothe-prod exec -it statefulset/soothe-pgvector -- pg_isready -U postgres
  3. Check credentials in the Helm Secret values (or your existingSecret)
  4. Verify firewall rules

pgvector Extension Missing

Error: extension "vector" must be installed

Solution:

# Install extension manually
kubectl -n soothe-prod exec -it statefulset/soothe-pgvector -- psql -U postgres -d soothe_vectors \
  -c "CREATE EXTENSION vector;"

# Verify extension
kubectl -n soothe-prod exec -it statefulset/soothe-pgvector -- psql -U postgres -d soothe_vectors \
  -c "SELECT * FROM pg_extension WHERE extname='vector'"

Daemon Won’t Start

Error: Daemon startup failed

Solution:

  1. Check logs: kubectl -n soothe-prod logs deploy/soothe-daemon
  2. Verify nano.yml syntax: python -c "import yaml; yaml.safe_load(open('config/production/nano.yml'))"
  3. Check rendered manifests: make helm-template
  4. Verify workspace PVC exists: kubectl -n soothe-prod get pvc soothe-daemon-workspaces

Workspace Access Denied

Error: Permission denied when accessing workspace

Solution:

# Check mount permissions
kubectl -n soothe-prod exec deploy/soothe-daemon -- ls -la /var/lib/soothe/workspaces

# Fix permissions on the shared workspace source
chmod -R a+rx /path/to/workspace

# Or set a matching securityContext.runAsUser in the chart values
securityContext:
  runAsUser: 1000  # Match host user UID:GID

Production Configuration Examples

Example 1: Standard Production (OpenAI-Compatible + PostgreSQL)

providers:
  - name: openai-custom
    provider_type: openai
    api_base_url: "${OPENAI_BASE_URL}"
    api_key: "${OPENAI_API_KEY}"
    models:
      - qwen-max
      - qwen3.7-plus
      - text-embedding-v3

router_profiles:
  - name: production
    router:
      default: "openai-custom:qwen-max"
      fast: "openai-custom:qwen3.7-plus"
      think: "openai-custom:qwen-max"
active_router_profile: production
embedding_profile:
  - model_role: "openai-custom:text-embedding-v3"
    embedding_dims: 1024

persistence:
  default_backend: postgresql
  postgres_base_dsn: "${SOOTHE_POSTGRES_BASE_DSN}"
  postgres:
    pool_min_size: 8
    checkpoints_pool_size: 32

vector_stores:
  - name: pgvector
    provider_type: pgvector
    dsn: "${SOOTHE_POSTGRES_VECTORS_DSN}"
    pool_size: 8
    index_type: hnsw

observability:
  log_file_path: /var/log/soothe/soothed.log
  log_file_level: INFO
  verbosity: normal

Example 2: Multi-Provider Production (OpenAI + Anthropic + PostgreSQL)

providers:
  - name: openai
    provider_type: openai
    api_key: "${OPENAI_API_KEY}"
    models:
      - gpt-4o
      - gpt-4o-mini
      - o3-mini

  - name: anthropic
    provider_type: anthropic
    api_key: "${ANTHROPIC_API_KEY}"
    models:
      - claude-sonnet-4-20250514

router_profiles:
  - name: production
    router:
      default: "openai:gpt-4o-mini"
      think: "anthropic:claude-sonnet-4-20250514"
      fast: "openai:gpt-4o-mini"
      image: "openai:gpt-4o"
active_router_profile: production
embedding_profile:
  - model_role: "openai:text-embedding-3-small"
    embedding_dims: 1536

persistence:
  default_backend: postgresql
  postgres_base_dsn: "${POSTGRES_DSN}"

Example 3: Secure Production (Strict Security Policy)

providers:
  - name: openai
    provider_type: openai
    api_key: "${OPENAI_API_KEY}"
    models:
      - gpt-4o-mini

persistence:
  default_backend: postgresql

security:
  allow_paths_outside_workspace: false
  require_approval_for_outside_paths: true
  denied_paths:
    - /etc/**
    - /bin/**
    - /usr/**
    - ~/.ssh/**
    - ~/.aws/**
    - '**/.env'
    - '**/secrets.json'
  denied_file_types:
    - .key
    - .pem
    - .p12
  require_approval_for_file_types:
    - .env
    - .credentials

agent:
  loop:
    max_iterations: 15   # shared StrangeLoop budget (interactive + Autopilot)
  autopilot:
    enabled: false
    max_parallel_goals: 2

Next Steps

After successful production deployment:

  1. Monitoring: Configure observability → Monitoring Guide
  2. Security: Harden deployment → Security Hardening
  3. Scaling: Plan for growth → Scaling Strategies
  4. Backup: Protect data → Backup Recovery

Questions? Check Troubleshooting or the Helm chart.