Open Exchange App How to Start Development with InterSystems IRIS in Less Than a Minute

Primary tabs

Hi Developers!

Often I find questions on how to install IRIS, connect to IRIS from IDE, setup the environment, compile, debug, maintain the repository.

Here below possibly the shortest way to set up all the environment and start development with ObjectScript on InterSystems IRIS.

Prerequisites

Make sure you have Git, Docker, and VSCode installed

Install Docker and ObjectScript extensions into VSCode

Sign in or Create an account on Github

Here we go!

To start development you do the following:

  • Use the template repository and create your own repository on Github.
  • Clone your repository with git on your desktop in terminal
  • Open repository in VSCode
  • Use docker-compose.yml to build the container with InterSystems IRIS and import all the ObjectScript from /src folder into USER namespace of IRIS container.
  • Open a terminal to IRIS and call the imported ObjectScript code
  • Make a change to ObjectScript code and compile it
  • Commit and push changes to your GitHub repository

Check the screencast below:

 

Or check the long video with all the explanations.

What's next? Start learning ObjectScript with Online Learning and Documentation.

Also check Beginner posts, Best Practices and ObjectScript code guidelines.

Happy coding!

Comments

Noticed some good stuff in @Dmitriy Maslennikov's  iris-template repo and updated mine foundation template for development with IRIS Community Edition in ObjectScript.

It's much easier now to run ObjectScript instructions in Dockerfile. Check the basic Dockerfie:

ARG IMAGE=intersystems/iris:2019.1.0S.111.0
ARG IMAGE=store/intersystems/irishealth:2019.3.0.308.0-community
ARG IMAGE=store/intersystems/iris-community:2019.3.0.309.0
FROM $IMAGE

USER root

WORKDIR /opt/irisapp
RUN chown ${ISC_PACKAGE_MGRUSER}:${ISC_PACKAGE_IRISGROUP} /opt/irisapp

USER irisowner

COPY  Installer.cls .
COPY  src src
COPY irissession.sh /
SHELL ["/irissession.sh"]

RUN \
  do $SYSTEM.OBJ.Load("Installer.cls", "ck") \
  set sc = ##class(App.Installer).setup() 

# bringing the standard shell back
SHELL ["/bin/bash", "-c"]
CMD [ "-l", "/usr/irissys/mgr/messages.log" ]

And another which installs ZPM and Webterminal:

ARG IMAGE=intersystems/iris:2019.1.0S.111.0
ARG IMAGE=store/intersystems/iris-community:2019.3.0.309.0
FROM $IMAGE

USER root

WORKDIR /opt/irisapp
RUN chown ${ISC_PACKAGE_MGRUSER}:${ISC_PACKAGE_IRISGROUP} /opt/irisapp

USER irisowner

RUN mkdir -p /tmp/deps \

 && cd /tmp/deps \

 && wget -q https://pm.community.intersystems.com/packages/zpm/latest/installer -O zpm.xml

COPY  Installer.cls .
COPY  src src
COPY irissession.sh /

# running IRIS and open IRIS termninal in USER namespace
SHELL ["/irissession.sh"]
# below is objectscript executed in terminal
# each row is what you type in terminal and Enter
RUN \
  do $SYSTEM.OBJ.Load("Installer.cls", "ck") \
  set sc = ##class(App.Installer).setup() \
  Do $system.OBJ.Load("/tmp/deps/zpm.xml", "ck") \
  zn "IRISAPP" \
  zpm "install webterminal" 

# bringing the standard shell back
SHELL ["/bin/bash", "-c"]
CMD [ "-l", "/usr/irissys/mgr/messages.log" ]

First, thanks for this. It go me up and running pretty fast (as title says!). Couple of things:

- The notes/documentation say that code will be loaded into USER namespace, however it's actually being loaded into IRISAPP (as configured in docckerfiles). 

- The jason.config is pointing to USER namespace so any new files and changes to existing will be actually loaded into USER instead of IRISAPP

- Make sure it's all consistent

- The webapp (irisweb) is missing a config for the directory where to store files. I fixed this by modifying the app in management portal. Need to address the installation file/dockerfile

- Haven't been able to make CSPs flow to the container the same as classes. I'm sure I'm missing something but haven't figured out what yet. Any tips? Maybe I'm placing files in the wrong location? Right now I created a csp/irisweb folder under src folder. 

- The notes/documentation say that code will be loaded into USER namespace, however it's actually being loaded into IRISAPP (as configured in docckerfiles).  

Because I made an update to the code recently) And not to the documentation) PR is welcome, or I'll change it by myself soon. Or add an issue!

- The jason.config is pointing to USER namespace so any new files and changes to existing will be actually loaded into USER instead of IRISAPP

Yes, it's a bug from previous version. Need to be fixed, thanks!

- The webapp (irisweb) is missing a config for the directory where to store files. I fixed this by modifying the app in management portal. Need to address the installation file/dockerfile

Cool!

Do you want to make a PR?

- Haven't been able to make CSPs flow to the container the same as classes. I'm sure I'm missing something but haven't figured out what yet. Any tips? Maybe I'm placing files in the wrong location? Right now I created a csp/irisweb folder under src folder.  

You need to COPY this files from /csp in sources to /usr/irissys/mgr/csp/yourwebapp  in Dockerfile
 

OK, I'll give it a try and create a PR once I have a new config file. Thanks!

Thank you. I'll check on it. 

Do you have any tips to make csp changes flow in realtime the same as classes do? I've modified the dockerfile to copy the contents of my csp directory into the container, however my edits to CSPs are not flowing realtime which forces me to rebuild the container everytime to get my updates.

Sure!

just add the volume mapping in docker-compose.yml file which maps folder /csp in sources into /csp directory in docker.

Updated the Installer.cls file - now you can set up the namespace and path in variables "Namespace" and "app" respectfully at the top of  Installer.cls.

  <Default Name="Namespace" Value="IRISAPP"/>
  <Default Name="app" Value="irisapp" />
 

This is convenient if you need to install the app to the namespace with your name.

Notice, that if you want instantly edit and compile the code of your project with VSCode don't forget to change the Namespace parameter in settings.json too.