Exercise 3 - Change code, build, save and deploy the Web-App
Step 1: Open the main.js
file
main.js
fileStep 2: Change following source code
Replace the [keycloakurl]
with the value, you got before for in Step 1 and save the file. The authors url is only available after the deploment of the Authors service.
Step 3: Build and save the "Web-App" container image in the IBM Cloud Container Registry
Now we want to build and save the container image "Web-APP" in the IBM Cloud Container Registry.
Ensure you logon on to IBM Cloud.
REMEMBER: You should know this from the prerequisites.
You can follow the steps in the Access tab, by starting from After your cluster provision .. and inserting the commands into your terminal session.
Logon to the IBM Cloud Container Registry (Ensure you are in the right folders)
Web-APP
List you namespaces inside the IBM Cloud Container Registry
Example output:
Now upload the code and build the container image inside IBM Cloud Container Registry. We use the information from step 2, where we got the list of namespaces.
Web-APP
Step 4: List the container images to verify the upload.
Step 5: Apply the deployment of the Web-App
Ensure you are in the
$ROOT_FOLDER/web-app-cloud/deployment
Open the
../web-app-cloud/deployment/kubernetes.yaml
file with a editor and replace the value for the container image location with the path we got from the IBM Container Registry and just replace theweb-app:1
text, and add following statementimagePullPolicy: Always
and save the file.
Before:
Example after the change:
Now we apply the yaml to create the web-app Pod.
Insert this command and verify the output.
Example output:
Cluster/Workernode IP
Web-APP
NodePort
Open the Web-APP in a browser
Step 6: Configure the redirect URL in Keycloak
Get the Keycloak URL in your terminal session:
Open Keycloak your browser
Login admin/admin and open the Cloud Native Starter realm
Select Clients
Open the
authors-client-cloud-native-starter
clientGet the
redirecturl
in your terminal session and copy the URLInsert the
[redirecturl]
Root URL:
[redirecturl]
Valid Redirect URIs:
[redirecturl]
/*[redirecturl]
//
Configure the
Web Origins
Web Origins:
'*'
*
Step 7: Open the Web-App again
Step 8: Logon as user author-cloud-native-starter
and password 1234
.
author-cloud-native-starter
and password 1234
.Last updated
Was this helpful?