This public repository is read-only and no longer maintained.
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.
-
Install Node.js LTS version 10 from https://nodejs.org/en/download/.
-
Create an SAP Cloud Platform trial account in the region Europe (Frankfurt)
-
Install the Open Service Broker for Azure in your space.
-
Follow this tutorial to install the Cloud Foundry command-line tool.
-
Add the Multi-Target Application Cloud Foundry CLI Plugin.
cf add-plugin-repo CF-Community https://plugins.cloudfoundry.org cf install-plugin multiapps
-
Install make via a package manager...
...for Mac users: This tool should be preinstalled on your machine.
...for Windows users (install chocolatey first).
choco install make
-
Install SQLite3 via a package manager...
...for Mac users (install brew first).
brew install sqlite
...for Windows users (install chocolatey first).
choco install sqlite
- Clone the project.
git clone https://github.com/SAP-samples/cloud-foundry-cap-azure-cities cd cloud-foundry-cap-azure-cities npm install
- Build and deploy the project to the cloud.
npm run deploy:cf
- 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.
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
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.
-
Clone the project.
git clone https://github.com/SAP-samples/cloud-foundry-cap-azure-cities cd cloud-foundry-cap-azure-cities npm install
-
Open the project with VS Code.
code .
-
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/" }
-
Initialize the SQLite database via
npm run deploy:cds
. -
Switch to the debugging view and start the first module in debug mode.
-
Use the spinner control to switch to see all launch options.
-
Launch the following three modules and make sure they are all running.
- Start CDS
- Start Uploader
- Start Approuter
-
Open http://localhost:4006 in your browser.
The project consists of four modules, as shown in the architecture 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.
None so far :)
This content is provided "as-is" with no other support.