· Jan 25 2m read

Your Favorite IRIS Terminal Aliases In Docker Dev Environment!

Hi Devs!

Recently I was impressed by @Dan Pasco's article where he shares also how he uses terminal aliases. 

Terminal aliases is a very powerful tool for developers and sys admins if you often need to call some cumbersome terminal expressions and make it shorter and cleaner. Here is the documentation.

But what about Docker environments? What if you are fan of Docker dev environments but also want to keep using your favorite aliases with Docker as well?

Turned out it is very possible.

Just add .iris_init file (example) into your GitHub repository and copy it into the home folder of IRIS user - /home/irisowner in this case. Which can be nicely done with this command in Dockerfile:

COPY .iris_init /home/irisowner/.iris_init

I've added a few in basic objectscript and iris-dev templates (mostly borrowed from isc-one-liners project):

:alias enablebi do EnableDeepSee^%SYS.cspServer("/csp/"_$zcvt($namespace,"L")) ;
:alias ssl x "n $namespace set $namespace=""%SYS"", name=$S(""$1""="""":""DefaultSSL"",1:""$1"") do:'##class(Security.SSLConfigs).Exists(name) ##class(Security.SSLConfigs).Create(name)" ;
:alias createdb do $SYSTEM.SQL.Execute("CREATE DATABASE $1") ;
:alias installipm s r=##class(%Net.HttpRequest).%New(),r.Server="",r.SSLConfiguration="ISC.FeatureTracker.SSL.Config" d r.Get("/packages/zpm/latest/installer"),$system.OBJ.LoadStream(r.HttpResponse.Data,"c") ;
:alias add%all x "n $namespace set $namespace=""%SYS"",P(""Globals"")=""%DEFAULTDB"",sc=##class(Config.Namespaces).Create(""%All"",.P)" ;
:alias exportglobal d $System.OBJ.Export("$1.GBL","$2$1.xml") ;

Here is how you can use them, e.g. Global export:

USER>:exportglobal AAA /home/irisowner/
d $System.OBJ.Export("AAA.GBL","/home/irisowner/AAA.xml") ;

Exporting to XML started on 01/25/2024 11:58:37
Exporting global: ^AAA
Export finished successfully.


Or add ssl configuration with a specific name:

USER>:ssl web
x "n $namespace set $namespace=""%SYS"", name=$S(""web""="""":""DefaultSSL"",1:""web"") do:'##class(Security.SSLConfigs).Exists(name) ##class(Security.SSLConfigs).Create(name)" ;


Hope you find it useful as I do! :)

Please, fill free to share your favorite aliases - we'll add it in the basic template as well.

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

Nice! Thank you @Brett Saviano! 

And it works for host versions nicely! But of course if it is a docker image there could be a ports mapping. e.g. if I start iris with the following command:

docker run --rm --name iris-demo -d -p 9091:1972 -p 9092:52773   intersystemsdc/irishealth-community:preview

and open terminal with:

docker exec -it iris-demo iris session iris

then the command gives us:

USER>Do ##class(%Studio.General).GetWebServerPort(,,,.url) Write url,"csp/sys/UtilHome.csp" Kill url

and the working one is:


Maybe it is not possible at all for docker. 

Unless we setup a special global intentionally during the docker image build.