Skip to content
Merged
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
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ services:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-sinapse_dev_password}
- POSTGRES_DB=${POSTGRES_DB:-sinapse}

# AI Service dentro da rede Docker
- AI_SERVICE_URL=http://ai-service:8000
# AI Service (usa host.docker.internal para acessar IA rodando nativa no Windows)
- AI_SERVICE_URL=${AI_SERVICE_URL:-http://host.docker.internal:8000}
- DOCUMENT_INGESTION_TOKEN=${DOCUMENT_INGESTION_TOKEN:-sinapse-dev-document-ingestion-token-2026}
- REPO_ANALYZER_URL=${REPO_ANALYZER_URL:-http://ai-service:8000}
- REPO_ANALYZER_URL=${REPO_ANALYZER_URL:-http://host.docker.internal:8000}
- AI_SERVICE_TOKEN=${AI_SERVICE_TOKEN:?Configure AI_SERVICE_TOKEN in .env}
- DOCUMENT_MAX_SIZE_MB=${DOCUMENT_MAX_SIZE_MB:-20}

Expand Down
50 changes: 50 additions & 0 deletions start-dev.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Script para iniciar ambiente de desenvolvimento Sinapse
# 1. Inicia o Ollama (se não estiver rodando)
# 2. Sobe os containers essenciais (Postgres, Backend, Frontend)
# 3. Inicia o AI-Service (FastAPI) nativo no Windows usando aceleração local de hardware

$ErrorActionPreference = "Stop"
$rootDir = $PSScriptRoot

Write-Host "======================================================" -ForegroundColor Cyan
Write-Host " SINAPSE - INICIALIZANDO AMBIENTE DEV " -ForegroundColor Cyan
Write-Host "======================================================" -ForegroundColor Cyan

# 1. Ollama
Write-Host "`n[1/3] Verificando Ollama..." -ForegroundColor Yellow
$ollamaProc = Get-Process -Name "ollama app", "ollama" -ErrorAction SilentlyContinue
if (-not $ollamaProc) {
Write-Host "Iniciando Ollama em segundo plano..." -ForegroundColor Gray
Start-Process "ollama" "serve" -WindowStyle Minimized
Start-Sleep -Seconds 2
} else {
Write-Host "Ollama ja esta em execucao." -ForegroundColor Green
}

# 2. Containers Docker
Write-Host "`n[2/3] Subindo containers Docker (Postgres, Backend, Frontend)..." -ForegroundColor Yellow
Set-Location $rootDir
docker compose up -d postgres backend frontend

# 3. AI Service (Python nativo)
Write-Host "`n[3/3] Configurando e iniciando AI-Service local..." -ForegroundColor Yellow
$aiPath = Join-Path $rootDir "ai-service"

if (-not (Test-Path "$aiPath\.venv")) {
Write-Host "Ambiente virtual (.venv) nao encontrado em $aiPath. Criando..." -ForegroundColor Cyan
python -m venv "$aiPath\.venv"
Write-Host "Instalando dependencias do ai-service..." -ForegroundColor Cyan
& "$aiPath\.venv\Scripts\pip" install -r "$aiPath\requirements.txt"
}

Write-Host "Iniciando FastAPI em nova janela..." -ForegroundColor Green
$cmdArgs = "-NoExit -Command `"cd '$aiPath'; .\.venv\Scripts\activate; uvicorn main:app --host 0.0.0.0 --port 8000 --reload`""
Start-Process powershell -ArgumentList $cmdArgs

Write-Host "`n======================================================" -ForegroundColor Green
Write-Host " Tudo pronto!" -ForegroundColor Green
Write-Host " - Frontend: http://localhost:5173" -ForegroundColor White
Write-Host " - Backend: http://localhost:3001" -ForegroundColor White
Write-Host " - AI Service: http://localhost:8000" -ForegroundColor White
Write-Host " - Ollama: http://localhost:11434" -ForegroundColor White
Write-Host "======================================================`n" -ForegroundColor Green
13 changes: 13 additions & 0 deletions stop-dev.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Script para desligar ambiente de desenvolvimento Sinapse

$ErrorActionPreference = "SilentlyContinue"
$rootDir = $PSScriptRoot

Write-Host "Encerrando containers Docker..." -ForegroundColor Yellow
Set-Location $rootDir
docker compose down

Write-Host "Encerrando processo do AI Service (uvicorn)..." -ForegroundColor Yellow
Get-Process -Name "uvicorn" -ErrorAction SilentlyContinue | Stop-Process -Force

Write-Host "Ambiente de desenvolvimento finalizado com sucesso." -ForegroundColor Green
Loading