From d3f7d2935986c5be36c702d9a5e1b4500b488d2a Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Thu, 28 Mar 2024 08:53:30 +0100 Subject: Docker-compose setup for ui is not working - use correct image repository - remove all references to portal-[bff|preferences|history] and use the non-prefixed versions - fix Keycloak realm settings Issue-ID: PORTALNG-83 Change-Id: If86c6e13fa10584b3e209ad777f7f85d9cb3afe5 Signed-off-by: Fiete Ostkamp --- README.md | 6 ++-- development/.env | 52 +++++++++++++--------------- development/config/onap-realm.json | 8 ++--- development/docker-compose.yml | 71 ++++++++++++++++++++++---------------- local.proxy.config.json | 2 +- 5 files changed, 74 insertions(+), 65 deletions(-) diff --git a/README.md b/README.md index 99ea425..0e133c9 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ npm start ``` ### Developing against local containers -We are providing a docker-compose file that can be used to spin up the portal-ng and it's dependencies (like Keycloak or the portal-bff) on your machine. +We are providing a docker-compose file that can be used to spin up the portal-ng and it's dependencies (like Keycloak or the bff) on your machine. To do that, execute the `run.sh` in the development folder: ```shell @@ -62,7 +62,7 @@ In the configuration of nginx (the `nginx.template`) we have a few environment v ```bash export NGINX_PORT=80 -export BFF_URL=http://portal-bff:9080/ +export BFF_URL=http://bff:9080/ export WIREMOCK_URL=http://wiremock:8080/ ``` @@ -75,7 +75,7 @@ docker build -t portal-ng . ### Run the docker image ```bash -docker run -e "NGINX_PORT=80" -e "BFF_URL=http:portal-bff:9080/" -e "WIREMOCK_URL=http://wiremock:8080/" -p 8080:80 portal-ng +docker run -e "NGINX_PORT=80" -e "BFF_URL=http:bff:9080/" -e "WIREMOCK_URL=http://wiremock:8080/" -p 8080:80 portal-ng ``` Note that this will not work on its own, because the referenced containers (`BFF` and `WIREMOCK`) are most likely not available in your local environment. You would have to run them as well, or pass in other urls (like `example.com`) to get the container running locally. Obviously this does not get you very far though. diff --git a/development/.env b/development/.env index e3b9b54..7addf64 100644 --- a/development/.env +++ b/development/.env @@ -1,5 +1,5 @@ # General image repository -IMAGE_REPOSITORY=nexus.onap.org/content/repositories/snapshots/org/onap/ +IMAGE_REPOSITORY=nexus3.onap.org:10001/onap/portal-ng # Keycloak KEYCLOAK_IMAGE=quay.io/keycloak/keycloak @@ -9,8 +9,8 @@ KEYCLOAK_PASSWORD=password KEYCLOAK_DB=keycloak KEYCLOAK_DB_USER=keycloak KEYCLOAK_DB_PASSWORD=password -KEYCLOAK_URL:http://keycloak-bff:8080 -KEYCLOAK_REALM:ONAP +KEYCLOAK_URL=http://keycloak-bff:8080 +KEYCLOAK_REALM=ONAP # Postgres database for keycloak POSTGRES_IMAGE=postgres @@ -20,33 +20,29 @@ POSTGRES_VERSION=15rc1 MONGO_IMAGE=mongo MONGO_VERSION=latest -# portal-service -PORTAL_SERVICE_URL=http://portal-service:9000 -PORTAL_SERVICE_IMAGE_NAME=portal-service -PORTAL_SERVICE_IMAGE_TAG=0.1.0-d486ddb4 - # portal-prefs -PORTAL_PREFS_URL=http://portal-prefs:9001 -PORTAL_PREFS_IMAGE_NAME=portal-prefs -PORTAL_PREFS_IMAGE_TAG=0.1.0-master-faef0c0e -PORTALPREFS_USERNAME=root -PORTALPREFS_PASSWORD=password -PORTALPREFS_DATABASE=Portalprefs -PORTALPREFS_HOST=mongo-prefs -PORTALPREFS_PORT=27017 +PREFERENCES_URL=http://preferences:9001 +PREFERENCES_IMAGE_NAME=preferences +PREFERENCES_IMAGE_TAG=latest +PREFERENCES_USERNAME=root +PREFERENCES_PASSWORD=password +PREFERENCES_DATABASE=preferences +PREFERENCES_MONGO_HOST=mongo-preferences +PREFERENCES_MONGO_PORT=27017 # portal-history -PORTAL_HISTORY_URL=http://portal-history:9002 -PORTAL_HISTORY_IMAGE_NAME=portal-history -PORTAL_HISTORY_IMAGE_TAG=0.1.1-de369ace -PORTALHISTORY_USERNAME=root -PORTALHISTORY_PASSWORD=password -PORTALHISTORY_DATABASE=Portalhist -PORTALHISTORY_HOST=mongo-history -PORTALHISTORY_PORT=27017 +HISTORY_URL=http://history:9002 +HISTORY_IMAGE_NAME=history +HISTORY_IMAGE_TAG=latest +HISTORY_USERNAME=root +HISTORY_PASSWORD=password +HISTORY_DATABASE=history +HISTORY_MONGO_HOST=mongo-history +HISTORY_MONGO_PORT=27017 -# portal-bff -PORTAL_BFF_IMAGE_NAME=portal-bff -PORTAL_BFF_IMAGE_TAG=0.1.9-389a09e1 -KEYCLOAK_CLIENT_ID=portal-bff +# bff +BFF_URL=http://bff:9080 +BFF_IMAGE_NAME=bff +BFF_IMAGE_TAG=latest +KEYCLOAK_CLIENT_ID=bff KEYCLOAK_CLIENT_SECRET=pKOuVH1bwRZoNzp5P5t4GV8CqcCJYVtr diff --git a/development/config/onap-realm.json b/development/config/onap-realm.json index 80c39e0..d84d5f2 100644 --- a/development/config/onap-realm.json +++ b/development/config/onap-realm.json @@ -13,7 +13,7 @@ "http://localhost/*" ], "webOrigins": [ - "*" + "+" ], "notBefore": 0, "bearerOnly": false, @@ -75,7 +75,7 @@ "microprofile-jwt" ] }, { - "clientId" : "portal-bff", + "clientId" : "bff", "surrogateAuthRequired" : false, "enabled" : true, "alwaysDisplayInConsole" : false, @@ -206,11 +206,11 @@ "groups" : [ ] }, { "createdTimestamp" : 1665048112458, - "username" : "service-account-portal-bff", + "username" : "service-account-bff", "enabled" : true, "totp" : false, "emailVerified" : false, - "serviceAccountClientId" : "portal-bff", + "serviceAccountClientId" : "bff", "credentials" : [ ], "disableableCredentialTypes" : [ ], "requiredActions" : [ ], diff --git a/development/docker-compose.yml b/development/docker-compose.yml index 6c6a0ad..468b7f6 100644 --- a/development/docker-compose.yml +++ b/development/docker-compose.yml @@ -37,47 +37,47 @@ services: container_name: mongo-history image: "${MONGO_IMAGE}:${MONGO_VERSION}" environment: - MONGO_INITDB_ROOT_USERNAME: ${PORTALHISTORY_USERNAME} - MONGO_INITDB_ROOT_PASSWORD: ${PORTALHISTORY_PASSWORD} - portal-history: - container_name: portal-history - image: "${IMAGE_REPOSITORY}/${PORTAL_HISTORY_IMAGE_NAME}:${PORTAL_HISTORY_IMAGE_TAG}" + MONGO_INITDB_ROOT_USERNAME: ${HISTORY_USERNAME} + MONGO_INITDB_ROOT_PASSWORD: ${HISTORY_PASSWORD} + history: + container_name: history + image: "${IMAGE_REPOSITORY}/${HISTORY_IMAGE_NAME}:${HISTORY_IMAGE_TAG}" ports: - 9002:9002 environment: - PORTALHISTORY_USERNAME: ${PORTALHISTORY_USERNAME} - PORTALHISTORY_PASSWORD: ${PORTALHISTORY_PASSWORD} - PORTALHISTORY_DATABASE: ${PORTALHISTORY_DATABASE} + HISTORY_USERNAME: ${HISTORY_USERNAME} + HISTORY_PASSWORD: ${HISTORY_PASSWORD} + HISTORY_DATABASE: ${HISTORY_DATABASE} KEYCLOAK_URL: ${KEYCLOAK_URL} KEYCLOAK_REALM: ${KEYCLOAK_REALM} - PORTALHISTORY_HOST: ${PORTALHISTORY_HOST} - PORTALHISTORY_PORT: ${PORTALHISTORY_PORT} + MONGO_HOST: ${HISTORY_MONGO_HOST} + MONGO_PORT: ${HISTORY_MONGO_PORT} depends_on: - mongo-history - mongo-prefs: - container_name: mongo-prefs + mongo-preferences: + container_name: mongo-preferences image: "${MONGO_IMAGE}:${MONGO_VERSION}" environment: - MONGO_INITDB_ROOT_USERNAME: ${PORTALPREFS_USERNAME} - MONGO_INITDB_ROOT_PASSWORD: ${PORTALPREFS_PASSWORD} - portal-prefs: - container_name: portal-prefs - image: "${IMAGE_REPOSITORY}/${PORTAL_PREFS_IMAGE_NAME}:${PORTAL_PREFS_IMAGE_TAG}" + MONGO_INITDB_ROOT_USERNAME: ${PREFERENCES_USERNAME} + MONGO_INITDB_ROOT_PASSWORD: ${PREFERENCES_PASSWORD} + preferences: + container_name: preferences + image: "${IMAGE_REPOSITORY}/${PREFERENCES_IMAGE_NAME}:${PREFERENCES_IMAGE_TAG}" ports: - 9001:9001 environment: - PORTALPREFS_USERNAME: ${PORTALPREFS_USERNAME} - PORTALPREFS_PASSWORD: ${PORTALPREFS_PASSWORD} - PORTALPREFS_DATABASE: ${PORTALPREFS_DATABASE} + PREFERENCES_USERNAME: ${PREFERENCES_USERNAME} + PREFERENCES_PASSWORD: ${PREFERENCES_PASSWORD} + PREFERENCES_DATABASE: ${PREFERENCES_DATABASE} KEYCLOAK_URL: ${KEYCLOAK_URL} KEYCLOAK_REALM: ${KEYCLOAK_REALM} - PORTALPREFS_HOST: ${PORTALPREFS_HOST} - PORTALPREFS_PORT: ${PORTALPREFS_PORT} + MONGO_HOST: ${PREFERENCES_MONGO_HOST} + MONGO_PORT: ${PREFERENCES_MONGO_PORT} depends_on: - - mongo-prefs - portal-bff: - container_name: portal-bff - image: "${IMAGE_REPOSITORY}/${PORTAL_BFF_IMAGE_NAME}:${PORTAL_BFF_IMAGE_TAG}" + - mongo-preferences + bff: + container_name: bff + image: "${IMAGE_REPOSITORY}/${BFF_IMAGE_NAME}:${BFF_IMAGE_TAG}" ports: - 9080:9080 environment: @@ -85,6 +85,19 @@ services: KEYCLOAK_REALM: ${KEYCLOAK_REALM} KEYCLOAK_CLIENT_ID: ${KEYCLOAK_CLIENT_ID} KEYCLOAK_CLIENT_SECRET: ${KEYCLOAK_CLIENT_SECRET} - PORTAL_SERVICE_URL: ${PORTAL_SERVICE_URL} - PORTAL_PREFS_URL: ${PORTAL_PREFS_URL} - PORTAL_HISTORY_URL: ${PORTAL_HISTORY_URL} + PREFERENCES_URL: ${PREFERENCES_URL} + HISTORY_URL: ${HISTORY_URL} + COLLECTOR_HOST: localhost + COLLECTOR_PORT: 9411 + # ui: + # container_name: ui + # image: "${IMAGE_REPOSITORY}/ui:latest" + # ports: + # - 80:8080 + # environment: + # BFF_URL: ${BFF_URL} + # KEYCLOAK_HOSTNAME: http://localhost:8080 + # KEYCLOAK_INTERNAL_URL: ${KEYCLOAK_URL} + # KEYCLOAK_REALM: ${KEYCLOAK_REALM} + # NGINX_PORT: 8080 + # KEYCLOAK_CLIENT_ID: portal-app diff --git a/local.proxy.config.json b/local.proxy.config.json index 769e90d..b5c5774 100644 --- a/local.proxy.config.json +++ b/local.proxy.config.json @@ -10,7 +10,7 @@ "target": "http://localhost:8089", "secure": false, "pathRewrite": { - "^/mock-api": "/portal-bff" + "^/mock-api": "/bff" } }, "/auth": { -- cgit 1.2.3-korg