Welcome back to the blog miniseries on how to provision a Node API Gateway in the new Oracle Cloud Infrastructure. This is the last part, part 3, which focuses on the installation process and testing the Node API Gateway. Before going through all details listed below, make sure you followed and completed all the prerequisites that are described in part 1 and part 2 of this miniseries. The Node API Gateway is mandatory in order to successfully deploy & run APIs on the Oracle API Platform Cloud Service.
Now that all the prerequisites have been met, you are good to go with the installation of the Node API Gateway. Before you start please make sure you have the following available:
ps -a |grep java
kill -9 PID
If all of these are checked please proceed with running the command, you previously copied from the API Platform Cloud Service instance in your folder where you have the Gateway Installer unpacked:
./APIGateway -f gateway-props.json -a install-configure-start-join
The first information you are asked to give is Weblogic username. You can input the username of your choice – for this example, I chose “weblogic1”.
Then you are asked for the password of this username. The username and password are brand new and you will not be prompted to re-enter the password, so make sure to choose a relatively easy password. Also, the password should be 8 to 30 bytes long, and be case sensitive, be started with [a-zA-Z] and followed with alphanumeric characters or '_' or '$' or '#'.
Then the installer is going to cleanup any existing gateway installations. Because this is a brand-new installation, just type “y” and press Enter to continue
The Installation process begins. At this moment, the components of the Node API Gateway are being installed. After that, it will start the necessary services that are used one-by-one. In this stage you can see the message “Wait for the service to start”. Be patient as this may take a couple of minutes.
After all the necessary services have been started, you will start to use the notepad with the information gathered. You are prompted to enter the Gateway Manager user – the username of your choice (the current or the one you have configured especially for your Oracle API Platform Cloud Service instance – make sure you have the roles provided)
Then you have to enter the password for this user.
After this, you will have to enter the Gateway Runtime Client ID – which is the Client ID you already copied.
Then you will have to enter the Gateway Runtime Client Secret – which is the Client Secret you already copied.
Then you are prompted to enter the Gateway Runtime user – which is the username of your choice (the current or the one you have configured especially for your Oracle API Platform Cloud Service instance – make sure you have the roles provided).
Then you have to enter the password for this user.
If you followed through so far and all of the information you entered was correct, then the installation of the Node API Gateway was successful and you should see the following screen:
So far you have installed the Node API Gateway on the VM from OCI. Now, you have to register it within your Oracle API Platform Cloud Service instance. For this, you have to login into your Management Gateway and Click on “Gateways” option from the far left. Select your previously created Logical Gateway by clicking on the name (in this case, it is named “Development Gateway”).
Go to the “Nodes” option on your immediate left and choose the “Requesting” option. As you can probably see, it already has a request. By hovering with the mouse on the name of the node (in this case, it is named “Development Gateway Node 1”), you can see 3 options: Approve, Reject and Dismiss. Choose to Approve the Node to successfully register it to your instance.
Enter a confirmation if needed and click on the Yes blue button.
Now the Node API Gateway should be moved in “Active” state.
Optionally, you can configure the polling interval (by default it’s 2 minutes) – which means after what period of time will the Node API Gateway ask your Oracle API Platform Cloud Service instance for updates. By hovering with the mouse over the polling interval, you can see that it turns light blue, meaning you can click on it and change it. In this example, I am going to change to “10 seconds”. Finish by clicking the Save white button on top of the page.
Go to apiary.io, create an account if do not have one yet and create a New API Project. Give it a name (in this case, it is “Demo Service”). Just use the example generated by the platform.
In the left part of the screen you can see more details, scroll down and click on List All Questions option from Questions Collection. In the new screen, choose Mock Server instead of Production and click on the Try button and then on the Call Resource green button. You should see that the call was successful and you received a response. Just copy the URL with GET in front.
At the moment you have an API mock that you can use in your Oracle API Platform Cloud Service instance. Login into the Management Portal of your instance and choose the “APIs” option from the far left. Click on the Create white button or, if do not have any APIs yet, you can click on the Create API blue button as well.
A new pop-up screen will appear in which you have to provide a Name, Version and, optionally, a Description of the API. In this example I am going to use “Demo API” as Name with Version “1”. Finish by clicking Create blue button.
Now, click on the name of the API. In the new screen, go to the “API Implementation” option on the immediate left. You can see an “API Request” and Service Request. First, click on the “API Request” and then click on Edit green button.
In the new pop-up screen, just specify the “API Endpoint URL” (in this case, the value is “demoapi”) and click Apply button.
Next, using the same methodology as for “API Request”, click on “Service Request” and then click on Edit green button. In this new pop-up screen, select the option Enter a URL under “Service” and copy & paste the URL value that you previously saved from Apiary. Finish by clicking Apply blue button.
Finish by clicking Save white button on top of the screen.
Now go to “Deployments” option on the immediate left. Click on the Deploy API blue button or, if do not have deployed any APIs yet, you can click on the Deploy API blue button on the lower part of the screen as well.
In the new pop-up screen, thick the “Development Gateway” option. It has an active Node API Gateway that you just installed and registered. Finish by clicking Deploy blue button.
Depending on the polling interval, The API will be moved from “Waiting” state to “Deployed” state. When the API has been deployed, expand by click on the arrow facing down and, in front of the “1 Deployed:” option use the copy function to save the URL for calling the API.
Install and open Postman on your local machine. Create a new “Get” Request and paste in the previously saved API URL from your Oracle API Platform Cloud Service. Click on Send blue button. Your call should be successful and you should have the same answer as the one from Apiary.
CONGRATULATIONS! By following through this blog miniseries, you have successfully provisioned, registered and tested a Node API Gateway on a VM from the new Oracle Cloud Infrastructure.