Skip to main content

Deployment

As of today, components Javascript bundle is accessible via the URL https://www.unpkg.com/@pnp/modern-search-core@<version_number>/dist/bundle/bundle.js

However, you can choose to host them and consume them from your own environment (ex: Azure Blob Storage). We provide a deployment script to help you to deploy this solution to your Azure environment.

Set up deployment variables

All script parameters are managed through a PowerShell script with the following variables:

Variable nameDescription
$ENV_AzDeployAppIdIf the deployment is done by an application, the Azure App ID.
$ENV_AzDeployAppCertificateValueIf the deployment is done by an application, the Azure App certificate as base64 value.
$ENV_AzDeployTenantIdThe Azure tenant ID where to deploy
$ENV_AzDeploySubcriptionIdThe Azure subscription ID
$ENV_AzResourceGroupNameThe Azure resource group to use for deployment. Should exist before deployment.
$ENV_AzStorageAccountNameThe Azure storage account name to deploy to. Will be created if doesn't exist.
$ENV_AzBlobContainerNameThe container name to deploy the components bundle. Will be created if doesn't exist.
$ENV_AzBlobContainerWebNameThe container bane to deploy the Storybook documentation (typically $web)

To deploy from your local machine:

  1. From the solution root folder, run npx lerna run bundle:prod --scope=@pnp/modern-search-core. This will bundle the components in production mode.

  2. From the /deploy folder run the deploy.ps1 script:

    .\deploy.ps1 -Manual -Environement LOCAL -Version 0.0.0

The script provisions the Azure Blob container if doesn't exist and upload the components Javascript bundle in folder according to the variables.local|ci.ps1 parameters file.

Variable nameDescription
EnvEnvironment where to deploy components. Use LOCAL to deploy with values from variables.local.ps1. Use CI to deploy with values from variables.ci.ps1
VersionVersion to use for components. This will create a dedicated folder with ath version. Ex: 1.0.0
ManualUse this flag to do the deployment manually using an user account. In this case, you will be prompted for authentication. Without this flag, the script will try to deploy using an application according to $ENV_AzDeployAppId and $ENV_AzDeployAppCertificateValue

Once deployed, you need to get the public URL of the bundle javascript file:

Azure Blob bundle URL

This URL should be included in your HTML pages where components are consumed.

!!! warning By default, Azure Blob container is publically accessible. Make sure you configure networking options at storage account level to change this behavior.

Deploy Storybook playground

To deploy the Storybook documentation, follow these steps:

  1. From the solution root folder, run:

    npx lerna run docs:build --scope=@pnp/modern-search-core

  2. From the /deploy folder run the deploy.ps1 script:

    .\deploy-docs.ps1 -Manual -Env LOCAL -Version 0.0.0

  3. Once deploy, you can access the Storybook application from the static website URL + /<version>/index.html (ex: https://<storage_account_name>.z9.web.core.windows.net/0.0.0/index.html):

&quot;Static website URL&quot;