Showing posts with label package. Show all posts
Showing posts with label package. Show all posts

Tuesday, 14 November 2017

WFFM 8.2.x PaaS prc package missing parameters

I've been working on an Azure PaaS environment setup for a client, upgrading them to using Sitecore 8.2.5.  I'm definitely loving how easy it is to work with Sitecore's ARM templates, which we've both customised and extended for different environments.  Unfortunately we've also encountered a few setbacks along the way...

One of the big ones (fortunately easy to fix) was that the Sitecore package for WFFM for the processing server was invalid and giving us lots of errors when spinning up a new environment.  It only has the following:
<parameters>
  <parameter name="Application Path" tags="iisapp">
    <parameterEntry type="ProviderPath" scope="iisapp" match="WebSite" />
  </parameter>
  <parameter name="Reporting Admin Connection String" tags="Hidden, SQLConnectionString, NoStore">
    <parameterEntry type="ProviderPath" scope="dbfullsql" match="Content\\Website\\Data\\WFFM_Analytics\.sql$" />
  </parameter>
</parameters>

However this does not include the parameters necessary to restore the 2 included .dacpac files inside the package.  It should contain:
<parameters>
  <parameter name="Application Path" tags="iisapp">
    <parameterEntry type="ProviderPath" scope="iisapp" match="WebSite" />
  </parameter>
  <parameter name="Core Admin Connection String" tags="Hidden, SQLConnectionString, NoStore">
    <parameterEntry type="ProviderPath" scope="dbDacFx" match="core.dacpac" />
  </parameter>
  <parameter name="Master Admin Connection String" tags="Hidden, SQLConnectionString, NoStore">
    <parameterEntry type="ProviderPath" scope="dbDacFx" match="master.dacpac" />
  </parameter>
  <parameter name="Reporting Admin Connection String" tags="Hidden, SQLConnectionString, NoStore">
    <parameterEntry type="ProviderPath" scope="dbfullsql" match="Content\\Website\\Data\\WFFM_Analytics\.sql$" />
  </parameter>
</parameters>

You can simply unzip -> edit -> re-zip the files, and you should be good to go.
I have confirmed this with sitecore support who have provided the issue reference number 193329.
I have also raised a pull request in the quickstart templates for when the fixed packages are released by Sitecore.

Tuesday, 10 October 2017

Making a Sitecore PaaS package (WDP) for your module

For one of my first posts on Sitecore PaaS I'll run through one of the more basic things you may need to know for your deployments: adding a module to your Sitecore PaaS installation.  I'll use the Sitecore Powershell Extensions module (which as far as I know doesn't have a package already) as an example.  This is an easy one to start with, as it will only really be running on your CM server so it cuts down on the need for transforms and multiple packages.

Firstly, we need to create what Sitecore calls a "web deploy package" (WDP).  This is just a zip file containing our module files, and ending in .scwdp.zip.  As you can find from a dig around in the Sitecore Azure Module Documentation in the Generating an inital WDP section, you can create this WDP from a normal Sitecore module installation .zip or .update package.

The command is:
ConvertTo-SCModuleWebDeployPackage [-Path] <string> [[-Destination] <string>]

Which in our case will be:
ConvertTo-SCModuleWebDeployPackage -Path "Sitecore PowerShell Extensions-4.5 for Sitecore 8.zip" -Destination "SPE.scwdp.zip"

This generates our .scwdp.zip with the same files that were in the installer zip, and also creates a .dacpac file to amend our DB with any items from the installer zip.  The deploy package will take an "application path" parameter no matter what, and if you have any .dacpacs (new items) it will also automatically add parameters for whichever database you are updating (in our case, core and master).

Next up, we need to create an ARM template which will install our WDP.  A good starting point is taking a look at the WFFM templates, which are relatively straightforward.  I've created a gist for the SPE deployment template, and you can see the end of the post for how we pass in our parameters.

You'll note we're only adding one new resource in the ARM template, which is a MSDeploy extension.  This is how we use ARM to deploy things to Azure.


"resources": [
    {
      "name": "[concat(variables('cmWebAppNameTidy'), '/', 'MSDeploy')]",
      "type": "Microsoft.Web/sites/extensions",
      "location": "[parameters('location')]",
      "apiVersion": "[variables('webApiVersion')]",
      "properties": {
        "addOnPackages": [
          {
            "dbType": "SQL",
            "connectionString": "[concat('Data Source=tcp:', variables('sqlServerFqdnTidy'), ',1433;Initial Catalog=master;User Id=', parameters('sqlServerLogin'), '@', variables('sqlServerNameTidy'), ';Password=', parameters('sqlServerPassword'), ';')]",
            "packageUri": "[parameters('cmMsDeployPackageUrl')]",
            "setParameters": {
              "Application Path": "[variables('cmWebAppNameTidy')]",
              "Core Admin Connection String": "[concat('Encrypt=True;TrustServerCertificate=False;Data Source=', variables('sqlServerFqdnTidy'), ',1433;Initial Catalog=',variables('coreSqlDatabaseNameTidy'),';User Id=', parameters('sqlServerLogin'), ';Password=', parameters('sqlServerPassword'), ';')]",
              "Master Admin Connection String": "[concat('Encrypt=True;TrustServerCertificate=False;Data Source=', variables('sqlServerFqdnTidy'), ',1433;Initial Catalog=',variables('masterSqlDatabaseNameTidy'),';User Id=', parameters('sqlServerLogin'), ';Password=', parameters('sqlServerPassword'), ';')]"
            }
          }
        ]
      }
    }
  ]

You'll notice we're passing in the application path, and core/master connection strings parameters to the deployment, as mentioned above.

Finally, we need to add the extension to our Sitecore deployment.  We do this in our parameters file for our main deployment, in a "modules" parameter:

"modules": {
  "value": {
    "items": [
      {
        "name": "spe",
        "templateLink": "https://yoursite/sitecore/templates/azuredeploy.spe.json",
        "parameters": {
          "cmMsDeployPackageUrl": "https://yoursite/sitecore/modules/SPE.scwdp.zip"
        }
      }
    ]
  }
}

You'll see there is only one parameter we actually need to pass in: the WDP we created above.  This is because Sitecore automatically populates the other parameters with the values we pass in to the main ARM deployment.  This includes the CM app name (where the package is installed), SQL username and password (for installing the .dacpac which has the new items), etc.

And that's all there is to it!  Enjoy adding your additional modules and install packages to Sitecore PaaS in a nice modular way.