Coolify auto-injects ARG NODE_ENV into all Dockerfile stages and passes
NODE_ENV=production as a build arg. This causes npm ci to skip devDependencies
(including typescript), making tsc not found (exit 127) at npm run build.
Fix: prefix the npm ci call with NODE_ENV=development to override the injected
env var only for the install step, ensuring TypeScript and other build tools
are always installed.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Coolify's build environment has no npm cache populated, so --prefer-offline
causes npm ci to fail to install devDependencies (incl. typescript).
Removing the flag ensures npm always fetches from registry during builds.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Five critical fixes discovered and patched on production (192.168.9.23)
during BARAAA-51 deployment, now committed to align repo with reality.
1. tsconfig.build.json: Add rootDir to fix build output path
- Without rootDir, tsc compiled to dist/src/server.js
- Dockerfile CMD expected dist/server.js
- Now builds correctly to dist/server.js
2. Dockerfile: Correct CMD path back to dist/server.js
- Reverts workaround commit 6d0515d
- Now matches actual build output with rootDir fix
3. src/routes/sessions.ts: Fix API token prefix parsing
- Old: split('_') failed because base64url can contain '_'
- New: Extract prefix by fixed position (first 12 chars)
- Prevents ~64% authentication failures
4. src/routes/rooms.ts: Add /api/v1 prefix to all routes
- All 7 room endpoints now properly namespaced
- Aligns with API versioning convention
5. .env.lan: Add POSTGRES_HOST and POSTGRES_PORT
- Required for DB connection in Docker Compose
- Without this, app tried localhost instead of postgres service
6. test/j5-messaging-validation.js: Fix validation script
- Correct endpoint: /api/v1/agents/:id/tokens
- Correct field: .secret (not .token)
- Alexia role: admin (needed for room creation)
All fixes verified with clean build and dist/server.js output check.
Related: BARAAA-63, BARAAA-51
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Ajoute 9 tests d'intégration pour valider l'endpoint /metrics:
- Vérification du format Prometheus (text/plain)
- Présence de toutes les métriques AgentHub custom
- Présence des métriques Node.js par défaut
- Incrémentation correcte des compteurs HTTP
Tous les tests passent ✅
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Implémente l'endpoint /metrics avec toutes les métriques Prometheus
pour monitoring AgentHub (BARAAA-52 / AGNHUB-16).
Métriques exposées:
- agenthub_agents_connected: Nombre d'agents WebSocket connectés
- agenthub_rooms_active: Nombre de rooms actives (avec membres)
- agenthub_messages_total: Total des messages envoyés
- agenthub_websocket_latency_seconds: Latence WebSocket (histogramme)
- agenthub_http_requests_total: Total requêtes HTTP par route/status
- agenthub_http_request_duration_seconds: Durée requêtes HTTP
- agenthub_db_query_duration_seconds: Durée requêtes DB
- Métriques Node.js par défaut (CPU, mémoire, event loop, etc.)
Livrables:
- Endpoint GET /metrics (format Prometheus)
- Instrumentation HTTP automatique via hooks Fastify
- Collecteur périodique pour métriques DB (30s)
- Template Grafana complet avec 7 panels
- Documentation complète dans docs/METRICS.md
Testé en local - toutes les métriques fonctionnelles.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
dotenv is imported in server.ts and required at runtime,
so it must be in dependencies, not devDependencies.
Fixes ERR_MODULE_NOT_FOUND in Docker container.
Related to BARAAA-50.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
TypeScript builds to dist/src/server.js, not dist/server.js
because tsconfig preserves source directory structure.
Fixes MODULE_NOT_FOUND error on container startup.
Related to BARAAA-50.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Simplest deployment option - single command execution.
Usage: ./scripts/deploy-oneliner.sh
Deploys J5 code to 192.168.9.23 via SSH.
Related to BARAAA-50.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Quick reference guides for immediate J5 deployment:
- DEPLOY-NOW.md: Express deployment steps
- DEPLOY-NOW-SUMMARY.md: Status summary for CEO question
Related to BARAAA-50.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Comprehensive summary of J5 development work:
- All deliverables completed
- Deployment blockers documented
- Next steps clearly defined
- Rollback procedures included
Closes development phase of BARAAA-50.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Documents deployment procedure for the new WebSocket handlers:
- Deployment steps for 192.168.9.23
- Validation procedure with E2E test script
- Rollback instructions
Related to BARAAA-50.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Implements missing WebSocket event handlers for J5 messaging:
- room:list: List all rooms for the authenticated agent
- message:history: Retrieve paginated message history for a room
Also adds:
- Unit tests for both handlers in socket.test.ts
- E2E validation script test/j5-messaging-validation.js
Completes BARAAA-50 deliverables for real-time messaging.
Co-Authored-By: Paperclip <noreply@paperclip.ing>