Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ GIT_COMMIT=local
# Service Ports
PORT_PDP=8082
PORT_CE=8081
PORT_PB=8083
PORT_OE=4000
PORT_AUDIT=3001

Expand Down
2 changes: 1 addition & 1 deletion cmd/pb/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ PDP_SERVICE_URL=http://localhost:8082
# ARGUS_API_KEY=test-audit-token

# Server Configuration
PORT=3000
PORT=8083
CORS_ALLOWED_ORIGINS=*

# Set to "true" only when you need to run migrations
Expand Down
4 changes: 2 additions & 2 deletions cmd/pb/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ RUN chown -R appuser:appuser /app
USER 10001

# Expose port
EXPOSE 3000
EXPOSE 8083

# Run the application
CMD ["./pb"]
CMD ["./pb"]
6 changes: 3 additions & 3 deletions cmd/pb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ go run ./cmd/pb
go build -o pb ./cmd/pb && ./pb
```

The service runs on port 3000 by default.
The service runs on port 8083 by default.

## Configuration

### Server Configuration

```bash
PORT=3000 # Server port (default: 3000)
PORT=8083 # Server port (default: 8083)
CORS_ALLOWED_ORIGINS=* # CORS allowed origins
```

Expand Down Expand Up @@ -195,7 +195,7 @@ Request → CORS → JWT Validation → Authorization → Resource Access
docker build -t portal-backend -f cmd/pb/Dockerfile .

# Run container
docker run -p 3000:3000 \
docker run -p 8083:8083 \
-e DB_HOST=host.docker.internal \
-e PDP_SERVICE_URL=http://host.docker.internal:8082 \
--env-file cmd/pb/.env \
Expand Down
6 changes: 3 additions & 3 deletions cmd/pb/docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ services:
dockerfile: cmd/pb/Dockerfile
environment:
- ENVIRONMENT=test
- PORT=3000
- PORT=8083
- DB_HOST=postgres-test
- DB_PORT=5432
- DB_USERNAME=test_user
- DB_PASSWORD=test_password
- DB_NAME=portal_backend_test
- DB_SSLMODE=disable
ports:
- "3001:3000"
- "3001:8083"
depends_on:
postgres-test:
condition: service_healthy
Expand All @@ -41,7 +41,7 @@ services:
"--no-verbose",
"--tries=1",
"--spider",
"http://localhost:3000/health",
"http://localhost:8083/health",
]
interval: 10s
timeout: 5s
Expand Down
2 changes: 1 addition & 1 deletion cmd/pb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func main() {
// Start server
port := os.Getenv("PORT")
if port == "" {
port = "3000"
port = "8083"
}

addr := ":" + port
Expand Down
2 changes: 1 addition & 1 deletion cmd/pb/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ servers:
description: Choreo Production Environment
- url: https://portal-backend-dev.choreo.dev
description: Choreo Development Environment
- url: http://localhost:3000
- url: http://localhost:8083
description: Local Development Environment

paths:
Expand Down
58 changes: 57 additions & 1 deletion compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ services:
- postgres-data:/var/lib/postgresql/data
- ./init-db.sql:/docker-entrypoint-initdb.d/init-db.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-exchange} ${DB_NAME:-postgres}"]
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-exchange} -d ${DB_NAME:-postgres}"]
interval: 5s
timeout: 5s
retries: 10
Expand Down Expand Up @@ -227,6 +227,62 @@ services:
networks:
- openndx-network

portal-backend:
build:
context: .
dockerfile: cmd/pb/Dockerfile
container_name: pb-${ENVIRONMENT:-local}
ports:
- "${PORT_PB:-8083}:8083"
environment:
- PORT=8083
- CORS_ALLOWED_ORIGINS=${CORS_ALLOWED_ORIGINS:-*}
# Database configuration
- DB_HOST=${DB_HOST:-postgres}
- DB_PORT=${DB_PORT:-5432}
- DB_USERNAME=${DB_USER:-exchange}
- DB_PASSWORD=${DB_PASSWORD:-exchange}
- DB_NAME=${DB_NAME_PB:-portal_backend}
- DB_SSLMODE=${DB_SSLMODE:-disable}
- RUN_MIGRATION=${RUN_MIGRATION:-true}
- PDP_SERVICE_URL=http://policy-decision-point:8082
# IDP configuration for validating incoming JWTs (ndx CLI, portal frontends).
# IDP_ISSUER must match ThunderID's externally-visible public_url (the `iss`
# claim it stamps into tokens) — NOT the container-network address below,
# which is only used to actually reach the JWKS endpoint from inside the
# compose network.
- IDP_ISSUER=${IDP_PUBLIC_URL:-https://localhost:8090}
- IDP_JWKS_URL=https://thunderid:8090/oauth2/jwks
- IDP_JWKS_INSECURE_SKIP_VERIFY=${IDP_JWKS_INSECURE_SKIP_VERIFY:-true}
- IDP_ADMIN_PORTAL_CLIENT_ID=${NDX_CLI_CLIENT_ID:-NDX_CLI}
# PB's own outbound calls to the IDP (creating application/user records —
# POST /applications, POST /members) go through idpfactory, which only
# implements the Asgardeo (WSO2) admin API today — see
# docs/DESIGN-esignet-citizen-authentication.md §3.1 and
# internal/pb/idp/idpfactory/factory.go. These vars only need to be
# non-empty for PB to boot; against ThunderID those specific endpoints
# (create application/member) will still fail, since ThunderID's admin
# API isn't Asgardeo-shaped. Everything else (list/get applications,
# the policy-update endpoint the ndx CLI uses) doesn't call the IDP at
# all and works fine.
- IDP_BASE_URL=https://thunderid:8090
- IDP_CLIENT_ID=${NDX_CLI_CLIENT_ID:-NDX_CLI}
- IDP_CLIENT_SECRET=${IDP_CLIENT_SECRET:-unused-thunderid-has-no-secret}
# Authorization
- AUTHORIZATION_MODE=${AUTHORIZATION_MODE:-fail_open_admin_system}
- AUTHORIZATION_STRICT_MODE=${AUTHORIZATION_STRICT_MODE:-false}
# Audit (optional, degrades gracefully if unreachable)
- AUDIT_SERVICE_URL=${AUDIT_SERVICE_URL:-http://audit-service:3001}
- ARGUS_API_KEY=${ARGUS_API_KEY:-test-audit-token}
depends_on:
postgres:
condition: service_healthy
thunderid:
condition: service_healthy
restart: unless-stopped
networks:
- openndx-network

audit-service:
build:
context: https://github.com/LSFLK/argus.git#v1.0.1
Expand Down
1 change: 1 addition & 0 deletions init-db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ SELECT 'CREATE DATABASE pdp' WHERE NOT EXISTS (SELECT FROM pg_database WHERE dat
SELECT 'CREATE DATABASE consent_engine' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'consent_engine')\gexec
SELECT 'CREATE DATABASE orchestration_engine' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'orchestration_engine')\gexec
SELECT 'CREATE DATABASE audit' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'audit')\gexec
SELECT 'CREATE DATABASE portal_backend' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'portal_backend')\gexec
Comment thread
coderabbitai[bot] marked this conversation as resolved.
10 changes: 5 additions & 5 deletions observability/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Collects real-time metrics from all Go services for debugging performance and er
│ ┌──────────────┐ ┌───────────────┐ ┌──────────────┐ │
│ │ Portal │ │ Orchestration │ │ Policy │ ... │
│ │ Backend │ │ Engine │ │ Decision │ │
│ │ :3000 │ │ :4000 │ │ Point :8082 │ │
│ │ :8083 │ │ :4000 │ │ Point :8082 │ │
│ └──────┬───────┘ └───────┬───────┘ └──────┬───────┘ │
│ │ │ │ │
│ └──────────────────┴─────────────────┘ │
Expand Down Expand Up @@ -94,7 +94,7 @@ Ensure all Go services are running and connected to the `openndx-network`:
- Orchestration Engine (port 4000)
- Consent Engine (port 8081)
- Policy Decision Point (port 8082)
- Portal Backend (port 3000)
- Portal Backend (port 8083)

---

Expand Down Expand Up @@ -279,13 +279,13 @@ To populate the Grafana dashboard with metrics, generate sample traffic:
./generate_sample_traffic.sh
```

