chore: muta portul implicit 8000 -> 8010 (evita coliziunea cu roa2web)

start.sh, docker-compose.yml, README.md, CLAUDE.md aliniate la 8010
pentru a nu se suprapune cu backend-ul roa2web pe masina de test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-06-19 09:11:37 +00:00
parent d7ba1195d4
commit c8a19e2f06
4 changed files with 29 additions and 29 deletions

View File

@@ -19,7 +19,7 @@ Limba proiectului este **romana**: cod, comentarii, commit-uri, documentatie. Fa
pip3 install -r requirements.txt # Python 3.12+
# Rulare locala (dev): API + worker sunt PROCESE SEPARATE
uvicorn app.main:app --reload --port 8000 # API: dashboard /, Swagger /docs, /healthz, /metrics
uvicorn app.main:app --reload --port 8010 # API: dashboard /, Swagger /docs, /healthz, /metrics
python3 -m app.worker # worker (necesar doar pentru a procesa coada)
# Wrapper-ul start.sh ambaleaza mediu (test/prod) + rol (api/worker/both/finalizate)

View File

@@ -53,9 +53,9 @@ credentialele de test (fisierul **nu** se comite).
### 1. Porneste API-ul
```bash
uvicorn app.main:app --reload --port 8000
uvicorn app.main:app --reload --port 8010
# sau, daca uvicorn nu e pe PATH:
python3 -m uvicorn app.main:app --reload --port 8000
python3 -m uvicorn app.main:app --reload --port 8010
```
La prima pornire se creeaza schema SQLite si se face seed la nomenclatorul RAR (18 coduri
@@ -75,10 +75,10 @@ python3 -m app.worker
`start.sh` ambaleaza pornirea pe mediu (`test` / `prod`) si rol (`api` / `worker` / `both`):
```bash
./start.sh test api # API pe :8000, mediu test
./start.sh test api # API pe :8010, mediu test
./start.sh test worker --send # worker care TRIMITE la RAR test
./start.sh test both --send # API + worker impreuna (dev end-to-end, loguri in .run/)
./start.sh prod api --port 8000 # API mediu prod
./start.sh prod api --port 8010 # API mediu prod
./start.sh prod worker --send # worker prod (NU foloseste creds de test)
./start.sh status # stare procese + /healthz
./start.sh stop # opreste procesele pornite cu "both"
@@ -110,10 +110,10 @@ Cu API-ul pornit, deschide in browser:
| URL | Ce vezi |
|-----|---------|
| `http://localhost:8000/` | **Dashboard** — stare coada, banner prezentari blocate, stare worker / ultim login RAR, editor mapari operatii, browser nomenclator, sectiune **import fisier** |
| `http://localhost:8000/docs` | **Swagger UI** — API v1 interactiv (incearca endpointurile direct din browser) |
| `http://localhost:8000/healthz` | JSON sanatate: worker viu, ultim login RAR, adancime coada |
| `http://localhost:8000/metrics` | metrici text (submissions pe status) |
| `http://localhost:8010/` | **Dashboard** — stare coada, banner prezentari blocate, stare worker / ultim login RAR, editor mapari operatii, browser nomenclator, sectiune **import fisier** |
| `http://localhost:8010/docs` | **Swagger UI** — API v1 interactiv (incearca endpointurile direct din browser) |
| `http://localhost:8010/healthz` | JSON sanatate: worker viu, ultim login RAR, adancime coada |
| `http://localhost:8010/metrics` | metrici text (submissions pe status) |
### Fluxul de import fisier (xlsx / csv) din browser
@@ -179,9 +179,9 @@ end-to-end pe contul de test RAR:
4. **Vizualizeaza prezentarile trimise** — trei feluri:
- **Dashboard** (`http://localhost:8000/`) — tabelul de jos arata fiecare submission cu
- **Dashboard** (`http://localhost:8010/`) — tabelul de jos arata fiecare submission cu
status (`sent`/`error`/...), `id_prezentare`, cod RAR si eroare. Se actualizeaza singur.
- **API**: `curl -s http://localhost:8000/v1/prezentari` — coada locala cu statusuri.
- **API**: `curl -s http://localhost:8010/v1/prezentari` — coada locala cu statusuri.
- **Direct de la RAR** (confirmare independenta ca au ajuns):
```bash
@@ -285,7 +285,7 @@ Ca worker-ul sa poata trimite pentru un service fara ca fiecare cerere sa-i poar
RAR, seteaza credentialele RAR durabile pe cont (criptate Fernet at-rest):
```bash
curl -s -X POST http://localhost:8000/v1/conturi/rar-creds \
curl -s -X POST http://localhost:8010/v1/conturi/rar-creds \
-H 'X-API-Key: rfak_...' -H 'Content-Type: application/json' \
-d '{"email": "service@exemplu.ro", "password": "parola-rar"}'
```
@@ -298,16 +298,16 @@ obligatorie.
```bash
# Sanatate (neprotejat)
curl -s http://localhost:8000/healthz | python3 -m json.tool
curl -s http://localhost:8010/healthz | python3 -m json.tool
# Nomenclator RAR (cache local)
curl -s http://localhost:8000/v1/nomenclator
curl -s http://localhost:8010/v1/nomenclator
# Coada de prezentari (monitorizare; momentan globala + neprotejata, vezi nota de mai sus)
curl -s http://localhost:8000/v1/prezentari
curl -s http://localhost:8010/v1/prezentari
# Trimite o prezentare -- dev (fara cheie API -> cont id=1)
curl -s -X POST http://localhost:8000/v1/prezentari \
curl -s -X POST http://localhost:8010/v1/prezentari \
-H 'Content-Type: application/json' \
-d '{
"rar_credentials": {"email": "test@example.ro", "password": "secret"},
@@ -321,7 +321,7 @@ curl -s -X POST http://localhost:8000/v1/prezentari \
}'
# Trimite o prezentare -- service cu cheie API (account_id curge din cheie)
curl -s -X POST http://localhost:8000/v1/prezentari \
curl -s -X POST http://localhost:8010/v1/prezentari \
-H 'X-API-Key: rfak_...' -H 'Content-Type: application/json' \
-d '{
"rar_credentials": {"email": "service@exemplu.ro", "password": "parola-rar"},
@@ -335,7 +335,7 @@ curl -s -X POST http://localhost:8000/v1/prezentari \
}'
# Import fisier prin API pentru un service (multi-tenant: contul vine din cheie)
curl -s -X POST http://localhost:8000/v1/import \
curl -s -X POST http://localhost:8010/v1/import \
-H 'X-API-Key: rfak_...' -F 'file=@sample_import.xlsx'
```
@@ -344,16 +344,16 @@ pune cheia prin butonul "Authorize" sau adauga header-ul `X-API-Key`.
```bash
# Sanatate
curl -s http://localhost:8000/healthz | python3 -m json.tool
curl -s http://localhost:8010/healthz | python3 -m json.tool
# Nomenclator RAR (cache local)
curl -s http://localhost:8000/v1/nomenclator
curl -s http://localhost:8010/v1/nomenclator
# Coada de prezentari
curl -s http://localhost:8000/v1/prezentari
curl -s http://localhost:8010/v1/prezentari
# Trimite o prezentare (dev: fara cheie API -> cont id=1)
curl -s -X POST http://localhost:8000/v1/prezentari \
curl -s -X POST http://localhost:8010/v1/prezentari \
-H 'Content-Type: application/json' \
-d '{
"rar_credentials": {"email": "test@example.ro", "password": "secret"},
@@ -389,7 +389,7 @@ cp .env.example .env
docker compose up --build
```
`docker-compose.yml` porneste trei containere: `api` (port 8000), `worker` si `autoheal`
`docker-compose.yml` porneste trei containere: `api` (port 8010), `worker` si `autoheal`
(restarteaza worker-ul cand heartbeat-ul devine invechit). Ambele servicii folosesc acelasi
image si acelasi volum SQLite persistent.

View File

@@ -8,9 +8,9 @@
services:
api:
build: .
command: uvicorn app.main:app --host 0.0.0.0 --port 8000
command: uvicorn app.main:app --host 0.0.0.0 --port 8010
ports:
- "8000:8000"
- "8010:8010"
volumes:
- autopass-data:/data
environment:
@@ -20,7 +20,7 @@ services:
AUTOPASS_REQUIRE_API_KEY: ${AUTOPASS_REQUIRE_API_KEY:-false}
restart: always
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://localhost:8000/healthz').status==200 else 1)"]
test: ["CMD", "python", "-c", "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://localhost:8010/healthz').status==200 else 1)"]
interval: 30s
timeout: 5s
retries: 3

View File

@@ -2,10 +2,10 @@
# start.sh — pornire gateway RAR AUTOPASS (api / worker) pe mediu test sau prod.
#
# Exemple:
# ./start.sh test api # API pe :8000, mediu test
# ./start.sh test api # API pe :8010, mediu test
# ./start.sh test worker --send # worker care TRIMITE la RAR test (creds <test> din settings.xml)
# ./start.sh test both --send # API + worker impreuna (dev end-to-end)
# ./start.sh prod api --port 8000 # API mediu prod
# ./start.sh prod api --port 8010 # API mediu prod
# ./start.sh prod worker --send # worker prod (NU foloseste creds de test)
# ./start.sh status # stare procese + /healthz
# ./start.sh stop # opreste procesele pornite cu "both"
@@ -18,7 +18,7 @@ set -euo pipefail
cd "$(dirname "$0")"
# --- valori implicite ---
PORT=8000
PORT=8010
HOST=0.0.0.0
RELOAD=0
SEND=0