diff --git a/10-systems/hosts/gntasks.md b/10-systems/hosts/gntasks.md index d3ab8b1..5db9b79 100644 --- a/10-systems/hosts/gntasks.md +++ b/10-systems/hosts/gntasks.md @@ -45,17 +45,20 @@ - **Embeddings:** EMBEDDING_OLLAMA_HOST=http://192.168.1.168:11434 — embed.ok=true in /health (better than other instances, which show embed.ok=false) - **Webclient/auth:** NAVI_WEBCLIENT_ENABLED=false, NAVI_AUTH_ENABLED=false (default deploy shape) -## gntodo / GNexus Tasks (deployed 2026-09-21) +## gntodo / GNexus Tasks (deployed 2026-09-21, updated 2026-09-21 to ac8aefb) -- **Repo:** /srv/gntodo (https://git.gnexus.space/git/root/gnexus-tasks.git) +- **Repo:** /srv/gntodo (https://git.gnexus.space/git/root/gnexus-tasks.git), HEAD ac8aefb - **Stack:** docker compose — `db` (postgres:17-alpine, healthy), `api` (FastAPI, healthy, migrations run at container start), `web` (nginx, SPA + proxy /api/, /auth/, /mcp/ → api) - **Public URL:** https://tasks.gnexus.space (TLS terminates on internal-proxy-vps .226, separate LE cert valid until 2026-12-20; upstream http://192.168.1.179:8135) - **WEB_PORT:** 8135 (container web 0.0.0.0:8135→80) -- **Config:** /srv/gntodo/.env — GAUTH_BASE_URL=https://auth.gnexus.space, GAUTH_REDIRECT_URI=https://tasks.gnexus.space/auth/callback, OLLAMA_BASE_URL=http://192.168.1.130:11434, OLLAMA_MODEL=qwen3.5:2b-q4_K_M (model confirmed present on .130), random SESSION_SECRET/MCP_TOKEN/POSTGRES_PASSWORD -- **SSO (configured 2026-09-21):** GAUTH_CLIENT_ID=gnx_8z9SjVg1pFrDWUjXka36mW9cdeu68jLa, GAUTH_CLIENT_SECRET set (owner-provided), api container recreated via `docker compose up -d` (env interpolation — plain restart does not pick up .env changes). Credentials: gnexus-creds secret "gntodo SSO client + MCP token (tasks.gnexus.space)" (id ca8836f7-79b9-474e-8703-f564d69b7e6f). /auth/login → OAuth authorize on auth.gnexus.space verified (sign-in page renders, client accepted); final browser login pending owner test -- **MCP:** https://tasks.gnexus.space/mcp/ (streamable HTTP, JSON-RPC over SSE), Bearer MCP_TOKEN from .env; server "gntodo" v1.30.0, tools: list_projects/get_project/create_task/update_task/list_tasks/get_task/complete_task/list_tags. No multi-tenancy: agents act on behalf of the single user (owner plans to add user_id multi-tenancy himself later) -- **Deploy notes:** built by ayame via peer task (docker compose up -d --build; build takes several minutes on 2 vCPU — first attempt hit a 20s command timeout, second run completed); docker requires sudo (ubuntu user not in docker group) -- **Verified 2026-09-21 (external):** https://tasks.gnexus.space/ → 200 text/html (SPA), /api/health → {"status":"ok"}, /auth/login → 200 GNexus Auth sign-in page, /mcp/ → 401 without token / 200 + mcp-session-id with Bearer token +- **Config:** /srv/gntodo/.env — GAUTH_BASE_URL=https://auth.gnexus.space, GAUTH_REDIRECT_URI=https://tasks.gnexus.space/auth/callback, OLLAMA_BASE_URL=http://192.168.1.130:11434, OLLAMA_MODEL=qwen3.5:2b-q4_K_M (model confirmed present on .130), random SESSION_SECRET/POSTGRES_PASSWORD, MCP_TOKEN empty (deprecated by per-user tokens) +- **SSO (configured 2026-09-21):** GAUTH_CLIENT_ID=gnx_8z9SjVg1pFrDWUjXka36mW9cdeu68jLa, GAUTH_CLIENT_SECRET set (owner-provided), api container recreated via `docker compose up -d` (env interpolation — plain restart does not pick up .env changes). Credentials: gnexus-creds secret "gntodo SSO client + webhook secret (tasks.gnexus.space)" (id ca8836f7-79b9-474e-8703-f564d69b7e6f). /auth/login → OAuth authorize on auth.gnexus.space verified (sign-in page renders, client accepted); final browser login pending owner test +- **Webhook from SSO (configured 2026-09-21, ТЗ 3.16):** GAUTH_WEBHOOK_SECRET set in .env (whsec_... from auth panel, owner-provided); endpoint POST https://tasks.gnexus.space/auth/webhook; HMAC-SHA256 signature X-Gnexus-Signature: t=,v1=; events user.email_changed / user.profile_updated / user.blocked / user.archived / user.deleted; empty secret → 503 disabled. Verified: unsigned POST → 400 "Invalid webhook" (locally and through proxy) +- **MCP (per-user tokens since ac8aefb, ТЗ 3.10):** https://tasks.gnexus.space/mcp/ (streamable HTTP, JSON-RPC over SSE). Tokens are generated per user in Settings → Токены MCP (plaintext shown once, sha256 hash in DB); agent acts on behalf of the token owner and sees only their data. The old shared MCP_TOKEN from .env is no longer used (empty in .env; old value preserved in pre-update backup). Verified: POST /mcp/ without token → 401 +- **Multi-tenancy (since ac8aefb, ТЗ 0.34):** users table, user_id on tasks/projects/tags/attachments/xp/garden, per-user settings, claim on first login; alembic migration f9a0b1c2d3e4 applied 2026-09-21 (e7f8a9b0c1d2 → f9a0b1c2d3e4). Supersedes the earlier "no user_id" architecture note +- **Update 2026-09-21 (400e69a → ac8aefb):** multitenancy (ТЗ 0.34), webhooks from gnexus-auth (ТЗ 3.16), mobile UI fixes, GAUTH_WEBHOOK_SECRET in compose. Procedure: backup → git pull --ff-only → .env edit → docker compose up -d --build. Pre-update backup: /srv/gntodo-backups/gntodo-pre-multitenant-20260921-231508.sql.gz + env-pre-multitenant-20260921-231508.bak (contains the old MCP_TOKEN f4993e...) +- **Deploy notes:** built by ayame via peer task (docker compose up -d --build; build takes several minutes on 2 vCPU — run in background with nohup, first attempt hit a 20s command timeout); docker requires sudo (ubuntu user not in docker group); /srv/gntodo owned by root — git operations need sudo +- **Verified 2026-09-21 after update (external):** https://tasks.gnexus.space/ → 200 text/html (fresh SPA build), /api/health → {"status":"ok"}, /auth/webhook unsigned → 400 Invalid webhook, /mcp/ without token → 401 ## Deploy notes (navi ayame) @@ -75,5 +78,5 @@ ## Notes - Known non-critical warnings (same as other swarm instances): MCP server 'navi_ui' connect failed (anyio CancelledError), tool_loader.file_error for gmail.py (ModuleNotFoundError: html2text) -- gntodo update procedure: `cd /srv/gntodo && git pull --ff-only && docker compose up -d --build` (migrations run automatically at api start); backups: `docker compose exec db pg_dump -U gntodo gntodo` + named volume gntodo_attachments (see repo docs/deploy.md) -- Architecture note (owner intent): service was written by an external agent without user_id in the schema (single shared dataset, SSO as gate only, MCP acts on behalf of the single user); owner plans to rework multi-tenancy himself later +- gntodo update procedure: backup (pg_dump + .env copy to /srv/gntodo-backups/) → `cd /srv/gntodo && git pull --ff-only && docker compose up -d --build` (migrations run automatically at api start; build in background via nohup on this 2-vCPU host) +- MCP token for agents: owner generates in Settings → Токены MCP and distributes; no shared token anymore diff --git a/90-maintenance/pending-changes/20260921231950-9f84fb3f.json b/90-maintenance/pending-changes/20260921231950-9f84fb3f.json new file mode 100644 index 0000000..91287e3 --- /dev/null +++ b/90-maintenance/pending-changes/20260921231950-9f84fb3f.json @@ -0,0 +1,19 @@ +{ + "id": "20260921231950-9f84fb3f", + "kind": "doc", + "target": "10-systems/hosts/gntasks.md", + "summary": "gntodo обновлён до ac8aefb: мультитенантность, вебхуки SSO, per-user MCP-токены; GAUTH_WEBHOOK_SECRET настроен, бэкап снят", + "reason": "Обновление gntodo до ac8aefb (мультитенантность ТЗ 0.34, вебхуки ТЗ 3.16, per-user MCP-токены) выполнено и верифицировано 2026-09-21; GAUTH_WEBHOOK_SECRET настроен; бэкап перед миграцией в /srv/gntodo-backups/.", + "payload": { + "content": "---\ntitle: \"VPS gntasks (navi instance ayame)\"\ntype: host\nip: 192.168.1.179\npurpose: \"Navi agent instance (ayame, profile navi_code) + gntodo (GNexus Tasks) web service in home LAN\"\nowner: gmikcon\nstatus: active\nconfidence: 100\nlast_reviewed: 2026-09-21\nreview_interval: 90d\nsource_of_truth: ssh-host-and-owner-confirmed\n---\n\n# VPS gntasks (navi instance ayame + gntodo)\n\n## Overview\n\nHome LAN VPS (KVM/QEMU guest). Hosts the navi-1 agent instance **ayame**\n(profile `navi_code`), deployed 2026-09-21 by navi (rei) from the `deploy`\nbranch of https://git.gnexus.space/git/root/navi-1.git, and since 2026-09-21\nthe **gntodo** (GNexus Tasks) web service — deployed by ayame (peer task,\nverified by rei) from https://git.gnexus.space/git/root/gnexus-tasks.git.\n\n## Technical Details\n\n- **IP:** 192.168.1.179\n- **Hostname:** gntasks\n- **OS:** Ubuntu 22.04.5 LTS, kernel 5.15.0-191-generic\n- **Platform:** KVM guest, 2 vCPU, 3.8 GiB RAM, 31G root disk (22G free at deploy)\n- **User:** ubuntu (SSH + sudo, same password; root password identical)\n- **Credentials:** gnexus-creds secret \"VPS gntasks SSH (192.168.1.179)\" (id e4e28fe1-c9ac-4bb9-a462-0d57bce13692)\n- **Firewall:** ufw inactive (all LAN traffic allowed)\n\n## Navi instance ayame (deployed 2026-09-21)\n\n- **Instance name:** ayame\n- **Instance ID:** 1606fff0-5abc-468c-af57-6c3c316494ac\n- **Repo:** /home/ubuntu/navi-1 (branch `deploy`, commit e276b1e)\n- **Service:** navi.service (systemd, enabled, Restart=always, runs as root)\n- **Server port:** 8099 (0.0.0.0), health endpoint http://127.0.0.1:8099/health\n- **Postgres:** docker container navi-postgres (pgvector) on 127.0.0.1:5432\n- **Python:** standalone CPython 3.12.14 at /home/ubuntu/navi-1/.python/\n- **Swarm:** .swarm-key copied from hive host (rei, 192.168.1.168); HIVE_URL=http://192.168.1.168:8087; hive.announce_ok confirmed in journalctl; visible in peer list as `ayame — 192.168.1.179:8099 [online]`\n- **Ollama backend:** OLLAMA_HOST=https://ollama.com, model glm-5.3-flash:cloud (deploy-branch .env); OLLAMA_API_KEY appended from hive .env\n- **Embeddings:** EMBEDDING_OLLAMA_HOST=http://192.168.1.168:11434 — embed.ok=true in /health (better than other instances, which show embed.ok=false)\n- **Webclient/auth:** NAVI_WEBCLIENT_ENABLED=false, NAVI_AUTH_ENABLED=false (default deploy shape)\n\n## gntodo / GNexus Tasks (deployed 2026-09-21, updated 2026-09-21 to ac8aefb)\n\n- **Repo:** /srv/gntodo (https://git.gnexus.space/git/root/gnexus-tasks.git), HEAD ac8aefb\n- **Stack:** docker compose — `db` (postgres:17-alpine, healthy), `api` (FastAPI, healthy, migrations run at container start), `web` (nginx, SPA + proxy /api/, /auth/, /mcp/ → api)\n- **Public URL:** https://tasks.gnexus.space (TLS terminates on internal-proxy-vps .226, separate LE cert valid until 2026-12-20; upstream http://192.168.1.179:8135)\n- **WEB_PORT:** 8135 (container web 0.0.0.0:8135→80)\n- **Config:** /srv/gntodo/.env — GAUTH_BASE_URL=https://auth.gnexus.space, GAUTH_REDIRECT_URI=https://tasks.gnexus.space/auth/callback, OLLAMA_BASE_URL=http://192.168.1.130:11434, OLLAMA_MODEL=qwen3.5:2b-q4_K_M (model confirmed present on .130), random SESSION_SECRET/POSTGRES_PASSWORD, MCP_TOKEN empty (deprecated by per-user tokens)\n- **SSO (configured 2026-09-21):** GAUTH_CLIENT_ID=gnx_8z9SjVg1pFrDWUjXka36mW9cdeu68jLa, GAUTH_CLIENT_SECRET set (owner-provided), api container recreated via `docker compose up -d` (env interpolation — plain restart does not pick up .env changes). Credentials: gnexus-creds secret \"gntodo SSO client + webhook secret (tasks.gnexus.space)\" (id ca8836f7-79b9-474e-8703-f564d69b7e6f). /auth/login → OAuth authorize on auth.gnexus.space verified (sign-in page renders, client accepted); final browser login pending owner test\n- **Webhook from SSO (configured 2026-09-21, ТЗ 3.16):** GAUTH_WEBHOOK_SECRET set in .env (whsec_... from auth panel, owner-provided); endpoint POST https://tasks.gnexus.space/auth/webhook; HMAC-SHA256 signature X-Gnexus-Signature: t=,v1=; events user.email_changed / user.profile_updated / user.blocked / user.archived / user.deleted; empty secret → 503 disabled. Verified: unsigned POST → 400 \"Invalid webhook\" (locally and through proxy)\n- **MCP (per-user tokens since ac8aefb, ТЗ 3.10):** https://tasks.gnexus.space/mcp/ (streamable HTTP, JSON-RPC over SSE). Tokens are generated per user in Settings → Токены MCP (plaintext shown once, sha256 hash in DB); agent acts on behalf of the token owner and sees only their data. The old shared MCP_TOKEN from .env is no longer used (empty in .env; old value preserved in pre-update backup). Verified: POST /mcp/ without token → 401\n- **Multi-tenancy (since ac8aefb, ТЗ 0.34):** users table, user_id on tasks/projects/tags/attachments/xp/garden, per-user settings, claim on first login; alembic migration f9a0b1c2d3e4 applied 2026-09-21 (e7f8a9b0c1d2 → f9a0b1c2d3e4). Supersedes the earlier \"no user_id\" architecture note\n- **Update 2026-09-21 (400e69a → ac8aefb):** multitenancy (ТЗ 0.34), webhooks from gnexus-auth (ТЗ 3.16), mobile UI fixes, GAUTH_WEBHOOK_SECRET in compose. Procedure: backup → git pull --ff-only → .env edit → docker compose up -d --build. Pre-update backup: /srv/gntodo-backups/gntodo-pre-multitenant-20260921-231508.sql.gz + env-pre-multitenant-20260921-231508.bak (contains the old MCP_TOKEN f4993e...)\n- **Deploy notes:** built by ayame via peer task (docker compose up -d --build; build takes several minutes on 2 vCPU — run in background with nohup, first attempt hit a 20s command timeout); docker requires sudo (ubuntu user not in docker group); /srv/gntodo owned by root — git operations need sudo\n- **Verified 2026-09-21 after update (external):** https://tasks.gnexus.space/ → 200 text/html (fresh SPA build), /api/health → {\"status\":\"ok\"}, /auth/webhook unsigned → 400 Invalid webhook, /mcp/ without token → 401\n\n## Deploy notes (navi ayame)\n\n- Docker 29.1.3 was preinstalled; docker compose plugin v5.5.1 installed manually to /usr/local/lib/docker/cli-plugins/docker-compose before install.sh\n- install.sh ran via `echo | sudo -S bash deploy/install.sh` (idempotent)\n- install.sh generated .swarm-key as root (600) — chown to ubuntu before copying the real hive key over scp\n- OLLAMA_API_KEY / EMBEDDING_* appended to .env from the hive host's .env (secrets not documented here)\n- First boot crashed once with `relation \"sessions\" does not exist` (DB schema race during restart); subsequent boots clean\n\n## Listening ports (TCP, verified 2026-09-21)\n\n- 22 — sshd\n- 8135 — gntodo web container (docker, 0.0.0.0)\n- 8099 — navi-server (ayame)\n- 5432 — navi-postgres docker (localhost only)\n\n## Notes\n\n- Known non-critical warnings (same as other swarm instances): MCP server 'navi_ui' connect failed (anyio CancelledError), tool_loader.file_error for gmail.py (ModuleNotFoundError: html2text)\n- gntodo update procedure: backup (pg_dump + .env copy to /srv/gntodo-backups/) → `cd /srv/gntodo && git pull --ff-only && docker compose up -d --build` (migrations run automatically at api start; build in background via nohup on this 2-vCPU host)\n- MCP token for agents: owner generates in Settings → Токены MCP and distributes; no shared token anymore" + }, + "status": "applied", + "created_at": "2026-09-21T23:19:50Z", + "updated_at": "2026-09-21T23:19:51Z", + "applied_at": "2026-09-21T23:19:51Z", + "validation": { + "status": "ok", + "issue_count": 0, + "issues": [] + } +}