Scripted/Automated Production Deployment?

I am looking for a way to deploy production changes (code and/or production configs) via script or some other systematic way other than the Ensemble/Deploy page in the Management Portal. My goal is to store these configurations in Subversion, then have a piece that can pull the XML from source control and deploy it to a given server. Is there some kind of script that I can run on a given server to perform this deployment? If so, I can tie it up with Subversion using another tool that I have access to.

If it helps, we are running Cache 2016.1 (HealthShare 15.01) on Red Hat Enterprise Linux 7.

Thanks!

Greg

  • 0
  • 0
  • 781
  • 2
  • 4

Answers

Hi Greg, 

It is a very interesting question. I can't give you all that you want, but I'll try to give some hints. 

Deploy Script

In first, you are looking for some script. While you have to execute some script from Operation System, you have different ways how to do it. And here again, depends on what are you going to inside Caché. As you working on some Linux system, I'll start from it.

Linux:

To start some script inside of Caché you may use csession tool, in two ways: 

  • specify some routine or class, which will be executed at once, and after finish, that code csession will exit. In this case, you have to use some internal code, which already ships by InterSystems, or you can install some of your code.
    csession ENSEMBLE -UUSER ##CLASS(package.class).method()
  • or you can write some COS code, generated in your script, or just in a text file near to script. And send this code to csession. 
    csession ENSEMBLE -UUSER < deploy.mac

Windows:

On a Windows system, you don't have csession tool. But here available another tool cterm.

  • you can also specify routine name
    cterm /console=cn_ap:ENSEMBLE[USER]:^%D
  • but cterm also support special scripts format, which supports even interactive mode.

For both Windows and Linux also possible to launch executable file cache, and call your code in almost the same way as it does csession.

Deploy

To launch that script, you can use any of Continuous Integration system, which you like. I would recommend Jenkins, it is an opensource project, has lots of plugins, and supports multi servers installation. You can configure to launch your script, just by timetable, every time. Or check if appeared some new commits in your chosen System of control version (Subversion or so on), since it was run last time. Multi-server version may help have some different servers with a secondary installation of Jenkins, and control all of them from the master node.

Last time I found GitLab for myself, it quite good git server, with CI service inside. Supports multiple runners for CI, and you can choose which runner should execute some stages. You can easily configure multiple tasks which will be run after every commit. Like build, test and deploy if everything is OK.

 

Is it true that Windows doesn't have access to csession? I'm able to run it on my Windows machine:

C:\InterSystems\Cache\bin>csession CACHE1

Node: reimaged67, Instance: CACHE1

USER>w $zv
Cache for Windows (x86-64) 2017.1 (Build 730) Wed Dec 14 2016 22:43:18 EST

It was added in a recent version, perhaps 2017.1.