ToDo List
Before you begin
- Install Verrazzano by following the installation instructions.
- To download the example image, you must first accept the license agreement.
- In a browser, navigate to https://container-registry.oracle.com/ and sign in.
- Search for
example-todo
andweblogic
. - For each one:
- Select the image name in the results.
- From the drop-down menu, select your language and click Continue.
- Then read and accept the license agreement.
NOTE: The ToDo List example application deployment files are contained in the Verrazzano project located at
<VERRAZZANO_HOME>/examples/todo-list
, where <VERRAZZANO_HOME>
is the root of the Verrazzano project.
All files and paths in this document are relative to <VERRAZZANO_HOME>/examples/todo-list
.
Deploy the application
ToDo List is an example application containing a WebLogic component. For more information and the source code of this application, see the Verrazzano Examples.
NOTE
To run this application in the default namespace:
$ kubectl label namespace default verrazzano-managed=true istio-injection=enabled
If you chose the default namespace, you can skip Step 1 and ignore the -n
option in the rest of the commands.
-
Create a namespace for the ToDo List example and add a label identifying the namespace as managed by Verrazzano.
$ kubectl create namespace todo-list $ kubectl label namespace todo-list verrazzano-managed=true istio-injection=enabled
-
Create a
docker-registry
secret to enable pulling the ToDo List example image from the registry.$ kubectl create secret docker-registry tododomain-repo-credentials \ --docker-server=container-registry.oracle.com \ --docker-username=YOUR_REGISTRY_USERNAME \ --docker-password=YOUR_REGISTRY_PASSWORD \ --docker-email=YOUR_REGISTRY_EMAIL \ -n todo-list
Replace
YOUR_REGISTRY_USERNAME
,YOUR_REGISTRY_PASSWORD
, andYOUR_REGISTRY_EMAIL
with the values you use to access the registry. -
Create and label secrets for the WebLogic domain. The password must be at least 8 alphanumeric characters with at least one number or special character.
# Replace the values of the WLS_USERNAME and WLS_PASSWORD environment variables as appropriate. $ export WLS_USERNAME=<username> $ export WLS_PASSWORD=<password> $ kubectl create secret generic tododomain-weblogic-credentials \ --from-literal=password=$WLS_PASSWORD \ --from-literal=username=$WLS_USERNAME \ -n todo-list $ kubectl create secret generic tododomain-jdbc-tododb \ --from-literal=username=$WLS_USERNAME \ --from-literal=password=$WLS_PASSWORD \ -n todo-list $ kubectl -n todo-list label secret tododomain-jdbc-tododb weblogic.domainUID=tododomain
Note that the ToDo List example application is preconfigured to use specific secret names. For the source code of this application, see the Verrazzano Examples.
-
To deploy the application, apply the example resources.
$ kubectl apply -f https://raw.githubusercontent.com/verrazzano/verrazzano/v1.7.2/examples/todo-list/todo-list-components.yaml -n todo-list $ kubectl apply -f https://raw.githubusercontent.com/verrazzano/verrazzano/v1.7.2/examples/todo-list/todo-list-application.yaml -n todo-list
-
Wait for the ToDo List application to be ready. You can monitor its progress by listing pods and inspecting the output.
$ kubectl get pods -n todo-list
Alternatively, you can use the
kubectl wait
commands. However, if it is run before the respective pods are created, then thekubectl wait
commands may reporterror: no matching resources found
. Specifically, thetododomain-adminserver
pod may take a while to be created andReady
, so you may need to repeat thekubectl wait
command several times before it is successful.$ kubectl wait pod \ --for=condition=Ready \ -l app.oam.dev/component=todo-mysql-deployment \ -n todo-list \ --timeout=5m $ kubectl wait pod \ --for=condition=Ready \ -l weblogic.serverName=AdminServer \ -n todo-list \ --timeout=5m
-
Get the generated host name for the application.
$ HOST=$(kubectl get gateways.networking.istio.io \ -n todo-list \ -o jsonpath='{.items[0].spec.servers[0].hosts[0]}') $ echo $HOST # Sample output todo-appconf.todo-list.10.11.12.13.nip.io
-
Get the
EXTERNAL_IP
address of theistio-ingressgateway
service.$ ADDRESS=$(kubectl get service \ -n istio-system istio-ingressgateway \ -o jsonpath='{.status.loadBalancer.ingress[0].ip}') $ echo $ADDRESS # Sample output 10.11.12.13
-
Access the ToDo List application.
-
Using the command line
# The expected response of this query is the HTML of a web page $ curl -sk \ https://${HOST}/todo/ \ --resolve ${HOST}:443:${ADDRESS}
If you are using
nip.io
, then you do not need to include--resolve
. -
Local testing with a browser
Temporarily, modify the
/etc/hosts
file (on Mac or Linux) orc:\Windows\System32\Drivers\etc\hosts
file (on Windows 10), to add an entry mapping the host name to the ingress gateway’sEXTERNAL-IP
address. For example:10.11.12.13 todo.example.com
Then, you can access the application in a browser at
https://todo.example.com/todo
.- If you are using
nip.io
, then you can access the application in a browser using theHOST
variable (for example,https://${HOST}/todo
). - If you are going through a proxy, then you may need to add
*.nip.io
to theNO_PROXY
list.
- If you are using
-
Using your own DNS name
Point your own DNS name to the ingress gateway’s
EXTERNAL-IP
address.-
In this case, you would need to have edited the
todo-list-application.yaml
file to use the appropriate value under thehosts
section (such asyourhost.your.domain
), before deploying the ToDo List application. -
Then, you can use a browser to access the application at
https://<yourhost.your.domain>/todo/
.Accessing the application in a browser opens the page, “Derek’s ToDo List”, with an edit field and an Add button that lets you add tasks.
-
-
-
A variety of endpoints associated with the deployed ToDo List application are available to further explore the logs, metrics, and such. You can access them according to the directions here.
Access the WebLogic Server Administration Console
To access the Console from the machine where you are running kubectl
:
-
Set up port forwarding.
$ kubectl port-forward pods/tododomain-adminserver 7001:7001 -n todo-list
NOTE: If you are using the Oracle Cloud Infrastructure Cloud Shell to run
kubectl
, in order to access the Console using port forwarding, you will need to runkubectl
on another machine. -
Access the WebLogic Server Administration Console from your browser.
http://localhost:7001/console
NOTE
It is recommended that the WebLogic Server Administration Console not be exposed publicly.Verify the deployed application
-
Verify that the application configuration, domain, and ingress trait all exist.
$ kubectl get ApplicationConfiguration -n todo-list # Sample output NAME AGE todo-appconf 19h $ kubectl get Domain -n todo-list # Sample output NAME AGE todo-domain 19h $ kubectl get IngressTrait -n todo-list # Sample output NAME AGE todo-domain-trait-7cbd798c96 19h
-
Verify that the WebLogic Administration Server and MySQL pods have been created and are running. Note that this will take several minutes.
$ kubectl get pods -n todo-list # Sample output NAME READY STATUS RESTARTS AGE mysql-5c75c8b7f-vlhck 2/2 Running 0 19h tododomain-adminserver 4/4 Running 0 19h
Undeploy the application
-
To undeploy the application, delete the ToDo List OAM resources.
$ kubectl delete -f https://raw.githubusercontent.com/verrazzano/verrazzano/v1.7.2/examples/todo-list/todo-list-application.yaml -n todo-list $ kubectl delete -f https://raw.githubusercontent.com/verrazzano/verrazzano/v1.7.2/examples/todo-list/todo-list-components.yaml -n todo-list
-
Delete the namespace
todo-list
after the application pods are terminated. The secrets created for the WebLogic domain also will be deleted.$ kubectl delete namespace todo-list
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.