feat(01-foundation-01): monorepo scaffolding, Docker Compose, and shared data models
- pyproject.toml: uv workspace with 5 member packages (shared, gateway, router, orchestrator, llm-pool) - docker-compose.yml: PostgreSQL 16 + Redis 7 + Ollama services on konstruct-net - .env.example: all required env vars documented, konstruct_app role (not superuser) - scripts/init-db.sh: creates konstruct_app role at DB init time - packages/shared/shared/config.py: Pydantic Settings loading all env vars - packages/shared/shared/models/message.py: KonstructMessage, ChannelType, SenderInfo, MessageContent - packages/shared/shared/models/tenant.py: Tenant, Agent, ChannelConnection SQLAlchemy 2.0 models - packages/shared/shared/models/auth.py: PortalUser model for admin portal auth - packages/shared/shared/db.py: async SQLAlchemy engine, session factory, get_session dependency - packages/shared/shared/rls.py: current_tenant_id ContextVar and configure_rls_hook with parameterized SET LOCAL - packages/shared/shared/redis_keys.py: tenant-namespaced key constructors (rate_limit, idempotency, session, engaged_thread)
This commit is contained in:
63
.env.example
Normal file
63
.env.example
Normal file
@@ -0,0 +1,63 @@
|
||||
# =============================================================================
|
||||
# Konstruct — Environment Variables
|
||||
# Copy this file to .env and fill in the values.
|
||||
# NEVER commit .env to version control.
|
||||
# =============================================================================
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Database (PostgreSQL 16)
|
||||
# IMPORTANT: Use konstruct_app role, not the postgres superuser.
|
||||
# The postgres superuser bypasses RLS and must never be used by application code.
|
||||
# -----------------------------------------------------------------------------
|
||||
DATABASE_URL=postgresql+asyncpg://konstruct_app:konstruct_dev@localhost:5432/konstruct
|
||||
|
||||
# For Alembic migrations (runs as postgres superuser to CREATE ROLE, enable RLS, etc.)
|
||||
DATABASE_ADMIN_URL=postgresql+asyncpg://postgres:postgres_dev@localhost:5432/konstruct
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Redis / Valkey
|
||||
# -----------------------------------------------------------------------------
|
||||
REDIS_URL=redis://localhost:6379/0
|
||||
|
||||
# Celery broker and result backend
|
||||
CELERY_BROKER_URL=redis://localhost:6379/1
|
||||
CELERY_RESULT_BACKEND=redis://localhost:6379/2
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Slack
|
||||
# -----------------------------------------------------------------------------
|
||||
SLACK_BOT_TOKEN=xoxb-your-slack-bot-token
|
||||
SLACK_SIGNING_SECRET=your-slack-signing-secret
|
||||
SLACK_APP_TOKEN=xapp-your-slack-app-token # For Socket Mode (optional)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# LLM Providers
|
||||
# -----------------------------------------------------------------------------
|
||||
ANTHROPIC_API_KEY=sk-ant-your-anthropic-api-key
|
||||
OPENAI_API_KEY=sk-your-openai-api-key
|
||||
OLLAMA_BASE_URL=http://localhost:11434
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Auth / Security
|
||||
# AUTH_SECRET: Used to sign JWT tokens for the admin portal.
|
||||
# Generate with: python -c "import secrets; print(secrets.token_hex(32))"
|
||||
# -----------------------------------------------------------------------------
|
||||
AUTH_SECRET=change-me-generate-with-secrets-token-hex-32
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Service URLs (internal)
|
||||
# -----------------------------------------------------------------------------
|
||||
GATEWAY_URL=http://localhost:8001
|
||||
ROUTER_URL=http://localhost:8002
|
||||
ORCHESTRATOR_URL=http://localhost:8003
|
||||
LLM_POOL_URL=http://localhost:8004
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Application Settings
|
||||
# -----------------------------------------------------------------------------
|
||||
ENVIRONMENT=development
|
||||
LOG_LEVEL=INFO
|
||||
DEBUG=false
|
||||
|
||||
# Tenant rate limits (requests per minute defaults)
|
||||
DEFAULT_RATE_LIMIT_RPM=60
|
||||
Reference in New Issue
Block a user