You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open a web browser to [Eureka Dashboard](http://localhost:8761) to vew the Eureka Server dashboard web user interface. It will look similar to this. Note that the `ACCOUNT` application you have built has registered with Eureka.
208
208
209
-

209
+

210
210
211
-
## Task 8: Expose the account service using the APISIX API Gateway
212
-
213
-
Now that the account service is deployed, you need to expose it through the API Gateway so that clients will be able to access it. This is done by creating a "route" in APISIX Dashboard.
214
-
215
-
1. Retrieve the admin password for the APISIX API Gateway.
216
-
217
-
Execute the following command to get the password for the `admin` user for the APISIX API Gateway:
The APISIX Dashboard isn't exposed outside the cluster. You need to start a tunnel to be able to access APISIX Dashboard. Start the tunnel using this command in a new terminal window:
Open a web browser to [APISIX Dashboard](http://localhost:8090) to view the APISIX Dashboard web user interface. It will appear similar to the image below.
232
-
233
-
If prompted to login, login with username `admin` and the password you retrieved earlier. Note that Oracle strongly recommends that you change the password, even though this interface is not accessible outside the cluster without a tunnel.
234
-
235
-
Open the **routes** page from the left hand side menu. You will not have any routes yet.
Scroll down to the **Request Basic Define** section. Set the **Path** to `/api/v1/account*`. This tells APISIX API Gateway that any incoming request for that URL path (on any host or just IP address) should use this route. In the **HTTP Method** select `GET`, `POST`, `DELETE`, and `OPTIONS`. The first three you will recall using directly in the implementation of the account service during this lab. User interfaces and other clients will often send an `OPTIONS` request before a "real" request to see if the service exists and check headers and so on, so it is a good practice to allow `OPTIONS` as well.
Click on the **Next** button to move to the **Define API Backend Server** page. On this page you configure where to route requests to. In the **Upstream Type** field, select **Service Discovery**. Then in the **Discovery Type** field, select **Eureka**. In the **Service Name** field enter `ACCOUNT`. This tells APISIX to lookup the service in Spring Eureka Service Registry with the key `ACCOUNT` and route requests to that service using a Round Robin algorithm to distribute requests.
Click on **Next** to go to the **Plugin Config** page. You will not add any plugins right now. You may wish to browse through the list of available plugins on this page. When you are ready, click on **Next** to go to the **Preview** page. Check the details and then click on **Submit** to create the route.
254
-
255
-
When you return to the route list page, you will see your new `account` route in the list now.
In the next two commands, you need to provide the correct IP address for the API Gateway in your backend environment. You can find the IP address using this command, you need the one listed in the **`EXTERNAL-IP`** column:
262
-
263
-
```shell
264
-
$ kubectl -n ingress-nginx get service ingress-nginx-controller
Test the get account endpoint with this command, use the IP address for your API Gateway and the `accountId` that was returned in the previous command:
Your service is deployed in the Oracle Backend for Spring Boot and Microservices environment and using the Oracle Autonomous Database instance associated with the backend.
301
-
302
-
## Learn More
303
-
304
-
* [Oracle Backend for Spring Boot and Microservices](https://bit.ly/oraclespringboot)
Copy file name to clipboardExpand all lines: docs-source/cloudbank/content/account/jpa.md
+34-35Lines changed: 34 additions & 35 deletions
Original file line number
Diff line number
Diff line change
@@ -7,54 +7,53 @@ weight = 6
7
7
8
8
1. Add Spring Data JPA to the Account service and configure it to access the database
9
9
10
-
Spring Data JPA allows our Spring Boot application to easily use the database. It uses simple Java POJOs to represent the data model and provides a lot of out-of-the-box features which means there is a lot less boilerplate code to be written.
11
-
12
-
To add Spring Data JPA and the Oracle Database drivers to your project, open the Maven POM (`pom.xml`) and add these extra dependencies for Spring Data JPA, Oracle Spring Boot Starters for Oracle Database UCP (Universal Connection Pool) and Wallet:
Visual Studio code will display a notification in the bottom right corner and ask if it should update the project based on the change you just made. You should select **Yes** or **Always** to this notification. Doing so will ensure that the auto-completion will have access to the classes in the new dependency that you just added.
Spring Data JPA allows our Spring Boot application to easily use the database. It uses simple Java POJOs to represent the data model and provides a lot of out-of-the-box features which means there is a lot less boilerplate code to be written.
11
+
12
+
To add Spring Data JPA and the Oracle Database drivers to your project, open the Maven POM (`pom.xml`) and add these extra dependencies for Spring Data JPA, Oracle Spring Boot Starters for Oracle Database UCP (Universal Connection Pool) and Wallet:
Visual Studio code will display a notification in the bottom right corner and ask if it should update the project based on the change you just made. You should select **Yes** or **Always** to this notification. Doing so will ensure that the auto-completion will have access to the classes in the new dependency that you just added.
To configure Spring Data JPA access to the database, you will add some configuration information to the Spring Boot application properties (or YAML) file. Access to the database you need to unzip the Wallet and get information from those files.
39
38
40
39
1. Unzip the Wallet you downloaded in the Setup module (Lab 2)
41
40
42
-
```shell
43
-
$ unzip /path/to/wallet/wallet_name.zip
44
-
```
41
+
```shell
42
+
$ unzip /path/to/wallet/wallet_name.zip
43
+
```
45
44
46
45
1. Edit the `sqlnet.ora` file so that the section `(DIRECTORY="?/network/admin")` matches the full path to the directory where you unzipped the Wallet, for example:
1. Get the TNS Entry connection string using this command. Remember the name of the entry as you'll need it in the next steps. In the sample below it is `cbankdb_tp`.
You will find a file called `application.properties` in the `src/main/resources` directory in your project. You can use either properties format or YAML format for this file. In this lab, you will use YAML. Rename the file to `application.yaml` and then add this content to the file. Make sure that you modify the url to contain the path to the wallet and the name of the TNS entry you collected earlier.
0 commit comments