Article
· Apr 22 3m read

Installing ObjectScript Solutions Without Source Code or in Deploy Mode Using IPM Package Manager

Hi folks!

Often, when we develop commercial solutions, there is a necessity to deploy solutions without source code, e.g., in order to preserve the IP.

One of the ways how this can be achieved is to use InterSystems Package Manager.

Here I asked Midjourney to paint an intellectual property of software:

How this can be achieved with IPM?

In fact, this is very simple; just add the Deploy="true" clause in the Resource element in your module.xml manifest. Documentation.

I decided to provide the simplest possible example to illustrate how it works and also to give you a development environment template to let start building and deploying your own modules without source code. He we go!

Here is the Open Exchange example template application that contains two classes:

 dc.deployed.ObjectScript and dc.withsource.ObjectScript 

As it goes from the name, it is an example of deployed mode without source code. Another class is being installed with source code to illustrate the difference and the option to combine deploy and source code modes.

This how you can try it:

Start IRIS as:

docker run --rm --name iris-demo -d -p 29091:1972 -p 29092:52773   intersystemsdc/iris-community

and then open IRIS terminal:

docker exec -it iris-demo iris session iris

After that install the module:

zpm "install deployed-oscript-template"

Two classes are should be installed in the namespace. Let's check the source code. Call the following:

Do ##class(dc.deployed.ObjectScript).Test()

You should see:

USER>Do ##class(dc.deployed.ObjectScript).Test()  

It is a deployed class without source code!

And if you call another method to print out  class'es source code:

k text do ##class(%Compiler.UDL.TextServices).GetTextAsString($namespace, "dc.deployed.ObjectScript", .text) w text

You'll see only class name and method signatures:

Class dc.deployed.ObjectScript

{



ClassMethod Test() As %Status
{

}



}

And if we call another class with source code will see:

USER>Do ##class(dc.withsource.ObjectScript).Test()

This class installed with a source code!

 

USER>k text do ##class(%Compiler.UDL.TextServices).GetTextAsString($namespace, "dc.withsource.ObjectScript", .text) w text
Class dc.withsource.ObjectScript

{

ClassMethod Test() As %Status
{

    set a=42
    write "This class installed with a source code!",!

    return a

}



}

 

You can leverage the repository to test the deploy mode feature. Below are the example steps how to manage it.

Clone the repository

$ git clone https://github.com/intersystems-community/objectscript-docker-template.git

Open the folder in VSCode

, and start docker in VSCode terminal:

$ docker-compose up -d

Refresh the VSCode's connection to connect to the IRIS container. Make changes in IRIS ObjectScript Classes and module.xml (or don't) then load the source code in IRIS Terminal:

USER>zpm "load /home/irisowner/dev"

Change IPM client from the default community to the test registry (it is available all the time for IPM testing purposes):

USER>zpm

zpm:USER>repo -n registry -r -url https://test.pm.community.intersystems.com/registry/ -user test -pass PassWord42

and publish the module into the testing registry:

zpm:USER>publish deployed-oscript-template

You can change the module name of course in a module.xml (as well as the code resources you publish).

Check if the module is published:

zpm:USER>find

As you can see module was successfully published.

If you want to test the newly published module is installed without source code it is easy to do with another IRIS instance started in docker container. This can be performed as follows. Start IRIS in OS terminal:

docker run --rm --name iris-demo -d -p 29091:1972 -p 29092:52773   intersystemsdc/iris-community

Open IRIS Terminal:

docker exec -it iris-demo iris session iris

Launch IPM console:

USER>zpm

Change to TEST registry:

repo -n registry -r -url https://test.pm.community.intersystems.com/registry/ -user test -pass PassWord42

Install your module (change if you published with a different name):

zpm:USER>install deployed-oscript-template

Test the work of the module and source code as we did above.

That's it! 

Happy innovations and deployments with IPM and InterSystems IRIS!

Discussion (2)3
Log in or sign up to continue