Skip to content

Commit da628ab

Browse files
committed
added markdown/images
1 parent 6b55631 commit da628ab

22 files changed

+120
-49
lines changed

mtdrworkshop/backend/backend.md

Lines changed: 54 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -66,37 +66,46 @@ The backend is implemented using the following Java classes (under ./backend/src
6666
1. Run the `deploy.sh` script
6767
6868
```
69-
<copy>cd $MTDRWORKSHOP_LOCATION/backend; ./deploy.sh</copy>
69+
<copy>
70+
cd $MTDRWORKSHOP_LOCATION/backend
71+
./deploy.sh
72+
</copy>
7073
```
7174
72-
--> service/todolistapp-helidon-se-service created
73-
--> deployment.apps/todolistapp-helidon-se-deployment created
75+
If everything runs correctly the script will output something like this.
76+
77+
![](psong_images/deploy_output.png)
78+
7479
7580
2. Check the status using the following commands
76-
$ kubectl get services
7781
7882
The following command returns the Kubernetes service of MyToDo application with a load balancer exposed through an external API
7983
```
80-
<copy>kubectl get services</copy>
84+
<copy>services</copy>
8185
```
86+
This will run `kubectl get services` in the background, but the setup script creates aliases for ease of use
8287
83-
![](images/K8-service-Ext-IP.png " ")
88+
![](psong_images/get_services.png)
8489
85-
3. $ kubectl get pods
90+
3. The following command returns all the pods running in your kubernetes cluster:
8691
```
87-
<copy>kubectl get pods</copy>
92+
<copy>pods</copy>
8893
```
94+
This will run `kubectl get pods` in the background, but the setup script creates aliases for ease of use
95+
![](psong_images/get_pods.png)
8996
90-
![](images/k8-pods.png " ")
97+
5. You can tail the log of one of the pods by running:
9198
92-
5. Continuously tailing the log of one of the pods
99+
```
100+
kubectl -n mtdrworkshop logs -f <pod name>
101+
```
93102
94103
$ kubectl logs -f <pod name>
95-
Example kubectl lgs -f todolistapp-helidon-se-deployment-7fd6dcb778-c9dbv
104+
Example: `kubectl -n mtdrworkshop logs -f todolistapp-helidon-se-deployment-7fd6dcb778-c9dbv`
96105
97-
Returns:
98-
http://130.61.66.27/todolist
106+
![](psong_images/pod_logs.png)
99107
108+
If the logs return `webserver is up!` then you have done everything correctly.
100109
## **STEP 4**: UnDeploy (optional)
101110
102111
If you make changes to the image, you need to delete the service and the pods by running undeploy.sh then redo Steps 2 & 3.
@@ -113,57 +122,61 @@ The following command returns the Kubernetes service of MyToDo application with
113122
The API Gateway protects any RESTful service running on Container Engine for Kubernetes, Compute, or other endpoints through policy enforcement, metrics and logging.
114123
Rather than exposing the Helidon service directly, we will use the API Gateway to define cross-origin resource sharing (CORS).
115124
116-
1. From the hamburger menu navigate **Developer Services** > **API Management > Create Gateway**
117-
![](images/API-Gateway-menu.png " ")
118-
119-
2. Configure the basic info: name, compartment, VCN and Subnet
120-
- VCN: pick on of the vitual circuit network
121-
- Subnet pick the public subnet
122-
The click "Create"
123-
![](images/Basic-gateway.png " ")
125+
The setup script already creates an API gateway, but you still need to create the deployments in the api gateway.
124126
125-
3. Click on Todolist gateway
126-
![](images/Gateway.png " ")
127+
1. From the hamburger menu navigate **Developer Services** > **API Management > Create Gateway**
128+
![](psong_images/api_gateway_navigate.png)
127129
128-
4. Click on Deployments
129-
![](images/Deployment-menu.png " ")
130+
2. Click on the todolist gateway that has been created for you
131+
![](psong_images/select_gateway.png)
130132
131-
5. Create a todolist deployment
132-
![](images/Deployment.png " ")
133+
3. Create a todolist deployment by clicking create deployment
134+
![](psong_images/create_deployment.png)
133135
136+
4. Fill out the basic information like so:
134137
135-
6. Configure Cross-origin resource sharing (CORS) policies.
138+
![](psong_images/basic_information_deployment.png)
139+
5. Configure Cross-origin resource sharing (CORS) policies.
136140
- CORS is a security mechanism that will prevent running application loaded from origin A from using resources from another origin B.
137141
- Allowed Origins: is the list of all servers (origins) that are allowed to access the API deployment typically your Kubernetes cluster IP.
142+
- Replace the `.us-phoenix-1` portion with whichever region you replaced with in task 1.
143+
- Replace the 3rd IP address with the external IP address of your Load Balancer
138144
- Allowed methods: GET, PUT, DELETE, POST, OPTIONS are all needed.
139-
![](images/Origins-Methods.png " ")
140145
141-
7. Configure the Headers
142-
![](images/Headers.png " ")
146+
To configure CORS, scroll down and click add next to CORS and fill in this information under allowed origins
143147
144-
8. Configure the routes: we will define two routes:
145-
- /todolist for the first two APIs: GET, POST and OPTIONS
146-
![](images/Route-1.png " ")
148+
![](psong_images/cors_information.png)
147149
148-
- /todolist/{id} for the remaining three APIs: (GET, PUT and DELETE)
149-
![](images/Route-2.png " ")
150+
6. Configure the Headers
151+
152+
![](images/Headers.png)
153+
154+
7. Configure the routes: we will define two routes:
155+
- /todolist for the first two APIs: GET, POST and OPTIONS
156+
157+
![](psong_images/route_1.png)
158+
159+
- /todolist/{id} for the remaining three APIs: (GET, PUT and DELETE)
160+
161+
![](psong_images/route_2.png)
150162
151163
152164
## **STEP 6**: Testing the backend application through the API Gateway
153165
154166
1. Navigate to the newly create Gateway Deployment Detail an copy the endpoint
155-
![](images/Gateway-endpoint.png " ")
167+
![](psong_images/copy_endpoint.png " ")
156168
157169
2. Testing through the API Gateway endpoint
158170
postfix the gateway endpoint with "/todolist" as shown in the image below
159-
![](images/Backend-Testing.png " ")
160171
161-
It should display the Todo Item(s) in the TodoItem table. At least the row you have created in Part I.
172+
![](psong_images/endpoint_successful.png " ")
173+
174+
It should display the Todo Item(s) in the TodoItem table that was created during the setup.
162175
163176
Congratulations, you have completed lab 2; you may now [proceed to the next lab](#next).
164177
165178
## Acknowledgements
166179
167-
* **Author** - - Kuassi Mensah, Dir. Product Management, Java Database Access
180+
* **Author** - - Kuassi Mensah, Dir. Product Management, Java Database Access, Peter Song Developer Advocate JDBC
168181
* **Contributors** - Jean de Lavarene, Sr. Director of Development, JDBC/UCP
169-
* **Last Updated By/Date** - Kuassi Mensah, Database Product Management, April 2021
182+
* **Last Updated By/Date** - Peter Song Developer Advocate February 2022
177 KB
Loading
66.3 KB
Loading
135 KB
Loading
157 KB
Loading
74.8 KB
Loading
17.3 KB
Loading
60.9 KB
Loading
56.1 KB
Loading
19.5 KB
Loading

0 commit comments

Comments
 (0)