Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions docker/docker-compose/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Docker Compose file for Hindsight with PostgreSQL and pgvector
#
# Make sure to set the required environment variables before running:
# - HINDSIGHT_DB_PASSWORD: Password for the PostgreSQL user
# - Configure LLM provider variables as needed (see below in the hindsight service)
#
# Usage:
# docker compose up -d
#
# Optional environment variables with defaults:
# - HINDSIGHT_VERSION: Hindsight application version (default: latest)
# - HINDSIGHT_DB_USER: PostgreSQL user (default: hindsight_user)
# - HINDSIGHT_DB_NAME: PostgreSQL database name (default: hindsight_db)
# - HINDSIGHT_DB_VERSION: PostgreSQL version (default: 18)

services:
db:
# Use a PostgreSQL-Image with pgvector extension pre-installed
# see https://hub.docker.com/r/pgvector/pgvector
image: pgvector/pgvector:pg${HINDSIGHT_DB_VERSION:-18}
container_name: hindsight-db
restart: always
# Expose PostgreSQL port
# ports:
# - "5432:5432"
environment:
POSTGRES_USER: ${HINDSIGHT_DB_USER:-hindsight_user}
POSTGRES_PASSWORD: ${HINDSIGHT_DB_PASSWORD:?Please set the HINDSIGHT_DB_PASSWORD env variable}
POSTGRES_DB: ${HINDSIGHT_DB_NAME:-hindsight_db}
volumes:
- postgres_data:/var/lib/postgresql/${HINDSIGHT_DB_VERSION:-18}/docker
networks:
- hindsight-net

hindsight:
image: ghcr.io/vectorize-io/hindsight:${HINDSIGHT_VERSION:-latest}
container_name: hindsight-app
pull_policy: always
ports:
- "8888:8888"
- "9999:9999"
environment:
# For more LLM providers see https://hindsight.vectorize.io/developer/configuration#llm-provider

# LLM-configuration for Grog
# - HINDSIGHT_API_LLM_PROVIDER=groq
# - HINDSIGHT_API_LLM_API_KEY=${GROG_API_KEY?Please set the GROG_API_KEY env variable}
# - HINDSIGHT_API_LLM_MODEL=${HINDSIGHT_API_LLM_MODEL:-openai/gpt-oss-20b}

# LLM-configuration for OpenAI
# - HINDSIGHT_API_LLM_PROVIDER=openai
# - HINDSIGHT_API_LLM_API_KEY=${OPENAI_API_KEY?Please set the OPENAI_API_KEY env variable}
# - HINDSIGHT_API_LLM_MODEL=${HINDSIGHT_API_LLM_MODEL:-gpt-4o}

# Gemini
# - HINDSIGHT_API_LLM_PROVIDER=gemini
# - HINDSIGHT_API_LLM_API_KEY=${GEMINI_API_KEY?Please set the GEMINI_API_KEY env variable}
# - HINDSIGHT_API_LLM_MODEL=${HINDSIGHT_API_LLM_MODEL:-gemini-2.0-flash}

# Anthropic
# - HINDSIGHT_API_LLM_PROVIDER=anthropic
# - HINDSIGHT_API_LLM_API_KEY=${ANTHROPIC_API_KEY?Please set the ANTHROPIC_API_KEY env variable}
# - HINDSIGHT_API_LLM_MODEL=${HINDSIGHT_API_LLM_MODEL:-claude-sonnet-4-20250514}

# LLM-configuration for Ollama (local, no API key)
# - HINDSIGHT_API_LLM_PROVIDER=ollama
# - HINDSIGHT_API_LLM_BASE_URL=${HINDSIGHT_API_LLM_BASE_URL:-http://127.0.0.1:11434/v1}
# - HINDSIGHT_API_LLM_MODEL=${HINDSIGHT_API_LLM_MODEL:-llama3.2}


# Configuration for the external Postgres database
- HINDSIGHT_API_DATABASE_URL=postgresql://${HINDSIGHT_DB_USER:-hindsight_user}:${HINDSIGHT_DB_PASSWORD:?Please set the HINDSIGHT_DB_PASSWORD env variable}@db:5432/${HINDSIGHT_DB_NAME:-hindsight_db}
# use public schema, otherwise the app start fails (2026-02-06)
- HINDSIGHT_API_DATABASE_SCHEMA=public

# disable if you don't want automatic migrations on startup
- HINDSIGHT_API_RUN_MIGRATIONS_ON_STARTUP=true
volumes:
- ~/.hindsight-docker:/home/hindsight/.pg0
depends_on:
- db
networks:
- hindsight-net

networks:
hindsight-net:
driver: bridge

volumes:
postgres_data:
9 changes: 5 additions & 4 deletions hindsight-api/hindsight_api/banner.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ def print_startup_info(
if version:
print(f" {dim('Version:')} {color(f'v{version}', 0.1)}")
print(f" {dim('URL:')} {color(f'http://{host}:{port}', 0.2)}")
print(f" {dim('Database:')} {color(database_url, 0.4)}")
print(f" {dim('LLM:')} {color(f'{llm_provider} / {llm_model}', 0.6)}")
print(f" {dim('Embeddings:')} {color(embeddings_provider, 0.8)}")
print(f" {dim('Reranker:')} {color(reranker_provider, 1.0)}")
print(f" {dim('LLM:')} {color(f'{llm_provider} / {llm_model}', 0.4)}")
print(f" {dim('Embeddings:')} {color(embeddings_provider, 0.6)}")
print(f" {dim('Reranker:')} {color(reranker_provider, 0.8)}")
# database_url is sensitive info and avoid showing full URL
# print(f" {dim('Database:')} {color(database_url, 1.0)}")
if mcp_enabled:
print(f" {dim('MCP:')} {color_end('enabled at /mcp')}")
print()
4 changes: 3 additions & 1 deletion hindsight-api/hindsight_api/engine/memory_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,9 @@ async def verify_llm():
except Exception as e:
logger.warning(f"Failed to run schema migrations: {e}")

logger.info(f"Connecting to PostgreSQL at {self.db_url}")
logger.info(f"Connecting to PostgreSQL")
# db_url is sensitive info, log at debug level only
logger.debug(f"PostgreSQL connection URL: {self.db_url}")

# Create connection pool
# For read-heavy workloads with many parallel think/search operations,
Expand Down
3 changes: 2 additions & 1 deletion hindsight-api/hindsight_api/migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def _run_migrations_internal(database_url: str, script_location: str, schema: st
"""
schema_name = schema or "public"
logger.info(f"Running database migrations to head for schema '{schema_name}'...")
logger.info(f"Database URL: {database_url}")
# database_url is sensitive info, log at debug level only
logger.debug(f"Database URL: {database_url}")
logger.info(f"Script location: {script_location}")

# Create Alembic configuration programmatically (no alembic.ini needed)
Expand Down