Commit graph

9 commits

Author SHA1 Message Date
Vadym Samoilenko
8c5e01f660 Fix deploy.sh: health check false-failure on --backend-only / --frontend-only
`A && B || C` in bash fires C when A is false (service intentionally
skipped). Replaced with if/fi blocks so || FAILED=1 only triggers
when the health check itself fails.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 15:18:10 +01:00
Vadym Samoilenko
954e05e01e Fix docker compose up blocking on frontend healthcheck
- frontend depends_on: service_started (not service_healthy) — docker compose
  up -d now returns once containers start, not after full health chain resolves
- frontend healthcheck: use node HTTP check (wget/curl not in alpine runner)
- start_period: 60s (Next.js can take time on first request)
- on_error: show 60 log lines instead of 30

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 14:57:12 +01:00
Vadym Samoilenko
096885c87f Fix LlamaIndex model patch: also patch base.py direct reference
base.py imports anthropic_modelname_to_contextsize directly, so patching
utils module attribute alone doesn't affect calls inside base.py.
Now patches both utils and base modules for Anthropic and Gemini.

Also: show docker build output in deploy.sh (was suppressed, hid errors).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 14:42:47 +01:00
Vadym Samoilenko
75e674eb6d Bump dependencies to latest, clean up deploy.sh output
- anthropic 0.71→0.97, llama-index-llms-anthropic 0.9→0.11, llama-index-llms-google-genai 0.8→0.9
- fastapi 0.119→0.136, uvicorn 0.37→0.46, elevenlabs 2.18→2.44, google-genai 1.67→1.73
- Add LlamaIndex model validator monkey-patch (claude-sonnet-4-6 + gemini models)
- deploy.sh: status-only output (suppress docker/git noise)
- Archive legacy one-shot deploy scripts to Old Readmes/migration-2026-03/

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 14:38:42 +01:00
Vadym Samoilenko
6d0af9f48e Fix Claude model ID and deploy.sh sudo SSH issue
- llm_factory.py: claude-sonnet-4-6 → claude-sonnet-4-5 (4.6 doesn't
  exist in llama-index-llms-anthropic; 4.5/20250929 is the latest known)
- deploy.sh + rollback.sh: git commands now run as $SUDO_USER when
  called via sudo, so Bitbucket SSH key is found (root has no SSH key)
- frontend: update Claude label to match

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 14:32:20 +01:00
Vadym Samoilenko
922ea3c377 Fix model IDs, hangs, deploy script, Docker healthchecks
MODELS (Block B):
- llm_factory.py: replace hardcoded model strings with env vars
  OPENAI_CHAT_MODEL (gpt-5.4-2026-03-05), ANTHROPIC_CHAT_MODEL (claude-sonnet-4-6),
  GEMINI_CHAT_MODEL (gemini-3.1-pro-preview), GEMINI_FLASH_MODEL (gemini-3-flash-preview)
- Fix broken IDs from fc17994: gemini-3-1-pro-preview → gemini-3.1-pro-preview,
  gemini-3-1-flash-live-preview → gemini-3-flash-preview, gpt-5.4 → gpt-5.4-2026-03-05
- Replace gpt-4.1 hardcodes in audio.py + utils.py with OPENAI_LEGACY_MODEL
- Replace hardcoded claude-sonnet-4-6 in studio_generators.py PPTX-from-template
- Replace hardcoded gemini model in gemini_video.py

HANGS (Block C):
- llm_factory.py: add timeout=LLM_TIMEOUT_SECONDS to Gemini branches (was missing)
- pipeline_manager.py: wrap aquery in asyncio.wait_for(timeout=LLAMA_QUERY_TIMEOUT=120s)
- chat.py: wrap query_notebook_pipeline in asyncio.wait_for(CHAT_QUERY_TIMEOUT=130s),
  send {"type":"error"} to client on timeout instead of hanging WS
- background_tasks.py: on startup mark IN_PROGRESS tasks as FAILED ("orphaned on restart")
- api.ts: add axios timeout 60s (was 0 = infinite)
- queryClient.ts: retry:1 + exponential retryDelay (was retry:3)
- notebooks/[id]/page.tsx: podcast poll only while status=processing (was always 5s)
- docker-compose.yml: healthchecks for all services + depends_on service_healthy conditions
- backend/Dockerfile: add --proxy-headers --timeout-keep-alive 65 --ws-ping-interval/timeout

DEPLOY (Block D):
- scripts/deploy.sh: idempotent rolling redeploy (git pull → build → migrate → up → health)
- scripts/rollback.sh: revert to any git SHA
- scripts/README.md: usage table
- .dockerignore: root-level (was missing)
- Retire legacy one-shot scripts → Old Readmes/

DOCS (Block E): Update CLAUDE.md models table + deploy section with new env vars

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 14:25:30 +01:00
Vadym Samoilenko
23494552e7 Fix health check URL: /health -> /api/health
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 21:50:32 +00:00
Vadym Samoilenko
15840767b2 Fix 2_deploy.sh: git stash before pull, fix PostgreSQL ROW_COUNT
- Add git stash before git pull to handle locally created directories
- Replace invalid ROW_COUNT() with grep on psql command tag output

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 21:44:35 +00:00
Vadym Samoilenko
4608ca3c5e Add Docker migration: Dockerfiles, compose config, and deployment scripts
- backend/Dockerfile: Python 3.13-slim with uv, ffmpeg, psycopg2
- frontend/Dockerfile: multi-stage Node 22 build with standalone output
- docker-compose.yml: add backend/frontend services with named volumes
- backend/.dockerignore, frontend/.dockerignore: exclude build artifacts
- audio.py: write podcasts to PODCAST_DATA_DIR env var (default: conversations/)
- background_tasks.py: handle .md files directly without LlamaParse
- pyproject.toml: add python-pptx, weasyprint, matplotlib deps
- page.tsx: add Markdown to supported file types hint
- scripts/1_backup.sh: pg_dump + tar files + Docker volume backup
- scripts/2_deploy.sh: full systemd→Docker migration with health checks
- scripts/3_cleanup.sh: post-migration cleanup of build artifacts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 21:34:59 +00:00