Multiple Qlik Sense sites
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:
  1. 1.
    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)
  2. 2.
    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.

Dymanic URL

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:
1
LET vKaptainURL =if(ComputerName()='PROD','https://kaptain.prod.local:8000/',if(ComputerName()='DEVL','https://kaptain.devl.local:8000/'))
Copied!
Now you just use this variable in the URL field of Kaptain:
Dynamic URL

Dynamic Kapsule

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:
Import kapsule
Here is how you upload a new kapsule:
Add 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:
1
LET vKapsuleID = if(ComputerName()='PROD','5f0318d0234137223853e87e',if(ComputerName()='TEST','61028d61ee198e0a68989663'));
Copied!
And then you just toggle on the Dynamic Kapsule option and insert the name of your variable:
Dynamic Kapsule

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.
Before:
Script without variables
After:
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

  1. 1.
    On DEVL find the relevant Kapsule and export it
  2. 2.
    On PROD find the relevant Kapsule and select Replace Kapsule => Select the Kapsule you just exported in step 1
Replace kapsule

B. Actions on QMC

  1. 1.
    Reload app and publish to relevant stream