Article
Lorenzo Scalese · Apr 21, 2021 2m read

How to deploy large application with ZPM client and Config-API

Hi Everyone,

In the previous article, we combine ZPM with Config-API to load a configuration on module loading\install.
It could be useful for small applications, but for a large application, it's not convenient.

You can need to create multiple namespaces and install many zpm modules on different namespaces.
Using the configuration document on zpm load\install is a problem for this special case.
Moreover, even if you need only one module and one namespace, ZPM client is designed to install on the current namespace and it's not possible to switch to another namespace during the install.
So, If we need to install in a specific namespace, It must exist before using ZPM client.

Since version Config-API 1.0.2, a ZPM section is added to the configuration document to perform commands.
This feature allows executing multiple zpm commands to a specified namespace.
To expose how It works, we used a minimal configuration document with :

  • 2 namespaces (NS1 and NS2)
  • 2 databases (DB1 and DB2)
  • Install 1 module on namespace NS1 and 2 modules on namespace NS2.
{
    "Defaults":{
        "DBDATA1" : "${MGRDIR}irisapp1/",
        "DBDATA2" : "${MGRDIR}irisapp2/",
        "APPNS" : "IRISAPP"
    },
    "SYS.Databases":{
        "${DBDATA1}" : {},
        "${DBDATA2}" : {}
    },
    "Databases":{
        "DB1" : {
            "Directory" : "${DBDATA1}"
        },
        "DB2" : {
            "Directory" : "${DBDATA2}"
        }
    },
    "Namespaces":{
        "NS1": {
            "Globals":"DB1"
        },
        "NS2": {
            "Globals":"DB2"
        }
    },
    "ZPM":{
        "NS1" : [
            {
                "install":"module-name-1"
            }
        ],
        "NS2" : [
            {
                "install":"module-name-2"
            }, 
            {
                "install":"module-name-3"
            }
        ]
    }
}

On ZPM section the first key is the namespace (syntax ${var} is allowed). For each namespace, you can set an array of objects with the couple "command":"args".

For testing, I encourage using this fork of intersystems-iris-dev-template.
You can see how the template works by observ these files :

Hope this feature can help for deployment.

The app is submitted for the contest, vote for it if you like it ;-).

Thank you.

20
1 0 3 54
Log in or sign up to continue

Replies

Nice, the support of ZPM in the json config file is a major improvement.

Now we can use this module as a total replacement of the manifest installer !

Great work !

Just an idea:

Currently, we have only templates for development.

Maybe we could create a template for docker image build purpose.
I would say that an app isn't always a single module in a namespace.
A template to configure IRIS, create namespaces, install modules, etc ... and publish to the user docker registry might be useful.

Perhaps, a better way to do this exists (maybe by using workflow, I don't know). I'm not up to date with all existing possibilities. So, If you have resources about that, I'm interested.