This sends requests to various endpoints on `portal-backend` (default: `http://localhost:3000`).
This sends requests to various endpoints on `portal-backend` (default: `http://localhost:8083`).

### Configuration

```bash
# Change the base URL
PORTAL_BACKEND_URL=http://localhost:3000 ./generate_sample_traffic.sh
PORTAL_BACKEND_URL=http://localhost:8083 ./generate_sample_traffic.sh

# Change request interval (default: 2 seconds)
REQUEST_INTERVAL=5 ./generate_sample_traffic.sh
Expand Down Expand Up @@ -476,7 +476,7 @@ Services automatically initialize OpenTelemetry metrics when first used. No expl

1. Check that metrics are initialized:
- Look for log messages: "Initialized OpenTelemetry metrics with..."
- Check `/metrics` endpoint returns data: `curl http://localhost:3000/metrics`
- Check `/metrics` endpoint returns data: `curl http://localhost:8083/metrics`

2. For OTLP exporter:
- Verify `OTEL_EXPORTER_OTLP_ENDPOINT` is set correctly
Expand Down
4 changes: 2 additions & 2 deletions observability/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ scrape_configs:
metrics_path: /metrics
static_configs:
- targets:
- portal-backend:3000
- portal-backend:8083
labels:
service: 'portal-backend'
port: '3000'
port: '8083'

