SAP-archive / cloud-foundry-cap-azure-cities

Reference application built according to the SAP Cloud Application Programming Model. It uses an SAP HANA database for structured data, an Azure storage account for unstructured data, and SAP Fiori Elements for the user interface.
Apache License 2.0
18 stars 32 forks source link
azure cloud-foundry fiori-elements sample sample-code sap-cap sap-fiori sap-hana

Important Notice

This public repository is read-only and no longer maintained.

SAP Cloud Application Programming Model + Azure Blob Storage Sample

Build Status Dependency Status REUSE status

Description

This is a sample application that can be used as a reference for the SAP Cloud Application Programming Model for SAP Cloud Platform. Besides CDS tooling, this application contains a SAP Fiori Elements user interface and an additional microservice which stores images in Azure blob storage.

The application exposes a list of sample entities which represent cities. Each entity contains several properties, like name, region and an image. The user can navigate to a Fiori Object Page and replace the default image with a newly uploaded file. This file will be stored in an Azure storage account and the URL that references the image will then be stored in a table on HANA.

Demo

Requirements

Download and Installation

Cloud Deployment

  1. Clone the project.
    git clone https://github.com/SAP-samples/cloud-foundry-cap-azure-cities
    cd cloud-foundry-cap-azure-cities
    npm install
  2. Build and deploy the project to the cloud.
    npm run deploy:cf
  3. Wait until the process completed and look for the output line which references the URL of the started app router. Open the displayed URL in a browser. INSERT

Alternativly, you can also just deploy selected modules and skip services by using partial deployments:

cf deploy mta_archives/city-explorer-demo-app.mtar \
    -m city-cap-router \
    -m city-cap-db \
    -m  city-cap-srv \
    -r city-hdi-container​

Local Development

This project consists of several microservices. For local development, each one can be started independently. We recommend using VS code as the project comes with support for the VS Code debugger.

  1. Clone the project.
    git clone https://github.com/SAP-samples/cloud-foundry-cap-azure-cities
    cd cloud-foundry-cap-azure-cities
    npm install
  2. Open the project with VS Code.
    code .
  3. Add a db/credentials.json file which contains the credentials for the Azure storage account you want to use. The file should contain the following information.
    {
        "storageAccountName": "",
        "accessKey": "",
        "primaryBlobServiceEndPoint": "https://<ENDPOINT>.blob.core.windows.net/"
    }
  4. Initialize the SQLite database via npm run deploy:cds.
  5. Switch to the debugging view and start the first module in debug mode. switch view
  6. Use the spinner control to switch to see all launch options. change launch options
  7. Launch the following three modules and make sure they are all running.

    • Start CDS
    • Start Uploader
    • Start Approuter

    all modules running

  8. Open http://localhost:4006 in your browser.

    started

Architecture

The project consists of four modules, as shown in the architecture diagram: Diagram

Database module
A Cloud Foundry tasks that will run once to set up the schema in the HDI container and to import the sample data. Once these steps are completed, the app will shut down and stop consuming memory and CPU quota.
Server module
Connects to the HDI container and exposes the annotated OData service via HTTP
Uploader module
Service to upload files to the Azure storage account that return the URL to access the created resource.
Application router module
The entry point of the application which redirects all incoming traffic to the previous two modules. This module also contains the Fiori Elements user interface.

The project descriptor file also defines the backing services of the project. In this case, the SAP HANA service, for structured data, and an Azure storage account, for unstructured data.

Known Issues

None so far :)

How to obtain support

This content is provided "as-is" with no other support.