Skip to content

Commit 49f5033

Browse files
fix CE appid deployment wrong internal URL create. Feedback from Mike M.
But the version for in the UI ```-->log: error Error: Invalid version at t.exports.decodeAndValidate (appid.umd.min.js:27:211169) at t.exports.retrieveTokens (appid.umd.min.js:27:217577) at async t.exports.performOAuthFlowAndGetTokens (appid.umd.min.js:27:216641)``` is not valid
1 parent 6955f9b commit 49f5033

9 files changed

+82
-65
lines changed

CE/appid-ce-deploy-apps.sh

+28-18
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export ARTICLES=articles-appid
3434
# Application URLs
3535
export WEBAPI_URL="http://localhost:8083"
3636
export WEBAPP_URL="http://localhost:8080"
37-
export ARTICEL_URL="http://$ARTICLES.$NAMESPACE.svc.cluster.local/articlesA"
37+
#export ARTICEL_URL="http://$ARTICLES.$NAMESPACE.svc.cluster.local/articlesA"
3838

3939
#--------------------
4040
# App ID
@@ -78,17 +78,27 @@ function setupCLIenvCE() {
7878

7979
ibmcloud target -g $RESOURCE_GROUP
8080
ibmcloud target -r $REGION
81-
ibmcloud ce project get --name $PROJECT_NAME
82-
ibmcloud ce project select -n $PROJECT_NAME
83-
81+
82+
RESULT=$(ibmcloud ce project get --name $PROJECT_NAME | grep "Status" | awk '{print $2;}')
83+
if [[ $RESULT == "active" ]]; then
84+
echo "*** The project $PROJECT_NAME exists."
85+
ibmcloud ce project select -n $PROJECT_NAME
86+
else
87+
ibmcloud ce project create --name $PROJECT_NAME
88+
ibmcloud ce project select -n $PROJECT_NAME
89+
fi
90+
8491
#to use the kubectl commands
8592
ibmcloud ce project select -n $PROJECT_NAME --kubecfg
8693

87-
NAMESPACE=$(ibmcloud ce project get --name $PROJECT_NAME --output json | grep "namespace" | awk '{print $2;}' | sed 's/"//g' | sed 's/,//g')
88-
echo "Namespace: $NAMESPACE"
89-
kubectl get pods -n $NAMESPACE
94+
export PROJECT_NAMESPACE=$(ibmcloud ce project get --name $PROJECT_NAME --output json | grep "namespace" | awk '{print $2;}' | sed 's/"//g' | sed 's/,//g')
95+
echo "Code Engine project namespace: $PROJECT_NAMESPACE"
96+
kubectl get pods -n $PROJECT_NAMESPACE
97+
export ARTICEL_URL="http://$ARTICLES.$PROJECT_NAMESPACE.svc.cluster.local/articlesA"
98+
9099

91100
CHECK=$(ibmcloud ce project get -n $PROJECT_NAME | awk '/Apps/ {print $2;}')
101+
92102
echo "**********************************"
93103
echo "Check for existing apps? '$CHECK'"
94104
echo "**********************************"
@@ -296,12 +306,12 @@ function deployArticles(){
296306

297307
ibmcloud ce application get --name "$ARTICLES"
298308

299-
echo "ARTICLES URL: http://$ARTICLES.$NAMESPACE.svc.cluster.local/articlesA"
309+
echo "ARTICLES URL: http://$ARTICLES..svc.cluster.local/articlesA"
300310
}
301311

302312
function deployWebAPI(){
303313

304-
echo "Needed Articles URL: http://$ARTICLES.$NAMESPACE.svc.cluster.local/articlesA"
314+
echo "Needed Articles URL: http://$ARTICLES.$PROJECT_NAMESPACE.svc.cluster.local/articlesA"
305315

306316
# Valid vCPU and memory combinations: https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo
307317
ibmcloud ce application create --name "$WEBAPI" \
@@ -310,7 +320,7 @@ function deployWebAPI(){
310320
--memory "1G" \
311321
--env APPID_AUTH_SERVER_URL_TENANT_A="$APPLICATION_OAUTHSERVERURL" \
312322
--env APPID_CLIENT_ID_TENANT_A="$APPLICATION_CLIENTID" \
313-
--env CNS_ARTICLES_URL_TENANT_A="http://$ARTICLES.$NAMESPACE.svc.cluster.local/articlesA" \
323+
--env CNS_ARTICLES_URL_TENANT_A="http://$ARTICLES.$PROJECT_NAMESPACE.svc.cluster.local/articlesA" \
314324
--max-scale 1 \
315325
--min-scale 0 \
316326
--port 8080
@@ -347,9 +357,9 @@ function kubeDeploymentVerification(){
347357
echo " pods, deployments and configmaps details "
348358
echo "************************************"
349359

350-
kubectl get pods -n $NAMESPACE
351-
kubectl get deployments -n $NAMESPACE
352-
kubectl get configmaps -n $NAMESPACE
360+
kubectl get pods -n $PROJECT_NAMESPACE
361+
kubectl get deployments -n $PROJECT_NAMESPACE
362+
kubectl get configmaps -n $PROJECT_NAMESPACE
353363

354364
}
355365

@@ -360,7 +370,7 @@ function getKubeContainerLogs(){
360370
echo "************************************"
361371

362372
FIND=$WEBAPI
363-
WEBAPI_LOG=$(kubectl get pod -n $NAMESPACE | grep $FIND | awk '{print $1}')
373+
WEBAPI_LOG=$(kubectl get pod -n $PROJECT_NAMESPACE | grep $FIND | awk '{print $1}')
364374
echo $WEBAPI_LOG
365375
kubectl logs $WEBAPI_LOG user-container
366376

@@ -369,7 +379,7 @@ function getKubeContainerLogs(){
369379
echo "************************************"
370380

371381
FIND=$ARTICLES
372-
ARTICLES_LOG=$(kubectl get pod -n $NAMESPACE | grep $FIND | awk '{print $1}')
382+
ARTICLES_LOG=$(kubectl get pod -n $PROJECT_NAMESPACE | grep $FIND | awk '{print $1}')
373383
echo $ARTICLES_LOG
374384
kubectl logs $ARTICLES_LOG user-container
375385

@@ -378,7 +388,7 @@ function getKubeContainerLogs(){
378388
echo "************************************"
379389

380390
FIND=$WEBAPP
381-
WEBAPP_LOG=$(kubectl get pod -n $NAMESPACE | grep $FIND | awk '{print $1}')
391+
WEBAPP_LOG=$(kubectl get pod -n $PROJECT_NAMESPACE | grep $FIND | awk '{print $1}')
382392
echo $WEBAPP_LOG
383393
kubectl logs $WEBAPP_LOG user-container
384394
}
@@ -395,7 +405,7 @@ function checkKubernetesPod (){
395405
while :
396406
do
397407
FIND=$i
398-
STATUS_CHECK=$(kubectl get pod -n $NAMESPACE | grep $FIND | awk '{print $3}')
408+
STATUS_CHECK=$(kubectl get pod -n $PROJECT_NAMESPACE | grep $FIND | awk '{print $3}')
399409
echo "Status: $STATUS_CHECK"
400410
if [ "$STATUS" = "$STATUS_CHECK" ]; then
401411
echo "$(date +'%F %H:%M:%S') Status: $FIND is Ready"
@@ -477,5 +487,5 @@ echo "************************************"
477487
echo " - oAuthServerUrl : $APPLICATION_OAUTHSERVERURL"
478488
echo " - discoveryEndpoint: $APPLICATION_DISCOVERYENDPOINT"
479489
echo " - Web-API : $WEBAPI_URL/articlesA"
480-
echo " - Articles : http://$ARTICLES.$NAMESPACE.svc.cluster.local/articlesA"
490+
echo " - Articles : http://$ARTICLES.$PROJECT_NAMESPACE.svc.cluster.local/articlesA"
481491
echo " - Web-App : $WEBAPP_URL"

CE/ce-deploy-apps.sh

+14-8
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,25 @@ function setupCLIenvCE() {
3636

3737
ibmcloud target -g $RESOURCE_GROUP
3838
ibmcloud target -r $REGION
39-
ibmcloud ce project get --name $PROJECT_NAME
40-
ibmcloud ce project select -n $PROJECT_NAME
41-
39+
40+
RESULT=$(ibmcloud ce project get --name $PROJECT_NAME | grep "Status" | awk '{print $2;}')
41+
if [[ $RESULT == "active" ]]; then
42+
echo "*** The project $PROJECT_NAME exists."
43+
ibmcloud ce project select -n $PROJECT_NAME
44+
else
45+
ibmcloud ce project create --name $PROJECT_NAME
46+
ibmcloud ce project select -n $PROJECT_NAME
47+
fi
48+
4249
#to use the kubectl commands
4350
ibmcloud ce project select -n $PROJECT_NAME --kubecfg
4451

45-
# NAMESPACE=$(kubectl get namespaces | awk '/NAME/ { getline; print $0;}' | awk '{print $1;}')
46-
# NAMESPACE=$(ibmcloud ce project get --name $PROJECT_NAME --output json | sed -n 's|.*"namespace":"\([^"]*\)".*|\1|p')
47-
NAMESPACE=$(ibmcloud ce project get --name $PROJECT_NAME --output json | grep "namespace" | awk '{print $2;}' | sed 's/"//g' | sed 's/,//g')
48-
echo "Namespace: $NAMESPACE"
49-
kubectl get pods -n $NAMESPACE
52+
export PROJECT_NAMESPACE=$(ibmcloud ce project get --name $PROJECT_NAME --output json | grep "namespace" | awk '{print $2;}' | sed 's/"//g' | sed 's/,//g')
53+
echo "Code Engine project namespace: $PROJECT_NAMESPACE"
54+
kubectl get pods -n $PROJECT_NAMESPACE
5055

5156
CHECK=$(ibmcloud ce project get -n $PROJECT_NAME | awk '/Apps/ {print $2;}')
57+
5258
echo "**********************************"
5359
echo "Check for existing apps? '$CHECK'"
5460
echo "**********************************"

documentation/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ The workshop uses following IBM Cloud Services:
106106
* [IBM Cloud Monitoring](https://cloud.ibm.com/docs/monitoring?topic=monitoring-getting-started#getting-started) (lite plan)
107107
* [IBM Cloud Log Analysis](https://cloud.ibm.com/docs/log-analysis?topic=log-analysis-getting-started#getting-started) (lite plan)
108108

109-
`IBM Cloud Code Engine` is build on [Open Source](https://en.wikipedia.org/wiki/Open_source) technologies:
109+
`IBM Cloud `Code Engine` is built on [Open](https://en.wikipedia.org/wiki/Open_source) Source](https://en.wikipedia.org/wiki/Open_source) technologies:
110110

111111
* [Knative](https://knative.dev/)
112112
* [Kubernetes](https://knative.dev/)
@@ -115,7 +115,7 @@ The workshop uses following IBM Cloud Services:
115115

116116
### Technology Used
117117

118-
The example mircorservices application example is build with following `technologies/tools/frameworks`.
118+
The example microservices application example is built with the following `technologies/`tools/frameworks`.
119119

120120
* [Microservices architecture](https://en.wikipedia.org/wiki/Microservices)
121121
* [Keycloak](https://www.keycloak.org)

documentation/app-id-optional.md

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Optional Lab 3: Run the example application with App ID
22

3-
In this optional lab we use an [IBM Cloud App ID](https://www.ibm.com/cloud/app-id) service instance for authentication and authorization .
3+
In this optional lab, we use an [IBM Cloud App ID](https://www.ibm.com/cloud/app-id) service instance for authentication and authorization.
44

55
We will create an [IBM Cloud App ID](https://www.ibm.com/cloud/app-id) service instance using a **"lite"** plan, this plan type does not create additional costs for us.
66

@@ -22,7 +22,7 @@ Here is a simplified architecture diagram which shows the **Web-App** and the tw
2222

2323
### Deploy the example application with App ID
2424

25-
#### (optional) Step 1 : Clone the GitHub project to the **`IBM Cloud Shell`**
25+
#### (optional) Step 1: Clone the GitHub project to the **`IBM Cloud Shell`**
2626

2727
> Only needed, if you haven't done it before.
2828
@@ -44,6 +44,19 @@ ROOT_FOLDER=$(pwd)
4444
export MYPROJECT=cloud-native-starter-[YOUR-EXTENTION]
4545
```
4646

47+
Optional setting:
48+
49+
```sh
50+
export RESOURCE_GROUP=[YOUR-GROUP]
51+
export REGION=[YOUR-REGION]
52+
```
53+
54+
> Log on to IBM Cloud!
55+
56+
```sh
57+
ibmcloud login -g $RESOURCE_GROUP -r $REGION (-sso Optional)
58+
```
59+
4760
#### Step 3: Execute following bash automation
4861

4962
> Be patient, because the script may take several minutes (_up to 10 min_).
@@ -66,7 +79,7 @@ Here are the simplified steps that are carried out in the bash script using main
6679

6780
#### Step 5: Inspect the output
6881

69-
The relevant urls will be listed.
82+
The relevant URLs will be listed.
7083

7184
```sh
7285
************************************

documentation/build-container-image.md

+4-11
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ The following simplified architecture diagram show the dependencies of the `Code
1919

2020
### Steps
2121

22-
#### Step 1: Create an IBM Cloud Container image `Namespace`
23-
24-
1. Open following link:
22+
#### Step 1: Create an IBM Cloud Container image `Namespace`Open the following link:
2523

2624
```sh
2725
https://cloud.ibm.com/registry/namespaces
@@ -49,10 +47,7 @@ The following simplified architecture diagram show the dependencies of the `Code
4947
* Registry name: `ibm-container-registry`
5048
* Registry server: `us.icr.io`
5149
* As you see, we need an `IAM API Key`. So we leave this browser tab open and we create a new browser tab.
52-
53-
![](images/ibm-ce-registry-access-02.png)
54-
55-
3. Open following link in the new browser tab
50+
Open the following link in the new browser tab
5651

5752
```sh
5853
https://cloud.ibm.com/iam/apikeys
@@ -87,10 +82,8 @@ The following simplified architecture diagram show the dependencies of the `Code
8782
![](images/ibm-ce-container-build-01.png)
8883

8984
2. The `Specify build details` wizard appears, which contains three steps `Sources`, `Strategy` and `Output`.
90-
91-
![](images/ibm-ce-container-build-02.png)
9285

93-
3. Insert following values for `Sources` and press `Next`
86+
3. Insert the following values for `Sources` and press `Next`
9487

9588
* Name: `web-app-image`
9689
* Code repo URL: `https://github.com/IBM/ce-cns`
@@ -107,7 +100,7 @@ The following simplified architecture diagram show the dependencies of the `Code
107100

108101
![](images/ibm-ce-container-build-03.png)
109102

110-
5. Insert or select following values for `Output` and press `Done`
103+
5. Insert or select the following values for `Output` and press `Done`
111104

112105
* Registry server: `us.icr.io`
113106
* Registry access: `ibm-container-registry`

documentation/cleanup-example.md

+4-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Here we just delete all applications to avoid additional costs for you.
88
99
#### Step 1: Open the `IBM Cloud Shell`
1010

11-
Use following link to directly open the `IBM Cloud Shell`.
11+
Use the following link to directly open the `IBM Cloud Shell`.
1212

1313
<https://cloud.ibm.com/shell>
1414

@@ -26,7 +26,7 @@ Now you are logged on with your IBM Cloud account.
2626
#### Step 3: (Optional) Clone the GitHub project to the `IBM Cloud Shell`
2727

2828
In case your `IBM Cloud Shell` **session has expired** it might be possible that the cloned project was deleted.
29-
If this happened, you need to clone the project again, because we will be using a bash script for the deletion of the project.
29+
If this happens, you need to clone the project again, because we will be using a bash script for the deletion of the project.
3030

3131
```sh
3232
git clone https://github.com/thomassuedbroecker/ce-cns.git
@@ -43,13 +43,9 @@ cd $ROOT_FOLDER/CE
4343
export MYPROJECT=cloud-native-starter-[YOUR-EXTENTION]
4444
```
4545

46-
#### Step 5: Execute following bash automation
46+
#### Step 5: Execute the following bash automation
4747

48-
```sh
49-
bash ce-remove-apps.sh
50-
```
51-
52-
Relevant for your configuration are following variables in the bash script:
48+
Relevant to your configuration are the following variables in the bash script:
5349

5450
```sh
5551
export PROJECT_NAME=$MYPROJECT #your project name

documentation/inspect-the-project.md

+11-12
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@
22

33
### Step 1: Open the `Code Engine` project
44

5-
Use following link to directly navigate to the Code Engine projects and open the created project.
5+
Use the following link to directly navigate to the Code Engine projects and open the created project.
66

77
<https://cloud.ibm.com/codeengine/projects>
88

99
![](images/cns-ce-create-project-02.png)
1010

1111
### Step 2: Select `Overview`
1212

13-
In the following image you see:
14-
15-
1. The summary containing the Applications, Jobs, Image builds, Registry access, Secrets and Configmaps. In our case only the four applications are relevant.
16-
2. The currenly usage of our application.
13+
In the following image, you see:
14+
The summary contains the Applications, Jobs, Image builds, Registry access, Secrets and Configmaps. In our case only the four applications are relevant.
15+
2. The current usage of our application.
1716

1817
![](images/cns-ce-inspect-project-01.png)
1918

@@ -39,7 +38,7 @@ The `overview tab` shows the number of the running instances and the revisons of
3938

4039
Here we find four tabs used to configure the application instance on `Code Engine`.
4140

42-
* First select the `Code` tab. Here you see our container image reference to the Quay container registry.
41+
* First, select the `Code` tab. Here you see our container image reference to the Quay container registry.
4342

4443
![](images/cns-ce-inspect-project-update-02.png)
4544

@@ -53,7 +52,7 @@ Here we find four tabs used to configure the application instance on `Code Engin
5352
5453
* Now select the `Environment variables` tab.
5554

56-
Here you see the routes for the `wep-api` microservice to setup the connections **internal** `articels` microservice and the external `Keycloak` application.
55+
Here you see the routes for the `wep-api` microservice to set up the connections **internal** `articels` microservice and the external `Keycloak` application.
5756

5857
![](images/cns-ce-inspect-project-update-04.png)
5958

@@ -65,17 +64,17 @@ A short extract of the Code Engine documentation:
6564

6665
> _"These metadata fields are called Entrypoint and Command. For those users who are familiar with Dockerfile, the fields equate to the **ENTRYPOINT and CMD commands**. These two fields contain arrays of strings that are combined to create the command line that is used when you run your container."_
6766
68-
For details visit the [IBM Cloud documentation](https://cloud.ibm.com/docs/codeengine?topic=codeengine-cmd-args).
67+
For details visit the [IBM Cloud documentation](https://cloud.ibm.com/docs/codeengine?topic=codeengine-cmd-args).
6968

7069
### Step 6: Endpoints tab
7170

72-
Here you can change the `endpoint` visibility. For our `web-api` application we need a public visibility because the application is invoked by our `web-app` frontend.
71+
Here you can change the `endpoint` visibility. For our `web-api` application, we need public visibility because the application is invoked by our `web-app` frontend.
7372

7473
![](images/cns-ce-inspect-project-update-05.png)
7574

7675
### Step 7: Verify the `Code Engine CLI` application instance configuration
7776

78-
In following code you see the `Code Engine CLI` invocation for the `web-api` microservice, this code is used in the bash script to create a Code Engine application instance. It reflects what you have seen in the [`Code Engine UI`](https://cloud.ibm.com/codeengine/projects).
77+
In the following code you see the `Code Engine CLI` invocation for the `web-api` microservice, this code is used in the bash script to create a Code Engine application instance. It reflects what you have seen in the [`Code Engine UI`](https://cloud.ibm.com/codeengine/projects).
7978

8079
> Note: The only difference is the threshold of concurrent requests per instance at which one or more additional instances are created is defined. Use this value to scale up instances based on concurrent number of requests. If `--concurrency-target` is not specified, this option defaults to the value of the `--concurrency` option. This value is optional. The default value is `0`.
8180
@@ -88,7 +87,7 @@ In following code you see the `Code Engine CLI` invocation for the `web-api` mic
8887
--cpu "0.5" \
8988
--memory "1G" \
9089
--env QUARKUS_OIDC_AUTH_SERVER_URL="$KEYCLOAK_URL/auth/realms/quarkus" \
91-
--env CNS_ARTICLES_URL="http://articles.$NAMESPACE.svc.cluster.local/articles" \
90+
--env CNS_ARTICLES_URL="http://articles.$PROJECT_NAMESPACE.svc.cluster.local/articles" \
9291
--max-scale 1 \
9392
--min-scale 0 \
9493
--concurrency-target 100 \
@@ -97,7 +96,7 @@ In following code you see the `Code Engine CLI` invocation for the `web-api` mic
9796

9897
### Step 8: Estimate cost
9998

100-
You can easily estimate cost for your Code Engine application.
99+
You can easily estimate the cost for your Code Engine application.
101100
Just select `estimate cost` and configure your region, cpu and storage, estimated monthly runtime for your application and the number of application instances. For more details visit the [IBM Cloud documentation](https://cloud.ibm.com/codeengine/overview).
102101

103102
![](images/cns-ce-inspect-project-update-01.gif)

documentation/push-to-container-registry.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ _Note:_ In the image below you see an example where you can find the name, you s
7777

7878
![](images/quay-user.png)
7979

80-
### Step 6: Execute following bash automation
80+
### Step 6: Execute the following bash automation
8181

8282
This bash script will build and push your container images to [Red Hat Quay.io](https://quay.io).
8383

0 commit comments

Comments
 (0)