Skip to Content
Technical Articles

Deploy the Entity Relationship generator for SAP Ariba Analytical Reporting API application to the SAP BTP, Kyma runtime environment

In a previous blog post, I covered how we can generate an Entity-Relationship (ER) diagram from the metadata returned by the SAP Ariba Analytical Reporting API. In this blog post, I will show how the application, with minor enhancements, can be deployed to the SAP BTP, Kyma runtime environment.

The code and deployment instructions below can be found in the SAP Ariba Extensibility samples repository – https://github.com/SAP-samples/ariba-extensibility-samples/tree/main/topics/apis/er-generator/kyma

Prerequisites:

  • Clone the SAP Ariba extensibility samples repository.
$ git clone git@github.com:SAP-samples/ariba-extensibility-samples.git

# If you've cloned it before, make sure to pull the latest changes
$ git pull origin main

Below, the steps that we will follow to deploy the application to the SAP BTP, Kyma runtime environment:

  • Create a docker image
  • Push the docker image to a private registry
  • Create secret in Kyma with the private docker registry credentials
  • Deploy the application to the SAP BTP, Kyma runtime environment

Step 1 – Create a docker image

A Dockerfile is now included in the er-generator folder. You can build the docker image and communicate with the program via your browser.

# Navigate to the er-generator folder
$ cd ariba-extensibility-samples/topics/apis/er-generator

# Build docker image
$ docker build --tag er-generator .

# Run docker image
$ docker run -p 8080:5000 er-generator

Once the docker container is running, you can call the program from your web browser

Docker%20image%20running%20locally

Docker image running locally

Step 2 – Push the docker image to a private registry

Before deploying our application to tthe SAP BTP, Kyma runtime environment, we will need to host the image in a private repository. To do that we will login to the private repo locally, tag the image previously created with the private repo details and then push it.

# Login to private repo locally
$ docker login --username user registry.mycompany.com

# Tag previously created image with repo
$ docker tag [IMAGE_ID] registry.mycompany.com/ariba-reporting-er-generator

# Push to private repo
$ docker push registry.mycompany.com/ariba-reporting-er-generator

In the script above I’m using the registry.mycompany.com value to represent the address of a private docker registry. You will need to replace this value with the address of your private registry. In my case, I self-host a docker registry in my home server, which has access from the internet and I’m pushing the docker image there.

Step 3 – Create secret in Kyma with the private docker registry credentials

To allow communication from our SAP BTP, Kyma runtime environment to the private docker registry, we will create a secret in Kubernetes. This secret will be specified in the deployment yaml (L24-25) to know the secret used to pull the image.

# Create secret to login to the private repository
$ kubectl create secret docker-registry docker-registry-secret --docker-server=registry.mycompany.com --docker-username=user --docker-password=StrongP4$sw0rd1 --docker-email=first.last@mycompany.com --namespace=default

In the command above we specify the following:

  • Private docker registry address
  • Username and password
  • Email address
  • Namespace where the secret will be deployed to

Step 4 – Deploy the application to the SAP BTP, Kyma runtime environment

The kyma folder included in the er-generator includes the yaml files need to deploy the application. We need to rename the remove the .sample extension from the files and replace the registry.mycompany.com value (L21) in the deployment.yml file with the address of our private docker registry.

Now we are able to deploy the docker image to the SAP BTP, Kyma runtime environment.

# Apply deployment, service and API rule
$ kubectl apply -f kyma/deployment.yml
$ kubectl apply -f kyma/service.yml
$ kubectl apply -f kyma/api-rule.yml

Once deployed we can check the components in the SAP BTP, Kyma runtime environment.

Kyma%20-%20Deployment%20and%20Pod

Kyma – Deployment and Pod

 

Kyma%20-%20API%20Rule

Kyma – API Rule deployed

Once the deployment is successful, you can call the program from your web browser

Kyma%20-%20Diagram%20generated%20for%20document%20type

Kyma – Diagram generated for document type

I hope this blog post helps you get initiated with deploying applications to SAP BTP, Kyma runtime. In the end, if you are familiar with Docker and Kubernetes, it will be simple for you to deploy and expose your applications to the SAP BTP, Kyma runtime environment.

Be the first to leave a comment
You must be Logged on to comment or reply to a post.