2 changes: 1 addition & 1 deletion portals/apps/admin/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ VITE_PORT=5173
VITE_BASE_PATH=/

# --- Runtime (window.configs - see entrypoint.sh / public/config.js) ---
VITE_API_URL=http://localhost:3000
VITE_API_URL=http://localhost:8083
VITE_LOGS_URL=http://localhost:3001
VITE_IDP_CLIENT_ID=your_client_id
VITE_IDP_BASE_URL=https://api.asgardeo.io/t/your-org
Expand Down
28 changes: 14 additions & 14 deletions portals/apps/admin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,18 @@ The Admin Portal has two independent configuration layers:
cp .env.example .env
```

| Variable | Type | Example / Default | Description |
|---|---|---|---|
| `VITE_PORT` | Build-time | `5173` | Local dev server port |
| `VITE_BASE_PATH` | Build-time | `/` | Public base path Vite serves the app under |
| `VITE_API_URL` | Runtime | `http://localhost:3000` | Portal Backend API base URL |
| `VITE_LOGS_URL` | Runtime | `http://localhost:3001` | Audit Service base URL (audit log viewer) |
| `VITE_IDP_CLIENT_ID` | Runtime | `your_client_id` | IdP (Asgardeo) application client ID |
| `VITE_IDP_BASE_URL` | Runtime | `https://api.asgardeo.io/t/your-org` | IdP (Asgardeo) base URL |
| `VITE_IDP_SCOPE` | Runtime | `openid,profile` | Comma-separated OAuth scopes |
| `VITE_IDP_ADMIN_ROLE` | Runtime | `admin` | Role required to access the Admin Portal |
| `VITE_SIGN_IN_REDIRECT_URL` | Runtime | `http://localhost:5173` | OIDC sign-in redirect URL |
| `VITE_SIGN_OUT_REDIRECT_URL` | Runtime | `http://localhost:5173` | OIDC sign-out redirect URL |
| Variable | Type | Example / Default | Description |
|------------------------------|------------|--------------------------------------|--------------------------------------------|
| `VITE_PORT` | Build-time | `5173` | Local dev server port |
| `VITE_BASE_PATH` | Build-time | `/` | Public base path Vite serves the app under |
| `VITE_API_URL` | Runtime | `http://localhost:8083` | Portal Backend API base URL |
| `VITE_LOGS_URL` | Runtime | `http://localhost:3001` | Audit Service base URL (audit log viewer) |
| `VITE_IDP_CLIENT_ID` | Runtime | `your_client_id` | IdP (Asgardeo) application client ID |
| `VITE_IDP_BASE_URL` | Runtime | `https://api.asgardeo.io/t/your-org` | IdP (Asgardeo) base URL |
| `VITE_IDP_SCOPE` | Runtime | `openid,profile` | Comma-separated OAuth scopes |
| `VITE_IDP_ADMIN_ROLE` | Runtime | `admin` | Role required to access the Admin Portal |
| `VITE_SIGN_IN_REDIRECT_URL` | Runtime | `http://localhost:5173` | OIDC sign-in redirect URL |
| `VITE_SIGN_OUT_REDIRECT_URL` | Runtime | `http://localhost:5173` | OIDC sign-out redirect URL |

