Use the HTML5 application deployer module to deploy the content of the HTML5 applications to the HTML5 Application Repository.
-
cf CLIis installed locally, see Download and Install the Cloud Foundry Command Line Interface. -
The multi-target application (MTA) plug-in for the Cloud Foundry command line interface to deploy MTAs is installed locally. For more information, see Install the MultiApps CLI Plugin in the Cloud Foundry Environment.
It is not recommended to use the HTML5 application deployer to deploy application content that is larger than 10 MB.
For larger application content, please use the Generic Application Content Deployer (GACD) or configure the asynchronous content upload.
The HTML5 application deployer is available on npmjs.com (NPM), see @sap/html5-app-deployer.
You can deploy your content to the HTML5 Application Repository using the HTML5 application deployer npm module.
-
Add the
html5-app-deployermodule as a dependency to yourpackage.jsonfile. To do so, navigate to yourpackage.jsonfile and executenpm installto download thehtml5-app-deployer modulefrom the SAP npm registry.The basic
package.jsonfile should look similar to the following example:{ "name": "myAppDeployer", "engines": { "node": ">=6.0.0" }, "dependencies": { "@sap/html5-app-deployer": "2.0.1" }, "scripts": { "start": "node node_modules/@sap/html5-app-deployer/index.js" } }The
startscript is mandatory as it is executed after the deployment of the application. -
In the
html5-app-deployerstructure, create aresourcesfolder and add the static content that you want to deploy. In theresourcesfolder, add one folder for each application you want to deploy. For each application you want to deploy, provide amanifest.jsonandxs-app.jsonfile at root level.If you want to deploy more than one application to the same app host instance, you can add multiple zip archives to the resources folder.
myAppsDeployer + node_modules - resources - app1 index.html manifest.json xs-app.json - app2 ... package.json manifest.yaml-
The
manifest.jsonfile containssap.app.idandsap.app.applicationVersion.version, which are used in the HTML5 Application Repository asapplicationNameandapplicationVersion.The format of the application version is
xx.xx.xx.manifest.json { "_version": "1.7.0", "sap.app": { "id": "app1", "type": "application", "i18n": "i18n/i18n.properties", "applicationVersion": { "version": "1.0.0" } } } -
The
xs-app.jsonfile is used to support application routing.xs-app.json { "welcomeFile": "index.html", "authenticationMethod": "route", "routes": [ { "source": "^/be$", "destination": "simpleui_be", "authenticationType": "xsuaa" }, { "source": "^/ui(/.*)", "target": "$1", "service": "html5-apps-repo-rt", "authenticationType": "xsuaa" } ] }
-
-
Create an
mta.yaml(MTA development descriptor) file:-
Under
resources, add a resource definition to create anhtml5-apps-reposervice instance of the app-host service plan. -
Under
modules, add your app. -
Add a dependency to the
html5-apps-reposervice and the app-host service plan instance using the required statement.
ID: html5.repo.deployer.myHTML5App _schema-version: '2.0' version: 0.0.3 modules: - name: myHTML5App_app-deployer type: com.sap.html5.application-content path: deployer/ requires: - name: myHTML5App_app-host resources: - name: myHTML5App_app-host //Resource name type: org.cloudfoundry.managed-service parameters: service: html5-apps-repo //Service name service-plan: app-host //Service plan service-name: myHTML5App_app-host //Service instance nameFor a general description of MTA descriptors, see Multitarget Applications in the Cloud Foundry Environment.
-
-
Build and deploy the mta.yaml (MTA development descriptor).
For more information about the build and deployment of MTA descriptors, see Multitarget Applications in the Cloud Foundry Environment.
The deployment starts the following:
-
Create an HTML5 Application Repository service instance of the
app-hostservice plan. -
Create an HTML5 application deployer application, which uses the HTML5 application deployer npm module.
-
Bind the
app-hostservice instance to the HTML5 application deployer application. -
Start the HTML5 application deployer application:
-
Create a zip archive for each application in resources folder.
-
Create a client credential token from the
app-hostservice instance credentials. -
Deploy the content to the HTML5 application repository: passing on the zip archives and the client credential token.
-
-
Stop the HTML5 application deployer application.
-