From 0a483813e7fe6bd4b831e562dede7a63ab0b1f6d Mon Sep 17 00:00:00 2001 From: wdbasson Date: Thu, 1 Feb 2024 12:08:55 +0200 Subject: [PATCH] Standardise roles (#634) * Change trus-registry role to public * Change tenant-admin path to /tenant-admin * Temporary reference update for charts repo * Trust-registry prefix to /trust-registry --- .github/workflows/continuous-deploy.yml | 24 +++++++++++++++++-- app/main.py | 2 +- app/routes/trust_registry.py | 2 +- docker-compose.yaml | 10 ++++---- .../fastapi.default.env | 2 +- .../fastapi.default.env | 6 ++--- manage | 2 +- 7 files changed, 34 insertions(+), 14 deletions(-) rename environments/{governance-trust-registry => governance-public}/fastapi.default.env (84%) diff --git a/.github/workflows/continuous-deploy.yml b/.github/workflows/continuous-deploy.yml index 6d1f0af5d..5f6f4badf 100644 --- a/.github/workflows/continuous-deploy.yml +++ b/.github/workflows/continuous-deploy.yml @@ -56,7 +56,7 @@ jobs: governance-multitenant-web, governance-ga-web, governance-tenant-web, - governance-trust-registry-web, + governance-public-web, governance-webhooks-web, governance-multitenant-agent, governance-endorser, @@ -78,7 +78,7 @@ jobs: - image: governance-tenant-web context: . file: dockerfiles/fastapi/Dockerfile - - image: governance-trust-registry-web + - image: governance-public-web context: . file: dockerfiles/fastapi/Dockerfile - image: governance-webhooks-web @@ -332,12 +332,32 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + # - name: Determine branch + # id: set_branch + # uses: actions/github-script@v5 + # with: + # script: | + # const GITHUB_TOKEN = process.env.GITHUB_TOKEN; + # const octokit = require('@actions/github').getOctokit(GITHUB_TOKEN); + # const branchName = process.env.GITHUB_REF.replace('refs/heads/', ''); + # try { + # await octokit.rest.repos.getBranch({ + # owner: process.env.GITHUB_REPOSITORY_OWNER, + # repo: (process.env.GITHUB_REPOSITORY).split('/')[1], + # branch: branchName, + # }); + # return branchName; + # } catch (error) { + # return 'master'; + # } + - name: Checkout Charts uses: actions/checkout@v4 with: repository: didx-xyz/charts token: ${{ secrets.PAT }} path: charts + # ref: ${{ steps.set_branch.outputs.result }} # - name: Install dependencies run: sudo apt-get install -y postgresql-client redis-tools diff --git a/app/main.py b/app/main.py index 3a762a316..89d5b2a69 100644 --- a/app/main.py +++ b/app/main.py @@ -96,7 +96,7 @@ def routes_for_role(role: str) -> list: return tenant_routes elif ROLE == "tenant-admin": return tenant_admin_routes - elif ROLE == "trust-registry": + elif ROLE == "public": return trust_registry_routes elif ROLE == "*": return tenant_admin_routes + tenant_routes + trust_registry_routes diff --git a/app/routes/trust_registry.py b/app/routes/trust_registry.py index 62f9d8983..2d68074ce 100644 --- a/app/routes/trust_registry.py +++ b/app/routes/trust_registry.py @@ -9,7 +9,7 @@ logger = get_logger(__name__) -router = APIRouter(tags=["trust-registry"]) +router = APIRouter(prefix="/trust-registry", tags=["trust-registry"]) @router.get("/schemas", response_model=List[Schema]) diff --git a/docker-compose.yaml b/docker-compose.yaml index bd9778ecb..43c4847f8 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -182,9 +182,9 @@ services: - host env_file: - environments/governance-tenant/fastapi.default.env - governance-trust-registry-web: - image: ${REGISTRY:-local}/governance-trust-registry-web:${IMAGE_TAG:-latest} - container_name: governance-trust-registry-web + governance-public-web: + image: ${REGISTRY:-local}/governance-public-web:${IMAGE_TAG:-latest} + container_name: governance-public-web build: context: . dockerfile: ./dockerfiles/fastapi/Dockerfile @@ -192,7 +192,7 @@ services: - 0.0.0.0:8400:8000 volumes: - ./app:/app - - ./environments/governance-trust-registry/fastapi.default.env:/app/.env + - ./environments/governance-public/fastapi.default.env:/app/.env - ./logs/tenant:/logs depends_on: governance-multitenant-wallets-db: @@ -209,7 +209,7 @@ services: - governance-multitenant - host env_file: - - environments/governance-trust-registry/fastapi.default.env + - environments/governance-public/fastapi.default.env governance-webhooks-web: image: ${REGISTRY:-local}/governance-webhooks-web:${IMAGE_TAG:-latest} container_name: governance-webhooks-web diff --git a/environments/governance-multitenant/fastapi.default.env b/environments/governance-multitenant/fastapi.default.env index 3f863e1b3..121b29619 100644 --- a/environments/governance-multitenant/fastapi.default.env +++ b/environments/governance-multitenant/fastapi.default.env @@ -19,5 +19,5 @@ PYTHONPATH=/ ACAPY_ENDORSER_ALIAS=endorser -ROOT_PATH=/admin +ROOT_PATH=/tenant-admin ROLE=tenant-admin diff --git a/environments/governance-trust-registry/fastapi.default.env b/environments/governance-public/fastapi.default.env similarity index 84% rename from environments/governance-trust-registry/fastapi.default.env rename to environments/governance-public/fastapi.default.env index 7ccb4a5cb..df47b1b1b 100644 --- a/environments/governance-trust-registry/fastapi.default.env +++ b/environments/governance-public/fastapi.default.env @@ -10,7 +10,7 @@ ACAPY_MULTITENANT_JWT_SECRET=jwtSecret TRUST_REGISTRY_URL=http://governance-trust-registry:8001 # OpenAPI name -OPENAPI_NAME=CloudAPI-Trust-Registry +OPENAPI_NAME=CloudAPI-Public # Webhooks WEBHOOKS_URL=http://governance-webhooks-web:3010 @@ -19,5 +19,5 @@ PYTHONPATH=/ ACAPY_ENDORSER_ALIAS=endorser -ROOT_PATH=/trust-registry -ROLE=trust-registry +ROOT_PATH=/public +ROLE=public diff --git a/manage b/manage index c6996f63f..586e8ff68 100755 --- a/manage +++ b/manage @@ -56,7 +56,7 @@ EOF # Default Settings: # ----------------------------------------------------------------------------------------------------------------- DEFAULT_CONTAINERS="governance-trust-registry trustregistry-db governance-multitenant-wallets-db governance-multitenant-agent tails-server ledger-nodes ledger-browser - governance-ga-wallets-db governance-ga-agent governance-multitenant-web governance-tenant-web governance-ga-web governance-trust-registry-web wh-redis governance-webhooks-web governance-endorser" + governance-ga-wallets-db governance-ga-agent governance-multitenant-web governance-tenant-web governance-ga-web governance-public-web wh-redis governance-webhooks-web governance-endorser" TEST_CONTAINERS="${DEFAULT_CONTAINERS} tests" # ----------------------------------------------------------------------------------------------------------------- # Functions: