bae705aa97
- Add NFC ePassport roadmap (ICAO 9303, eIDAS) - Add TensorFlow.js edge face detection (BlazeFace) - Add structured audit logger (GDPR-compliant) - Risk scoring support Part of KYC Apple Native UX v1.1.0
107 lines
4.3 KiB
Markdown
107 lines
4.3 KiB
Markdown
# Ouroboros Services Fix — 2026-06-03
|
||
|
||
**Utfört:** 2026-06-03 07:35–07:40 UTC
|
||
**Agent:** subagent (coding)
|
||
**Status:** ✅ KOMPLETT — 6/6 services uppe
|
||
|
||
---
|
||
|
||
## Resultat: Health Check
|
||
|
||
| Port | Service | Status | Upstream |
|
||
|------|-----------------------|--------|--------------------|
|
||
| 3105 | ouroboros-multiorg | ✅ UP | PostgreSQL (RDS) |
|
||
| 4002 | ouroboros-finance-proxy | ✅ UP | → localhost:3202 |
|
||
| 4003 | ouroboros-people-proxy | ✅ UP | → localhost:3005 |
|
||
| 4004 | ouroboros-commerce-proxy| ✅ UP | → localhost:3007 |
|
||
| 4005 | ouroboros-time | ✅ UP | PostgreSQL (RDS) |
|
||
| 4011 | ouroboros-identity-proxy| ✅ UP | → localhost:3100 |
|
||
|
||
---
|
||
|
||
## Vad som byggdes
|
||
|
||
### DEL 1 — ouroboros-multiorg (port 3105)
|
||
- Fil: `/home/bernt/services/ouroboros-multiorg/index.mjs`
|
||
- Full REST CRUD för organisations-management
|
||
- Endpoints:
|
||
- `POST /api/v1/organizations`
|
||
- `GET /api/v1/organizations`
|
||
- `GET /api/v1/organizations/:id`
|
||
- `PATCH /api/v1/organizations/:id`
|
||
- `DELETE /api/v1/organizations/:id` (soft delete → status='deleted')
|
||
- `GET /api/v1/organizations/:id/users`
|
||
- `POST /api/v1/organizations/:id/users`
|
||
- `GET /api/v1/organizations/:id/modules`
|
||
- `POST /api/v1/organizations/:id/modules`
|
||
- `GET /health`
|
||
- JWT-auth (HS256 med JWT_SECRET, fallback RS256 via /opt/amos/data/keys/jwt-public.pem)
|
||
- Skapar tabeller automatiskt: `ouroboros_organizations`, `ouroboros_users`, `ouroboros_org_modules`, `ouroboros_invitations`
|
||
- DB: PostgreSQL RDS (eu-north-1)
|
||
|
||
### DEL 2 — ouroboros-identity-proxy (port 4011)
|
||
- Fil: `/home/bernt/services/ouroboros-identity-proxy/index.mjs`
|
||
- Tunnskalig proxy:
|
||
- `POST /auth/login` → `localhost:3100/api/auth/login`
|
||
- `POST /auth/refresh` → `localhost:3100/api/auth/refresh`
|
||
- `POST /auth/logout` → `localhost:3100/api/auth/logout`
|
||
- `GET /auth/me` → `localhost:3100/api/auth/me`
|
||
|
||
### DEL 3 — ouroboros-finance-proxy (port 4002)
|
||
- Fil: `/home/bernt/services/ouroboros-finance-proxy/index.mjs`
|
||
- Proxy alla requests → `localhost:3202`
|
||
|
||
### DEL 4 — ouroboros-people-proxy (4003) + ouroboros-commerce-proxy (4004)
|
||
- People: `/home/bernt/services/ouroboros-people-proxy/index.mjs` → `localhost:3005`
|
||
- Commerce: `/home/bernt/services/ouroboros-commerce-proxy/index.mjs` → `localhost:3007`
|
||
|
||
### DEL 5 — ouroboros-time (port 4005)
|
||
- Ingen befintlig time-service hittades i /opt/amos/services/
|
||
- Skapade: `/home/bernt/services/ouroboros-time/index.mjs`
|
||
- Endpoints:
|
||
- `GET /api/time/entries?org_id=...&user_id=...`
|
||
- `POST /api/time/entries`
|
||
- `PATCH /api/time/entries/:id` (stoppa timer)
|
||
- Skapar `time_entries` tabell automatiskt (med generated column `duration_s`)
|
||
|
||
---
|
||
|
||
## Anmärkningar
|
||
|
||
### Varför ~/services och inte /opt/amos/services?
|
||
`/opt/amos/services/` är root-ägt (755, `bernt` saknar skrivrättighet). Inte möjligt att skriva utan sudo (kräver TTY). Services skapades i `/home/bernt/services/` istället — PM2 bryr sig inte om sökväg, bara att filen finns och är läsbar.
|
||
|
||
### Express 5.x wildcard-bug
|
||
`app.all('*', handler)` fungerar inte med Express 5 + ny path-to-regexp. Fixat till `app.use('/', handler)` för proxy-services.
|
||
|
||
### PM2 env-vars
|
||
`DATABASE_URL` och `JWT_SECRET` sätts via process.env eller hardcoded fallback i respektive service. För produktion, lägg till `--env` block i pm2 ecosystem config.
|
||
|
||
---
|
||
|
||
## PM2 Status (slutresultat)
|
||
|
||
```
|
||
id 2 ouroboros-multiorg online 73mb
|
||
id 3 ouroboros-identity-proxy online 66mb
|
||
id 4 ouroboros-finance-proxy online 66mb
|
||
id 5 ouroboros-people-proxy online 67mb
|
||
id 6 ouroboros-commerce-proxy online 67mb
|
||
id 7 ouroboros-time online 72mb
|
||
```
|
||
|
||
`pm2 save` kördes — services överlever restart.
|
||
|
||
---
|
||
|
||
## Servicefiler
|
||
|
||
| Service | Fil |
|
||
|---------|-----|
|
||
| ouroboros-multiorg | `/home/bernt/services/ouroboros-multiorg/index.mjs` |
|
||
| ouroboros-identity-proxy | `/home/bernt/services/ouroboros-identity-proxy/index.mjs` |
|
||
| ouroboros-finance-proxy | `/home/bernt/services/ouroboros-finance-proxy/index.mjs` |
|
||
| ouroboros-people-proxy | `/home/bernt/services/ouroboros-people-proxy/index.mjs` |
|
||
| ouroboros-commerce-proxy | `/home/bernt/services/ouroboros-commerce-proxy/index.mjs` |
|
||
| ouroboros-time | `/home/bernt/services/ouroboros-time/index.mjs` |
|