Question
· Jun 3, 2020

ECP Connection to remote data server

Hello,

I work on deploying IRIS inside Docker container. I really like %Installer class can automate many steps. I want to establish an ECP connection to a mirror database and then define a remote database on the application server. I have already seen we can create local database and namespace in %Installer. What code is needed to establish ECP connection?

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

You can do this with:

set props("Address") = serverAddr
set props("Port") = serverPort
set props("MirrorConnection") = 1
set sc=##class(Config.ECPServers).Create(ECPServerName,.props)

And

set props("Server") = ECPServerName
set props("Directory") = ":mirror:"_mirrorName_":" _databaseName
set sc=##class(Config.Databases).Create(databaseName,.props)

Then you need the Namespace created pointing to that remote database and that can be done via the %Installer (I've not found a way of doing the above with %Installer but you can call class methods for the above from %Installer):

<Namespace Name="${newNS}" Create="yes" Ensemble="0" Code="${SourceCodeNameSpace}">
    <Configuration>
        <Database Name="${newNS}" Create="no" />
    </Configuration>
</Namespace

I was able to define ECP connection in Installer class that I run when I build docker image for my Docker IRIS application. Now I start to use Amazon ECS and Autoscaling. When a new instance is created and it runs the IRIS container, I want it to "register" as an Application server on the remote database server. What code can I execute to add an ip address as an Application Server?