Deploy multiple spartacus storefronts? - sap-commerce-cloud

Is it possible to deploy multiple spartacus angular projects on Commerce Cloud?
I have two Spartacus project and want them both accessible to users. However currently they are deployed to the root and the second one overwrites the first.

This SAP support article has the answers: https://help.sap.com/docs/SAP_COMMERCE_CLOUD_PUBLIC_CLOUD/b2f400d4c0414461a4bb7e115dccd779/1c26045800fa4f85a9d49e5a614e5c22.html?version=v2105
You just need to make sure that you match the manifest.json app name with the output in angular.json outputPath, then you can set the routing in CCV2 by setting properties as followed:
Configure all endpoints to point to the JS Storefront service.
www.brand1.com → Javascript Storefront
www.brand2.com → Javascript Storefront
Configure endpoint-to-storefront mapping in JavaScript storefront service properties.
In the Cloud Portal, choose your environment, then select Service Configuration View configurations JavaScript storefront.
Add your properties in the following format: jsapps..severname.=.
For example:
jsapps.app1.servername.1=www.brand1.de
jsapps.app2.servername.0=www.brand2.com

Related

Custom angular app for custom spartacus storefront

Our requirement is to use multiple angular apps, 1 for ootb spartacus storefronts and 1 for custom site. By following this github link we had created new app at below location. and updated manifest.json, to build 2 angular apps in CCV2. but the deployment was failed. Can you please suggest steps to fulfill this requirement.

Opening a web app page using View Definition

In my managed application deployment I deploy an App Service Web app.
Is it possible to use viewDefinition.json to create an Overview Command Action that will open the deployed site in a new tab or link me to that deployed site?
No, frustratingly, it is not. viewDefinition.json artifacts do not allow you to read in any sort of dynamic variable from the deployment, which would be necessary for something like this.

Azure endpointName.azureedge.net error

Azure endpointName.azureedge.net created successfully but while accessing Endpoint url it show error
You do not have permission to view this directory or page.
Did I need to add Custom domain to work it out.
Please guide me.
Which endpoint do you add in Azure CDN profile? If adding Azure web app as its endpoint, which language do you use to develop your web app? From my experience, Please try to input detailed path in your url, for example https://endpointName.azureedge.net/default. We can also set default page at Azure web app Application settings like below screenshot:
Build your solution in release mode
Try to publish it with using publish option of project then check

How to enable Swagger UI in Azure Easy API

I'm using Azure App Services and have setup the Easy API with Easy Table for the API backend for my mobile.
I was wondering how can I setup the Swagger UI for the Azure App Service.
When I try to navigate to the API (e.g. https://xxxxxx.azurewebsites.net/swagger/ui), it is stated that "To access the swagger UI, you must enable swagger support by adding swagger: true to your configuration and installing the swagger-ui npm module"
How do you exactly add the swagger-ui npm when you don't have the source to the API (it's created automatically using Easy API) ?
Two parts to your question:
1) Enabling Swagger on EasyAPI is not possible right now. That is to say, we don't merge nor generate the Swagger for EasyAPI as all the parameters are defined in code.
2) If you want to enable Swagger, then you need to add 'swagger: true' to the initializer for Azure Mobile Apps in the app.js file at the level above your API. Go into Easy API or Easy Tables and edit any API/Table. This will bring up the editor. Go to the directory above (the one that contains the api and tables directories) and edit the app.js file there.
Steps:
On Portal Azure
Open your-application App Service
Go to Development Tools -> App Service Editor (Preview) - click GO
Inside App Service Editor (Preview) -> Open Console ( CTRL + Shift + C )
Type npm install --save swagger-ui
Waiting install
Check install if exists folder on node_modules -> swagger-ui
Now enable swagger on application file /wwwroot/app.js
Change content:
var mobile = azureMobileApps({
// Explicitly enable the Azure Mobile Apps home page
homePage: true,
// Explicitly enable swagger support. UI support is enabled by
// installing the swagger-ui npm module.
swagger: true
});
Test Swagger on https://your-application.azurewebsites.net on Google Chrome click try it out or open https://your-application.azurewebsites.net/swagger/ui

Moving Facebook C# SDK configuration settings to Azure ServiceConfiguration.cscfg

I'm using Facebook C# SDK for an ASP.NET MVC Facebook Canvas application that I'm hosting in Windows Azure.
I currently have the Facebook C# SDK specific configuration settings (appSecret, appId, etc.) in web.config, but I would like to move them to the service configuration file instead so that I can alter the settings when moving from Staging to Production in Azure.
(How) can this be done? Right now I'm using the CanvasAuthorize attribute that automatically reads from web.config.
[CanvasAuthorize(Permissions = FacebookPermissions.ReadStreamPermission)]
public ActionResult Login()
{
return RedirectToAction("Authenticate"); // Logged in, proceed with authentication
}
By default, Facebook C# SDK looks up at the configuration sections in web.config.
You will need to override the default Facebook application using code similar to this.
FacebookApplication.SetApplication(new DefaultFacebookApplication { AppId = "..", AppSecret = ".." });
The best place to set the application is at Application_Start.
You can checkout the sample at https://gist.github.com/820881
This means you are not tied to web.config. You can use database, azure service configuration or anything depending on your logic from where the settings can be retrieved.
I'm not sure about the reasoning of putting application specific configuration information in the Azure ServiceConfiguration.csfg file. Furthermore, I would say that this will be a problem rather than helpful to switch VIP's in the Azure control panel.
They way I do it is to have multiple web deployment configurations in my (ASP.NET MVC canvas page) Visual Studio project. One for Staging and one for Production.
I use the web.config transformation functionality in the Web Deployment to have different web.config settings for Staging/Production.
It works very well and smoothly, just right-click on the project, select Deploy and choose if you want to deploy to staging or production. You can also handle a specific testing AppID for Staging this way.
EDIT: I haven't looked in the source code for the Facebook C# SDK, but I would guess that the web.config read methods are, in fact, hard coded to use the web.config. That would also be a reason to keep it there.

Resources