SAP-samples / cloud-espm-multi-environment

This sample application demonstrates how to build applications on SAP Business Technology Platform (BTP) with the Java runtime. This version showcases how to adapt an ESPM application developed to run on SAP BTP Neo Environment to run on SAP BTP, Cloud Foundry environment.
Apache License 2.0
1 stars 8 forks source link
cloud-foundry espm neo-environment sample sample-code sap-btp sap-btp-cloud-foundry sap-cloud-platform

REUSE status

ESPM

The ESPM (Enterprise Sales & Procurement Model) application is a reference application which demonstrates how to build applications on SAP Business Technology Platform (BTP) with the Java runtime. This version of the ESPM application(cloud-espm-multi-environment) showcases how to adapt a ESPM application developed to run on SAP BTP Neo Environment to run on SAP BTP Cloud Foundry (CF) Environment as well. The adapted application has one code-base for running on both Neo and CF environment.

Description

Business Scenario

The business scenario is that of an eCommerce application that sells electronics products.

ESPM application has 2 underlying applications

Architecture Diagram

Requirements

For Setting up the development environment, refer to the quick start guide

Download and Installation

Build the application

A maven build of the application generates a separate war file for the Neo and CF environment.

Note: Follow the below steps before the maven build to download the ngdbc driver to your local ~.m2 repository, as its not available in central maven repository

  1. Download the SAP Business Technology Platform SDK from https://tools.hana.ondemand.com/#cloud

  2. Take the latest version of "Java Web Tomcat 8" (neo-java-web-sdk-3.70.9.3 or higher) from the download section.

  3. Unzip the archive to an arbitrary location on your laptop/desktop.

  4. Extract the JDBC driver (ngdbc.jar) from the archive (you will find the driver in the archive under: repository/.archive/lib/ngdbc.jar). The driver is closed source, so it is NOT available from public Maven repositories!

  5. Put the driver to your local maven repository with maven command

    mvn install:install-file -Dfile=<path-to-file> -DgroupId=com.sap.db.jdbc
      -DartifactId=ngdbc -Dversion=2.0.13 -Dpackaging=jar
  6. From the root directory (i.e. cloud-espm-multi-environment), run the following Maven command

    mvn clean install
    

This command builds the application and generates war for the Neo and CF environment.

Running the application in NEO environment

1. Deploy application

The war file for the NEO environment can be found at neo/espm-cloud-web-neo/target/espm-cloud-web-neo.war .

Open the hanatrial account cockpit and upload the war file as follows.

2. Configure Roles

3. Bind the database to espm application and start espm application

Below is the process to bind the database to the java application in BTP trial account using a Shared HANA database

Running the application in CF environment

From root folder, navigate to cf folder.

1. Login to Cloud Foundry

cf api <api>
cf login -o <org> -s <space>

2. Create Service

Depending on the requirement, create a service instance for either of the database (HANA or PostgreSQL).

cf create-service hana schema espm-hana (HANA)
or
cf create-service postgresql v9.4-dev espm-postgres (PostgreSQL)

Create service instance for the XSUAA

cf cs xsuaa application espm-uaa -c xs-security.json

3. Edit Manifest

Open the manifest.yml file and edit the following Replace placeholders with your I/D/C numbers so that the application name and host name is unique in the CF landscape.

DATABASE_TYPE: <DB name>

Replace the <DB name> with the Database name for which you have created the service instance

For HANA – hana

For PostgreSQL – postgresql

<DB instance name>

Replace the <DB instance name> with the service instance that you have created for the database.

4. Push the application

cf push -f manifest.yml

5. Setup Role collections

For the application to work, the Retailer application needs the template role called "Retailer" assigned to the user.

6. Assign Role to the user

We need to assign the role which we have created in the previous step to the user.

Out of Scope

Document services is out of scope currently in Cloud Foundry application

Known issues

None

Support

Please use GitHub issues for any bugs to be reported.

License

Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.