Closed js1972 closed 4 years ago
Hi @js1972,
I've tried a deployment to CF and found that when you first run cds add hana
and then cds add mta
followed by mbt build
and cf deploy mta_archives/cpapp_1.0.0.mtar
you get a working deployment.
Best regards Gregor
Thanks @gregorwolf let me try it again in that precise order... In general I'm having a tough time getting any fiori app to deploy and launch for a cap project on CF.
ok. If I simply run cds add hana
(I need to use "hana": { "deploy-format": "hdbtable" }
as my db is HANA Cloud) then cds add mta
, then mbt build
and finally cf deploy mta_archives/cpapp_1.0.0.mtar
...
Without running npm install
first - then it deploys succssfully.
However I am unable to run the fiori apps inside the /app folder.
i.e. this url: https://sap-cp-blahblah-hana-cloud-demo-cpapp-srv.cfapps.eu10.hana.ondemand.com/launchpage.html
just gives the error:
Cannot GET /launchpage.html
If I leave the launchpage.html off I get the standard cds service visualisation:
My understanding was that anything in the /app folder should be served?
This is the missing link in all of SAP's tutorials. We have great tutorials and tooling for working in CAP and deploying to CF. We also have great tutorials with working on fiori apps and deploying them to CF in the html runtime and the new sap cloud managed html5 apps. However we don't have anything that links the two.... If you can point me in the right direction that would be awesome?
Unfortunately the CAP team does currently not include anything regarding the app folder when you run cds add mta
. So you have to help yourself and add the module. Check out my example mta.yaml.
Thanks again @gregorwolf - that example is very handy. I actually just had a realisation...
mta.yaml
file to add in sections for a UI module which uses the provided CAP service. Add an xs-app.json
file for the approuter. It seems I do not need a specific approuter section in the mta.yaml
(CAP must provide one already?!?).
I then had to tear half my hair out fiddling with the file paths in the xs-app.json
before it would work.
Plus add another package.json in the /app folder to for the approuter.But now I have a working CAP project with an embedded fiori elements app working in CF. Yay. It all without ay authentication of course so that's the next hurdle to get over. ;-)
Closing this issue. But would love to chat more about this...
E.g. What is the point of the following in the mta.yaml:
build-parameters:
ignore: ["node_modules/"]
I also use the service.js OData V2 proxy and it seems to work fine with my fiori elements app but I notice you have an explicit section in your mta.yaml for this proxy - why? What benefit?
Hi @js1972 , don't get to confused about my bookshop-demo. I try a lot of additional things. The separate proxy is an example to help when you're running CAP Java and need V2.
A good example how you can use the ui5-tooling is given in the project: SAP4Kids.
The ignore: ["node_modules/"] makes your mtar file significantly smaller. And as SAP CP Cloud Foundry doesn't use the SAP NPM registry anymore (since last Thursday) the build result will be the same when the package-lock.json is included in your mtar.
Best regards Gregor
I have cloned this repo and used
npm install
thennpm start
to run it locally however I'm unable to get it to deploy to CF.I have used
cds add mta
. Thembt build
andcf deploy <archive>
and the deployment fails with these errors:I have since found that it seems to be missing this dependency in the package.json:
"@sap/hana-client": "^2.5.111",
. however after adding this I get all sorts of integrity issues on that package when doing npm install.I have tried to add this to the mta.yaml:
And this does allow npm install locally. However when running a CF deploy on the mta it fails every time with INTEGRITY issues.
Is this sample project simply not setup for use on CF and only for local testing.