### Testing runtime configuration locally

Expand All @@ -85,7 +85,7 @@ or create `portals/apps/admin/public/config.js` by hand:

```js
window.configs = {
VITE_API_URL: 'http://localhost:3000',
VITE_API_URL: 'http://localhost:8083',
VITE_LOGS_URL: 'http://localhost:3001',
VITE_IDP_CLIENT_ID: 'your_client_id',
VITE_IDP_BASE_URL: 'https://api.asgardeo.io/t/your-org',
Expand Down Expand Up @@ -114,7 +114,7 @@ docker build -t admin-portal -f apps/admin/Dockerfile .

# Run container
docker run -p 5173:80 \
-e VITE_API_URL=http://localhost:3000 \
-e VITE_API_URL=http://localhost:8083 \
-e VITE_LOGS_URL=http://localhost:3001 \
-e VITE_IDP_CLIENT_ID=your_client_id \
-e VITE_IDP_BASE_URL=https://api.asgardeo.io/t/your-org \
Expand Down
2 changes: 1 addition & 1 deletion portals/apps/member/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ VITE_PORT=5173
VITE_BASE_PATH=/

# --- Runtime (window.configs - see entrypoint.sh / public/config.js) ---
VITE_API_URL=http://localhost:3000
VITE_API_URL=http://localhost:8083
VITE_LOGS_URL=http://localhost:3001
VITE_CLIENT_ID=your_client_id
VITE_BASE_URL=https://api.asgardeo.io/t/your-org
Expand Down
6 changes: 3 additions & 3 deletions portals/apps/member/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ cp .env.example .env
|------------------------------|------------|--------------------------------------|--------------------------------------------|
| `VITE_PORT` | Build-time | `5173` | Local dev server port |
| `VITE_BASE_PATH` | Build-time | `/` | Public base path Vite serves the app under |
| `VITE_API_URL` | Runtime | `http://localhost:3000` | Portal Backend API base URL |
| `VITE_API_URL` | Runtime | `http://localhost:8083` | Portal Backend API base URL |
| `VITE_LOGS_URL` | Runtime | `http://localhost:3001` | Audit Service base URL (audit log viewer) |
| `VITE_CLIENT_ID` | Runtime | `your_client_id` | IdP (Asgardeo) application client ID |
| `VITE_BASE_URL` | Runtime | `https://api.asgardeo.io/t/your-org` | IdP (Asgardeo) base URL |
Expand All @@ -75,7 +75,7 @@ cp .env.example .env

```js
window.configs = {
API_URL: 'http://localhost:3000',
API_URL: 'http://localhost:8083',
LOGS_URL: 'http://localhost:3001',
CLIENT_ID: 'your_client_id',
BASE_URL: 'https://api.asgardeo.io/t/your-org',
Expand Down Expand Up @@ -103,7 +103,7 @@ docker build -t member-portal -f apps/member/Dockerfile .

# Run container
docker run -p 5173:80 \
-e VITE_API_URL=http://localhost:3000 \
-e VITE_API_URL=http://localhost:8083 \
-e VITE_LOGS_URL=http://localhost:3001 \
-e VITE_CLIENT_ID=your_client_id \
-e VITE_BASE_URL=https://api.asgardeo.io/t/your-org \
Expand Down
2 changes: 1 addition & 1 deletion portals/setup-portals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ BLUE='\033[0;34m'
NC='\033[0m'

# Test configuration values (can be overridden via environment variables)
TEST_API_URL="${TEST_API_URL:-http://localhost:3000}"
TEST_API_URL="${TEST_API_URL:-http://localhost:8083}"
TEST_LOGS_URL="${TEST_LOGS_URL:-http://localhost:3001}"
TEST_CLIENT_ID="${TEST_CLIENT_ID:-test-client-id-123}"
TEST_BASE_URL="${TEST_BASE_URL:-https://api.asgardeo.io/t/test-org}"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ The `docker-compose.test.yml` starts:
- **Policy Decision Point** (8082) - Policy evaluation service
- **Consent Engine** (8081) - Consent management service
- **Orchestration Engine** (4000) - GraphQL orchestration service
- **Portal Backend** (3000) - Admin portal backend
- **Portal Backend** (8083) - Admin portal backend

All services run on `test-network` Docker network.

Expand Down
Loading