mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 16:56:22 +02:00
227 lines
7.8 KiB
YAML
227 lines
7.8 KiB
YAML
# =============================================================================
|
||
# SurfSense — Development Docker Compose
|
||
# =============================================================================
|
||
# Usage (from repo root):
|
||
# docker compose -f docker/docker-compose.dev.yml up --build
|
||
#
|
||
# This file builds from source and includes dev tools like pgAdmin.
|
||
# For production with prebuilt images, use docker/docker-compose.yml instead.
|
||
# =============================================================================
|
||
|
||
name: surfsense-dev
|
||
|
||
services:
|
||
db:
|
||
image: pgvector/pgvector:pg17
|
||
ports:
|
||
- "${POSTGRES_PORT:-5432}:5432"
|
||
volumes:
|
||
- postgres_data:/var/lib/postgresql/data
|
||
- ./postgresql.conf:/etc/postgresql/postgresql.conf:ro
|
||
environment:
|
||
- POSTGRES_USER=${DB_USER:-postgres}
|
||
- POSTGRES_PASSWORD=${DB_PASSWORD:-postgres}
|
||
- POSTGRES_DB=${DB_NAME:-surfsense}
|
||
command: postgres -c config_file=/etc/postgresql/postgresql.conf
|
||
healthcheck:
|
||
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres} -d ${DB_NAME:-surfsense}"]
|
||
interval: 10s
|
||
timeout: 5s
|
||
retries: 5
|
||
|
||
pgadmin:
|
||
image: dpage/pgadmin4
|
||
ports:
|
||
- "${PGADMIN_PORT:-5050}:80"
|
||
environment:
|
||
- PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL:-admin@surfsense.com}
|
||
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD:-surfsense}
|
||
volumes:
|
||
- pgadmin_data:/var/lib/pgadmin
|
||
depends_on:
|
||
- db
|
||
|
||
redis:
|
||
image: redis:8-alpine
|
||
ports:
|
||
- "${REDIS_PORT:-6379}:6379"
|
||
volumes:
|
||
- redis_data:/data
|
||
command: redis-server --appendonly yes
|
||
healthcheck:
|
||
test: ["CMD", "redis-cli", "ping"]
|
||
interval: 10s
|
||
timeout: 5s
|
||
retries: 5
|
||
|
||
searxng:
|
||
image: searxng/searxng:2026.3.13-3c1f68c59
|
||
ports:
|
||
- "${SEARXNG_PORT:-8888}:8080"
|
||
volumes:
|
||
- ./searxng:/etc/searxng
|
||
environment:
|
||
- SEARXNG_SECRET=${SEARXNG_SECRET:-surfsense-searxng-secret}
|
||
healthcheck:
|
||
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8080/healthz"]
|
||
interval: 10s
|
||
timeout: 5s
|
||
retries: 5
|
||
|
||
backend:
|
||
build: ../surfsense_backend
|
||
ports:
|
||
- "${BACKEND_PORT:-8000}:8000"
|
||
volumes:
|
||
- ../surfsense_backend/app:/app/app
|
||
- shared_temp:/shared_tmp
|
||
env_file:
|
||
- ../surfsense_backend/.env
|
||
environment:
|
||
- DATABASE_URL=${DATABASE_URL:-postgresql+asyncpg://${DB_USER:-postgres}:${DB_PASSWORD:-postgres}@${DB_HOST:-db}:${DB_PORT:-5432}/${DB_NAME:-surfsense}}
|
||
- CELERY_BROKER_URL=${REDIS_URL:-redis://redis:6379/0}
|
||
- CELERY_RESULT_BACKEND=${REDIS_URL:-redis://redis:6379/0}
|
||
- REDIS_APP_URL=${REDIS_URL:-redis://redis:6379/0}
|
||
- CELERY_TASK_DEFAULT_QUEUE=surfsense
|
||
- PYTHONPATH=/app
|
||
- UVICORN_LOOP=asyncio
|
||
- UNSTRUCTURED_HAS_PATCHED_LOOP=1
|
||
- LANGCHAIN_TRACING_V2=false
|
||
- LANGSMITH_TRACING=false
|
||
- AUTH_TYPE=${AUTH_TYPE:-LOCAL}
|
||
- NEXT_FRONTEND_URL=${NEXT_FRONTEND_URL:-http://localhost:3000}
|
||
- SEARXNG_DEFAULT_HOST=${SEARXNG_DEFAULT_HOST:-http://searxng:8080}
|
||
# Daytona Sandbox – uncomment and set credentials to enable cloud code execution
|
||
# - DAYTONA_SANDBOX_ENABLED=TRUE
|
||
# - DAYTONA_API_KEY=${DAYTONA_API_KEY:-}
|
||
# - DAYTONA_API_URL=${DAYTONA_API_URL:-https://app.daytona.io/api}
|
||
# - DAYTONA_TARGET=${DAYTONA_TARGET:-us}
|
||
- SERVICE_ROLE=api
|
||
depends_on:
|
||
db:
|
||
condition: service_healthy
|
||
redis:
|
||
condition: service_healthy
|
||
searxng:
|
||
condition: service_healthy
|
||
healthcheck:
|
||
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
||
interval: 15s
|
||
timeout: 5s
|
||
retries: 30
|
||
start_period: 200s
|
||
|
||
celery_worker:
|
||
build: ../surfsense_backend
|
||
volumes:
|
||
- ../surfsense_backend/app:/app/app
|
||
- shared_temp:/shared_tmp
|
||
env_file:
|
||
- ../surfsense_backend/.env
|
||
environment:
|
||
- DATABASE_URL=${DATABASE_URL:-postgresql+asyncpg://${DB_USER:-postgres}:${DB_PASSWORD:-postgres}@${DB_HOST:-db}:${DB_PORT:-5432}/${DB_NAME:-surfsense}}
|
||
- CELERY_BROKER_URL=${REDIS_URL:-redis://redis:6379/0}
|
||
- CELERY_RESULT_BACKEND=${REDIS_URL:-redis://redis:6379/0}
|
||
- REDIS_APP_URL=${REDIS_URL:-redis://redis:6379/0}
|
||
- CELERY_TASK_DEFAULT_QUEUE=surfsense
|
||
- PYTHONPATH=/app
|
||
- SEARXNG_DEFAULT_HOST=${SEARXNG_DEFAULT_HOST:-http://searxng:8080}
|
||
- SERVICE_ROLE=worker
|
||
depends_on:
|
||
db:
|
||
condition: service_healthy
|
||
redis:
|
||
condition: service_healthy
|
||
backend:
|
||
condition: service_healthy
|
||
|
||
celery_beat:
|
||
build: ../surfsense_backend
|
||
env_file:
|
||
- ../surfsense_backend/.env
|
||
environment:
|
||
- DATABASE_URL=${DATABASE_URL:-postgresql+asyncpg://${DB_USER:-postgres}:${DB_PASSWORD:-postgres}@${DB_HOST:-db}:${DB_PORT:-5432}/${DB_NAME:-surfsense}}
|
||
- CELERY_BROKER_URL=${REDIS_URL:-redis://redis:6379/0}
|
||
- CELERY_RESULT_BACKEND=${REDIS_URL:-redis://redis:6379/0}
|
||
- CELERY_TASK_DEFAULT_QUEUE=surfsense
|
||
- PYTHONPATH=/app
|
||
- SERVICE_ROLE=beat
|
||
depends_on:
|
||
db:
|
||
condition: service_healthy
|
||
redis:
|
||
condition: service_healthy
|
||
celery_worker:
|
||
condition: service_started
|
||
|
||
# flower:
|
||
# build: ../surfsense_backend
|
||
# ports:
|
||
# - "${FLOWER_PORT:-5555}:5555"
|
||
# env_file:
|
||
# - ../surfsense_backend/.env
|
||
# environment:
|
||
# - CELERY_BROKER_URL=${REDIS_URL:-redis://redis:6379/0}
|
||
# - CELERY_RESULT_BACKEND=${REDIS_URL:-redis://redis:6379/0}
|
||
# - PYTHONPATH=/app
|
||
# command: celery -A app.celery_app flower --port=5555
|
||
# depends_on:
|
||
# - redis
|
||
# - celery_worker
|
||
|
||
zero-cache:
|
||
image: rocicorp/zero:0.26.2
|
||
ports:
|
||
- "${ZERO_CACHE_PORT:-4848}:4848"
|
||
extra_hosts:
|
||
- "host.docker.internal:host-gateway"
|
||
depends_on:
|
||
db:
|
||
condition: service_healthy
|
||
environment:
|
||
- ZERO_UPSTREAM_DB=${ZERO_UPSTREAM_DB:-postgresql://${DB_USER:-postgres}:${DB_PASSWORD:-postgres}@${DB_HOST:-db}:${DB_PORT:-5432}/${DB_NAME:-surfsense}?sslmode=${DB_SSLMODE:-disable}}
|
||
- ZERO_CVR_DB=${ZERO_CVR_DB:-postgresql://${DB_USER:-postgres}:${DB_PASSWORD:-postgres}@${DB_HOST:-db}:${DB_PORT:-5432}/${DB_NAME:-surfsense}?sslmode=${DB_SSLMODE:-disable}}
|
||
- ZERO_CHANGE_DB=${ZERO_CHANGE_DB:-postgresql://${DB_USER:-postgres}:${DB_PASSWORD:-postgres}@${DB_HOST:-db}:${DB_PORT:-5432}/${DB_NAME:-surfsense}?sslmode=${DB_SSLMODE:-disable}}
|
||
- ZERO_REPLICA_FILE=/data/zero.db
|
||
- ZERO_ADMIN_PASSWORD=${ZERO_ADMIN_PASSWORD:-surfsense-zero-admin}
|
||
- ZERO_QUERY_URL=${ZERO_QUERY_URL:-http://frontend:3000/api/zero/query}
|
||
- ZERO_MUTATE_URL=${ZERO_MUTATE_URL:-http://frontend:3000/api/zero/mutate}
|
||
volumes:
|
||
- zero_cache_data:/data
|
||
restart: unless-stopped
|
||
healthcheck:
|
||
test: ["CMD", "curl", "-f", "http://localhost:4848/keepalive"]
|
||
interval: 10s
|
||
timeout: 5s
|
||
retries: 5
|
||
|
||
frontend:
|
||
build:
|
||
context: ../surfsense_web
|
||
args:
|
||
NEXT_PUBLIC_FASTAPI_BACKEND_URL: ${NEXT_PUBLIC_FASTAPI_BACKEND_URL:-http://localhost:8000}
|
||
NEXT_PUBLIC_FASTAPI_BACKEND_AUTH_TYPE: ${NEXT_PUBLIC_FASTAPI_BACKEND_AUTH_TYPE:-LOCAL}
|
||
NEXT_PUBLIC_ETL_SERVICE: ${NEXT_PUBLIC_ETL_SERVICE:-DOCLING}
|
||
NEXT_PUBLIC_ZERO_CACHE_URL: ${NEXT_PUBLIC_ZERO_CACHE_URL:-http://localhost:${ZERO_CACHE_PORT:-4848}}
|
||
NEXT_PUBLIC_DEPLOYMENT_MODE: ${NEXT_PUBLIC_DEPLOYMENT_MODE:-self-hosted}
|
||
ports:
|
||
- "${FRONTEND_PORT:-3000}:3000"
|
||
env_file:
|
||
- ../surfsense_web/.env
|
||
depends_on:
|
||
backend:
|
||
condition: service_healthy
|
||
zero-cache:
|
||
condition: service_healthy
|
||
|
||
volumes:
|
||
postgres_data:
|
||
name: surfsense-dev-postgres
|
||
pgadmin_data:
|
||
name: surfsense-dev-pgadmin
|
||
redis_data:
|
||
name: surfsense-dev-redis
|
||
shared_temp:
|
||
name: surfsense-dev-shared-temp
|
||
zero_cache_data:
|
||
name: surfsense-dev-zero-cache
|