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
andNS2
) - 2 databases (
DB1
andDB2
) - Install 1 module on namespace
NS1
and 2 modules on namespaceNS2
.
{
"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 :
- iris.script
- and the configuration document iris-config.json
Hope this feature can help for deployment.
The app is submitted for the contest, vote for it if you like it ;-).
Thank you.