Skip to content

Latest commit

 

History

History
76 lines (58 loc) · 4.44 KB

3-InitialDeployment.md

File metadata and controls

76 lines (58 loc) · 4.44 KB

Initial Deployment

To get the app up and running for the first time, you do a first initial deployment. This will create any required service instances which are described in the mta.yaml deployment descriptor file. The following command-line tools are used for that, which you need to install.

  1. Cloud MTA Build Tool (MBT) to build the application (app) and get it ready for deployment
  2. Cloud Foundry CLI (CF CLI). Please also install the multiapps plugin for the cf deploy command to be available.

Double check, whether you have Node installed. The sample is built with Node version 20, so this is the version we recommend here. To manage multiple Node versions you can use NVM. To check your current Node version, run:

node --version

Now onwards to doing the actual deployment.

  1. First, clone the git repository:
git clone https://github.com/SAP-samples/btp-cap-dox-invoice-validation.git

cd btp-cap-dox-invoice-validation 
  1. Install the required packages:
npm install -g @sap/cds-dk typescript ts-node
npm run setup

If you are on Windows, run the win:setup script instead which works in Git BASH. If that does not work either, navigate into the subfolders manually and invoke the parts of the script, e.g. npm install one by one.

  1. Then, login to your subaccount and space with:
cf login
  1. In the xs-security.json file, adjust the allowed redirect URI within oauth2-configuration to the region of your subaccount. Say it is in the eu10-004 region, then replace the eu10 part with eu10-004.

  2. Enter your BTP subaccount user name in dox-Invoices.csv, dox-FlowStatuses.csv, dox-Projects_Users.csv where you see the placeholders. This makes it so that you are set as the current validator for one of the invoices after deployment.

  3. Next, issue the following command (while being at root level of your project directory) to build and deploy the whole app at once to your subaccount:

npm run deploy

Make sure a HANA CLOUD instance is mapped to your BTP space, so that there is a database available.

  1. Within the BTP Cockpit inside your subaccount, create a role collection DOX_Mission_Administrator and add the Administrator role to it; then assign yourself to the collection. (The role was precreated during the deployment and you will find it in the roles list under Security in your subaccount, if you filter by mission.)

  2. Last but not least, the app needs a destination to connect to the DOX service. First, create a service key for the DOX service instance which was created during deployment. To then create the destination, log in to your SAP BTP cockpit and navigate to your subaccount. In the navigation area therein, go to Connectivity -> Destinations and select Create Destination. The name of the destination needs to be precisely DOX_PREMIUM_INVOICE_VALIDATION, this is what the app is going to look for. Configure the destination as shown below and enter the credentials provided in the service key.

Name: DOX_PREMIUM_INVOICE_VALIDATION
Description: Connection to Document Information Extraction (DOX) service
URL: <URL-PROPERTY-IN-DOX-SERVICE-KEY>/document-information-extraction/v1 # make sure to add /v1!
Type: HTTP
ProxyType: Internet
Authentication: OAuth2ClientCredentials
tokenServiceURL: <AUTH-URL-IN-DOX-SERVICE-KEY>/oauth/token
clientId: <CLIENT-ID-IN-DOX-SERVICE-KEY>
clientSecret: <CLIENT-SECRET-IN-DOX-SERVICE-KEY>
# Additional Properties:
URL.headers.Content-Type: application/json
HTML5.DynamicDestination: true

If the deployment ran through successfully, you can open up the frontend part of the app in your browser under applications in your BTP space, by clicking first on dox-invoice-validation and then on the shown link. As an admin (see step 5 above) head over to the Admin Dashboard to add new users (on the application level) to a project and to set their roles.

Admin Dashboard

Note that new users must also be added to the BTP Space to access the app.