- Add GUIDE.md: complete user documentation covering installation, Docker deployment, AI providers, MCP server, N8N integration, email config, admin panel, env var reference, troubleshooting - Add mcp-server/.env.example with all MCP-specific variables - Update .env.docker.example with all 42 environment variables - Fix docker-compose.yml: parameterize PostgreSQL credentials, add missing env vars (CUSTOM_OPENAI, AI_PROVIDER_CHAT, ALLOW_REGISTRATION, RESEND_API_KEY) - Track memento-note/.env.example
162 lines
4.7 KiB
YAML
162 lines
4.7 KiB
YAML
services:
|
|
# ============================================
|
|
# PostgreSQL - Shared Database
|
|
# ============================================
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: memento-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER:-memento}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-memento}
|
|
POSTGRES_DB: ${POSTGRES_DB:-memento}
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
ports:
|
|
- "5432:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-memento}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- memento-network
|
|
|
|
# ============================================
|
|
# memento-note - Next.js Web Application
|
|
# ============================================
|
|
memento-note:
|
|
build:
|
|
context: ./memento-note
|
|
dockerfile: Dockerfile
|
|
container_name: memento-web
|
|
env_file:
|
|
- .env.docker
|
|
ports:
|
|
- "3000:3000"
|
|
environment:
|
|
- DATABASE_URL=postgresql://${POSTGRES_USER:-memento}:${POSTGRES_PASSWORD:-memento}@postgres:5432/${POSTGRES_DB:-memento}
|
|
- NEXTAUTH_SECRET=${NEXTAUTH_SECRET:-changethisinproduction}
|
|
- NEXTAUTH_URL=${NEXTAUTH_URL:-http://localhost:3000}
|
|
- NODE_ENV=production
|
|
- NEXT_TELEMETRY_DISABLED=1
|
|
|
|
# Email Configuration (SMTP)
|
|
- SMTP_HOST=${SMTP_HOST}
|
|
- SMTP_PORT=${SMTP_PORT:-587}
|
|
- SMTP_USER=${SMTP_USER}
|
|
- SMTP_PASS=${SMTP_PASS}
|
|
- SMTP_FROM=${SMTP_FROM:-noreply@memento.app}
|
|
|
|
# AI Providers
|
|
- AI_PROVIDER_TAGS=${AI_PROVIDER_TAGS}
|
|
- AI_PROVIDER_EMBEDDING=${AI_PROVIDER_EMBEDDING}
|
|
- AI_PROVIDER_CHAT=${AI_PROVIDER_CHAT}
|
|
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
|
- OLLAMA_BASE_URL=${OLLAMA_BASE_URL}
|
|
- AI_MODEL_TAGS=${AI_MODEL_TAGS}
|
|
- AI_MODEL_EMBEDDING=${AI_MODEL_EMBEDDING}
|
|
- AI_MODEL_CHAT=${AI_MODEL_CHAT}
|
|
- CUSTOM_OPENAI_API_KEY=${CUSTOM_OPENAI_API_KEY}
|
|
- CUSTOM_OPENAI_BASE_URL=${CUSTOM_OPENAI_BASE_URL}
|
|
- ALLOW_REGISTRATION=${ALLOW_REGISTRATION:-true}
|
|
- RESEND_API_KEY=${RESEND_API_KEY}
|
|
volumes:
|
|
- uploads-data:/app/public/uploads
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--spider", "-q", "http://localhost:3000"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
networks:
|
|
- memento-network
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '2'
|
|
memory: 2G
|
|
reservations:
|
|
cpus: '0.5'
|
|
memory: 512M
|
|
|
|
# ============================================
|
|
# mcp-server - MCP Protocol Server
|
|
# ============================================
|
|
mcp-server:
|
|
build:
|
|
context: ./mcp-server
|
|
dockerfile: Dockerfile
|
|
container_name: memento-mcp
|
|
env_file:
|
|
- .env.docker
|
|
ports:
|
|
# SSE mode exposes port 3001, stdio mode doesn't need ports
|
|
- "3001:3001"
|
|
environment:
|
|
# Mode: 'stdio' (default, for Claude Desktop) or 'sse' (for HTTP/N8N)
|
|
- MCP_MODE=${MCP_MODE:-stdio}
|
|
- PORT=${MCP_PORT:-3001}
|
|
# Database - connect to shared PostgreSQL
|
|
- DATABASE_URL=postgresql://${POSTGRES_USER:-memento}:${POSTGRES_PASSWORD:-memento}@postgres:5432/${POSTGRES_DB:-memento}
|
|
- NODE_ENV=production
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
networks:
|
|
- memento-network
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "if [ \"${MCP_MODE}\" = 'sse' ]; then wget --spider -q http://localhost:3001/ || exit 1; else node -e \"console.log('healthy')\" || exit 1; fi"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
# ============================================
|
|
# Ollama - Local LLM Provider (Optional)
|
|
# ============================================
|
|
ollama:
|
|
image: ollama/ollama:latest
|
|
container_name: memento-ollama
|
|
ports:
|
|
- "11434:11434"
|
|
volumes:
|
|
- ollama-data:/root/.ollama
|
|
restart: unless-stopped
|
|
networks:
|
|
- memento-network
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '4'
|
|
memory: 8G
|
|
reservations:
|
|
cpus: '2'
|
|
memory: 4G
|
|
# Ollama is optional - only enable if you set AI_PROVIDER_TAGS=ollama
|
|
profiles:
|
|
- ollama
|
|
|
|
# ============================================
|
|
# Volumes - Data Persistence
|
|
# ============================================
|
|
volumes:
|
|
postgres-data:
|
|
driver: local
|
|
uploads-data:
|
|
driver: local
|
|
ollama-data:
|
|
driver: local
|
|
|
|
# ============================================
|
|
# Networks - Service Communication
|
|
# ============================================
|
|
networks:
|
|
memento-network:
|
|
driver: bridge
|