Deploying the SDKs to another server
After creating distribution build which contains component metadata and static content, the build package can be deployed to another web server. The distribution build is served from a specific location in a web-server directory structure. This article describes the configurations and procedures for deploying the Constellation SDKs to such a server. This article assumes that you have an instance of the SDKs set up already, so it will not delve into installing and configuring the necessary files. For information about installing the SDK files, see Installing the Constellation SDKs.
Our setup
We use the following setup in the procedure. This is only an illustration of the procedure, replace the file paths and URIs based on your setup.
- Pega Infinity set up at the demo server https://sdk-dev.pegatsdemo.com.
- MediaCo sample application installed at https://sdk-dev.pegatsdemo.com/pwebed/app/mediaco.
- Constellation SDK files hosted in the Tomcat web server. Tomcat ROOT is at
/var/lib/tomcat/webapps
.- Path for the Angular SDK:
/var/lib/tomcat/webapps/ROOT/SDK-A.
- Path for the React SDK:
/var/lib/tomcat/webapps/ROOT/SDK-R
- Path for the Web Components SDK:
/var/lib/tomcat/webapps/ROOT/SDK-WC.
- Path for the Angular SDK:
Procedure
The following procedure outlines the procedure to deploy a distribution build of Constellation SDKs to a production server. Where applicable, a step is linked to a detailed section for your reference. We demonstrate the procedure using the React SDK as an example, the detailed sections show the corresponding file names, paths, and folders for all the Constellation SDKs.
- Open a terminal window at the SDK folder. For example:
~SDK/react-sdk
. - Pull the latest version of the SDK from the GitHub repository.
git pull
- Perform a fresh installation of the npm components.
npm run build:prod:ci
You must do a fresh installation every time there is an update or modification in the npm dependency. - Edit the
sdk-config.json
file to update the server URLs and optionally, the mashup password. - Edit the
index.html
file to update the base tag. - Edit the app configuration file to update the base reference value. This step is required for the Angular and React SDKs only.
- Rebuild the SDK. This generates the code in the SDK's
dist
folder (the distribution build folder).npm run build:prod
You can also do a development build (npm run build:dev
) to troubleshoot any errors you might encounter before doing a production build. - Copy the generated code from the /dist folder into the SDK's location in the Tomcat server. We use the symlink in this step, use the full path if you do not want to use a symlink. For example:
cp -R dist/* ~webapps/ROOT/SDK-R
- Copy the authorization file from the SDK to the Tomcat "root" folder. For example:
cp dist/auth.html ~webapps/ROOT
This completes deploying the SDK into the production server. - Verify whether the deployment was successful by running the links for the SDK's Embedded and Portal modes. For example:
https://sdk-dev.pegatsdemo.com/SDK-R/portal.html
https://sdk-dev.pegatsdemo.com/SDK-R/embedded.html
The SDK's Portal and Embedded modes should start.
Previous topic Testing the MediaCo sample application Next topic Editing the sdk-config.json file