Guide for deploying Komment with Kaptain as data connection on multiple Qlik Sense sites
When you have a setup with multiple Qlik Sense sites - e.g. one for development and one for production - there is an easy process to follow to make sure everything works as intended.
This section is relevant for Komment setups where Kaptain is used as the Data connection.
The guide is made for setups where each site has its own Kaptain service and database (MongoD or other)B installed
This section will cover two scenarios:
First time deployment to another site (will be referred to as PROD going forward) than the site used for developing the Qlik Sense app (will be referred to as DEVL going forward)
Update to existing app
First time deployment
Actions on DEVL
Once you are happy with your application and have tested that the writeback functionality works as expected it is time to move the application to the PROD site. The only action needed is to export the application from the QMC.
It is recommended to use variables to control Kaptain URL and Kapsule IDs. See below example of how it could be done.
By using the Computername() expression you can find out what the names of your Qlik Sense sites are and then use these to dynamically populate the URL of Kaptain.
In this example the names of our Qlik Sense sites are DEVL and PROD which gives the following variable definition:
LET vKaptainURL =if(ComputerName()='PROD','https://kaptain.prod.local:8000/',if(ComputerName()='DEVL','https://kaptain.devl.local:8000/'))
Now you just use this variable in the URL field of Kaptain:
You can use exactly the same method to make your Kapsule ID dynamic. The only thing you need is the kapsule IDs for your kapsules on DEVL and PROD.
To get the Kapsule IDs on PROD you should first go to the Kaptain Admin console on DEVL and export the relevant Kapsule. This will download a .kap file which you can then import on the Kaptain Admin console on PROD. The .kap file will only include the kapsule structure and not any data.
Here is how you export a kapsule:
Here is how you upload a new kapsule:
The ID of the newly added Kapsule can then be seen directly in the Kapsule overview:
Once you have the Kapsule IDs then you can define a variable like the below:
LET vKapsuleID =if(ComputerName()='PROD','5f0318d0234137223853e87e',if(ComputerName()='TEST','61028d61ee198e0a68989663'));
And then you just toggle on the Dynamic Kapsule option and insert the name of your variable:
Update load script
The final thing you need to do is to update the load script with these two variables. You find it in the auto generated load script section related to the partial reload. You can see the before/after examples below.
Script without variables
Script with variables inserted
Actions on PROD
The first action is to import the application into the QMC.
Secondly you do a full reload of the app to make sure that the data shown in the app is populated from PROD data sources (including the Kapsule from PROD).
That's it! You can now go ahead and publish the app to the relevant stream on your PROD site provided that you have used dynamic URL and Kapsules in your app.
Update to existing app
When you have made updates to an existing app on DEVL that you want to deploy on PROD there are a few steps to take to make sure the changes take effect on Kaptain side as well.
In the below we only look at the actions on PROD and assume you have already imported the updated app into the QMC.
The number of steps needed when deploying an updated app depends on whether any changes have been made to the Komment widgets.
It is assumed that you have used Dynamic URL and Kapsule in your app.
No changes made to Komment widgets:
After importing the app to the QMC, the only thing you need to do is to reload the app and then publish it.
Changes made to Komment widgets:
A. Actions on Kaptain Admin console
On DEVL find the relevant Kapsule and export it
On PROD find the relevant Kapsule and select Replace Kapsule => Select the Kapsule you just exported in step 1