Welcome to the Fifth Episode of the Series:
Hello World OpenAI: Crafting Accurate ChatGPT-Like Custom Search for SAPUI5 Application. Till now we installed IDE, set up the environment, created a Secret Key for our OpenAI Account, tested the same using Postman, and created a NodeJs-based API Service for BTP-CF & successfully tested the same. So, in this episode, we will deploy this Microservice to SAP BTP Cloud Foundry.
![](/legacyfs/online/storage/blog_attachments/2023/08/logbtpcfnjs.png)
You can check all the existing & upcoming blog posts of this series via the introduction blog post available below link-
Click here
Prerequisites
- You already have a SAP BTP Trial Account.[If not check the Introduction Blog for Links]
- I am assuming that you have a Trial Account Setup for OpenAI and have created your Secret Key in the previous episode.
- You have NodeJS & VS Code installed as shared in an earlier episode.
- You have created the NodeJS-based API Service shared in the last episode[Link].
- You have CF-CLI installed. [If not check the Setup Episode for Links]
Manifest File
We have all the code ready, written in the last episode[Link]. We will first need to create a Manifest File, a configuration file required for Deployment on SAP BTP-CF(Cloud Foundry).
Step 1: Create a New File: manifest.yml.
![](/legacyfs/online/storage/blog_attachments/2023/08/mmnf2.png)
Step 2: Copy-paste the below snippet intoManifest.yml.
---
applications:
- name: openaiapi
path: .
buildpack: nodejs_buildpack
memory: 256M
Note: name is the App name, and memory is the Size of the Application. (Allocated Memory)
Time to Deploy
Step 1: Open your SAP BTP Trail Account & open SubAccount
![](/legacyfs/online/storage/blog_attachments/2023/08/subb.png)
Step 2: Note down the API URL.
![](/legacyfs/online/storage/blog_attachments/2023/08/cfapi-1.png)
Step 3: Open the VS Code terminal, type cf api [cf API endpoint] and press enter.
cf api https://api.cf.us10-001.hana.ondemand.com
![](/legacyfs/online/storage/blog_attachments/2023/08/cfaapi1.png)
Step 3: Open the terminal, type cf login, and enter.
cf login
Enter Email-Password and you will be logged in.
![](/legacyfs/online/storage/blog_attachments/2023/08/cfloffin.png)
Step 4: Open data.json & clear this file (Delete the highlighted data for fresh deployment).
![](/legacyfs/online/storage/blog_attachments/2023/08/clear.png)
Step 5: Open the terminal, type cf push, and enter.
cf push
And the deployment will start.
![](/legacyfs/online/storage/blog_attachments/2023/08/cf-push.png)
We will finally end up with this.
![](/legacyfs/online/storage/blog_attachments/2023/08/depload.png)
This will show the Route/URL of the deployed microservice, its current state & other information. Congratulations, you have successfully deployed our NodeJss API Microservice.
Test our Deployed Service
We can test our service in Postman. Copy-paste the route/URL, choose GET Call, add the Auth, and click send. You should get Status 200 & Welcome Message. Congratulations we have our service up & running.
![](/legacyfs/online/storage/blog_attachments/2023/08/testdep-1.png)
Let’s Summarize
We created our Manifest File for our Microservice & deployed it on BTP Cloud Foundry. Further, we tested the same using the Postman Tool. That’s all for this episode, will meet you guys in Episode 6.
Next Episode : Epidosde 6