<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Evgeny Shvarov</title>
    <description>The latest articles on DEV Community by Evgeny Shvarov (@evshvarov).</description>
    <link>https://dev.to/evshvarov</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F405401%2F4de1ff63-f713-4950-ad2f-770dc9dbb9cc.jpeg</url>
      <title>DEV Community: Evgeny Shvarov</title>
      <link>https://dev.to/evshvarov</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/evshvarov"/>
    <language>en</language>
    <item>
      <title>COVID-19 Analytics using InterSystems IRIS</title>
      <dc:creator>Evgeny Shvarov</dc:creator>
      <pubDate>Wed, 27 Jan 2021 08:38:40 +0000</pubDate>
      <link>https://dev.to/intersystems/covid-19-analytics-using-intersystems-iris-gej</link>
      <guid>https://dev.to/intersystems/covid-19-analytics-using-intersystems-iris-gej</guid>
      <description>&lt;p&gt;Hi colleagues!&lt;/p&gt;

&lt;p&gt;Every day Johns Hopkins University publishes new data on coronavirus COVID-19 pandemic status.&lt;/p&gt;

&lt;p&gt;I built a &lt;a href="http://34.77.54.254:52773/dsw/index.html#/IRISAPP/Covid19"&gt;simple InterSystems IRIS Analytics dashboard&lt;/a&gt; using InterSystems IRIS Community Edition in docker deployed on GCP Kubernetes which shows key measures of the disease outbreak.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://34.77.54.254:52773/dsw/index.html#/IRISAPP/Covid19"&gt;&lt;img src="/sites/default/files/inline/images/images/screenshot_2020-03-28_12_58_33.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This dashboard is an example of how information from CSV could be analyzed with IRIS Analytics and deployed to GCP Kubernetes in a form of InterSystems IRIS Community Edition.&lt;/p&gt;

&lt;p&gt;Added the &lt;a href="http://34.77.54.254:52773/dsw/index.html#/IRISAPP/Covid19/USA.dashboard"&gt;interactive map of the USA&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://34.77.54.254:52773/dsw/index.html#/IRISAPP/Covid19/USA.dashboard"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fE30F4f5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://community.intersystems.com/sites/default/files/inline/images/images/covid_usa.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;a href="http://34.77.54.254:52773/dsw/index.html#/IRISAPP/Covid19/Daily.dashboard"&gt;next dashboard shows the timeline&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://34.77.54.254:52773/dsw/index.html#/IRISAPP/Covid19/Daily.dashboard"&gt;&lt;img src="/sites/default/files/inline/images/images/screenshot_2020-03-28_20_48_27.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And can be filtered by country. E.g. here is &lt;a href="http://34.77.54.254:52773/dsw/index.html#!/d/Covid19/Daily.dashboard?ns=IRISAPP&amp;amp;FILTERS=TARGET:*;FILTER:%5BDay%5D.%5BH1%5D.%5BMonth%5D.%26%5BNOW%5D~%5BCountryRegion%5D.%5BH1%5D.%5BCountryRegion%5D.%26%5BUS%5D"&gt;in the USA:&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://34.77.54.254:52773/dsw/index.html#!/d/Covid19/Daily.dashboard?ns=IRISAPP&amp;amp;FILTERS=TARGET:*;FILTER:%5BDay%5D.%5BH1%5D.%5BMonth%5D.%26%5BNOW%5D~%5BCountryRegion%5D.%5BH1%5D.%5BCountryRegion%5D.%26%5BUS%5D"&gt;&lt;img src="/sites/default/files/inline/images/images/screenshot_2020-03-28_21_05_49.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The source code of the application is &lt;a href="https://openexchange.intersystems.com/package/covid-19-analytics"&gt;available on Open Exchange.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How does it work?&lt;/p&gt;

&lt;p&gt;Demo runs using InterSystems IRIS Community Edition docker container and exposes InterSystems IRIS BI dashboards using DeepSee Web representation layer via MDX2JSON REST API. Its deployed on GCP and operates using Google Kubernetes Engine (GKE).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How it was developed&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;The data is taken from the &lt;a href="https://github.com/CSSEGISandData/COVID-19"&gt;Johns Hopkins repository&lt;/a&gt; in CSV form.&lt;/p&gt;

&lt;p&gt;Classes, cubes, and initial pivots were generated via &lt;a href="https://openexchange.intersystems.com/package/AnalyzeThis"&gt;Analyzethis&lt;/a&gt; module, thanks &lt;a class="mentioned-user" href="https://dev.to/peter"&gt;@peter&lt;/a&gt;
.Steiwer&lt;span&gt;!&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Import method then was introduced using the CSVTOCLASS method, thanks @Eduard.Lebedyuk!&lt;/p&gt;

&lt;p&gt;&lt;span&gt;Dashboards are rendered with &lt;a href="https://openexchange.intersystems.com/package/DeepSeeWeb"&gt;DeepSee Web (DSW)&lt;/a&gt; module.&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;IRIS BI &lt;a href="https://github.com/evshvarov/covid-19/tree/master/src/dfi"&gt;artifacts (pivots, dashboards)&lt;/a&gt; were exported by &lt;a href="https://openexchange.intersystems.com/package/ISC-DEV"&gt;ISC.DEV&lt;/a&gt; module:&lt;/p&gt;

&lt;pre&gt;IRISAPP&amp;gt; d ##class(dev.code).workdir("/irisdev/app/src")

IRISAPP&amp;gt; d ##class(dev.code).export("*.dfi")&lt;/pre&gt;

&lt;p&gt;The code has been developed using &lt;a href="https://openexchange.intersystems.com/package/VSCode-ObjectScript"&gt;VSCode ObjectScript&lt;/a&gt;, thanks &lt;a class="mentioned-user" href="https://dev.to/dmitry"&gt;@dmitry&lt;/a&gt;
.Maslennikov.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Building docker image for development and deployment&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
All the deployment sits in &lt;a href="https://github.com/evshvarov/covid-19/blob/master/Dockerfile"&gt;Dockerfile&lt;/a&gt;. With Dockerfile we build an image with data, web apps and modules installed and properly setup and then we deploy the image to GCP Kubernetes.&lt;/p&gt;

&lt;p&gt;This Dockerfile is a modified version of this &lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/Dockerfile"&gt;Template Dockerfile&lt;/a&gt; which is described very well &lt;a href="https://community.intersystems.com/post/dockerfile-and-friends-or-how-run-and-collaborate-objectscript-projects-intersystems-iris"&gt;in this article&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So I will stop only on new parts. &lt;/p&gt;

&lt;pre&gt;17 COPY  data files&lt;/pre&gt;

&lt;p&gt;here we copy CSV files from data folder to the container&lt;/p&gt;

&lt;pre&gt;set pfile = "/opt/irisapp/files/covid-"_$tr($zd($h-1),"/","-")_".csv", rc=0 \
  do ##class(AnalyzeThis.Generated.covid03162020).Import(,pfile,",", ,1,.rc) \
  write "imported records: "_rc \
  do ##class(%DeepSee.Utils).%BuildCube("covid03162020") \&lt;/pre&gt;

&lt;p&gt;This code imports the latest data and builds a cube.&lt;/p&gt;

&lt;pre&gt;zpm "install dsw" \&lt;/pre&gt;

&lt;p&gt;Here we install DeepSee Web.&lt;/p&gt;

&lt;pre&gt;do EnableDeepSee^%SYS.cspServer("/csp/irisapp/") \&lt;/pre&gt;

&lt;p&gt;This enables IRIS Analytics (DeepSee) for /csp/irisapp web app.&lt;/p&gt;

&lt;pre&gt;zn "%SYS" \
  write "Modify MDX2JSON application security...",! \
  set webName = "/mdx2json" \
  set webProperties("AutheEnabled") = 64 \
  set webProperties("MatchRoles")=":%DB_IRISAPP" \
  set sc = ##class(Security.Applications).Modify(webName, .webProperties) \
  if sc&amp;amp;lt;1 write $SYSTEM.OBJ.DisplayError(sc)&lt;/pre&gt;

&lt;p&gt;This code is needed to make the analytics web app be available without credentials.&lt;/p&gt;

&lt;p&gt;COPY irisapp.json /usr/irissys/csp/dsw/configs/&lt;/p&gt;

&lt;p&gt;And this command helps to set DSW configuration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deployment to Kubernetes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The deployment procedure is being processed by Github Actions - and &lt;a href="https://github.com/evshvarov/covid-19/blob/master/.github/workflows/workflow.yaml"&gt;this workflow&lt;/a&gt; handles it on every commit to the repository.&lt;/p&gt;

&lt;p&gt;Github workflow uses Dockerfile we built on a previous step along with &lt;a href="https://github.com/evshvarov/covid-19/tree/master/terraform"&gt;Terraform&lt;/a&gt; and &lt;a href="https://github.com/evshvarov/covid-19/tree/master/k8s"&gt;Kubernetes&lt;/a&gt; settings. &lt;/p&gt;

&lt;p&gt;The procedure is identical to the one described in &lt;a href="https://community.intersystems.com/post/deploying-intersystems-iris-solution-gke-using-github-actions"&gt;this article&lt;/a&gt; by &lt;a class="mentioned-user" href="https://dev.to/mikhail"&gt;@mikhail&lt;/a&gt;
.Khomenko.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to run and develop it locally&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You are very welcome to run, develop  and collaborate with this project.&lt;/p&gt;

&lt;p&gt;To run it locally using docker do:&lt;/p&gt;

&lt;p&gt;Clone/git pull the repo into any local directory&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git clone https://github.com/intersystems-community/objectscript-docker-template.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Open the terminal in this directory and run:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ docker-compose build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol start="3"&gt;
  &lt;li&gt;
    Run the IRIS container:
  &lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ docker-compose up -d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Once the container is built up and running open the application on:&lt;/p&gt;

&lt;pre&gt;localhost:yourport/dsw/index.html#!/d/Covid19/Countries.dashboard?ns=IRISAPP&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;How to Develop&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This repository is ready to code in VSCode with the ObjectScript plugin. Install &lt;a href="https://code.visualstudio.com/" rel="nofollow"&gt;VSCode&lt;/a&gt;, &lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker" rel="nofollow"&gt;Docker&lt;/a&gt; and &lt;a href="https://marketplace.visualstudio.com/items?itemName=daimor.vscode-objectscript" rel="nofollow"&gt;ObjectScript&lt;/a&gt; plugin and open the folder in VSCode.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to Contribute&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Fork &lt;a href="https://github.com/evshvarov/covid-19"&gt;the repository&lt;/a&gt;, make changes and send Pull Requests. &lt;a href="https://www.youtube.com/watch?v=1x0hC_MlRfg&amp;amp;t=4s"&gt;See the video for more information.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Would love to see your contribution! &lt;/p&gt;

</description>
      <category>analytics</category>
      <category>covid19</category>
      <category>visualisation</category>
      <category>database</category>
    </item>
    <item>
      <title>Dockerfile and Friends or How to Run and Collaborate to ObjectScript Projects on InterSystems IRIS</title>
      <dc:creator>Evgeny Shvarov</dc:creator>
      <pubDate>Wed, 18 Nov 2020 17:03:56 +0000</pubDate>
      <link>https://dev.to/intersystems/dockerfile-and-friends-or-how-to-run-and-collaborate-to-objectscript-projects-on-intersystems-iris-43dm</link>
      <guid>https://dev.to/intersystems/dockerfile-and-friends-or-how-to-run-and-collaborate-to-objectscript-projects-on-intersystems-iris-43dm</guid>
      <description>&lt;p&gt;Hi Developers!&lt;/p&gt;

&lt;p&gt;Many of you publish your InterSystems ObjectScript libraries on &lt;a href="https://openexchange.intersystems.com/"&gt;Open Exchange&lt;/a&gt; and Github.&lt;/p&gt;

&lt;p&gt;But what do you do to ease the usage and collaboration to your project for developers?&lt;/p&gt;

&lt;p&gt;In this article, I want to introduce the way how to introduce an easy way to launch and contribute to any ObjectScript project just by copying a standard set of files to your repository.&lt;/p&gt;

&lt;p&gt;Let's go!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TLDR&lt;/strong&gt; - copy these files from &lt;a href="https://github.com/intersystems-community/objectscript-docker-template"&gt;the repository&lt;/a&gt; into your repository:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/Dockerfile"&gt;Dockerfile&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/docker-compose.yml"&gt;docker-compose.yml&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/Installer.cls"&gt;Installer.cls&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/iris.script"&gt;iris.script&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/.vscode/settings.json"&gt;settings.json&lt;/a&gt;{#9f423fcac90bf80939d78b509e9c2dd2-d165a4a3719c56158cd42a4899e791c99338ce73}&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/.dockerignore"&gt;.dockerignore&lt;/a&gt;{#f7c5b4068637e2def526f9bbc7200c4e-c292b730421792d809e51f096c25eb859f53b637}&lt;br&gt;&lt;br&gt;
&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/.gitattributes"&gt;.gitattributes&lt;/a&gt;{#fc723d30b02a4cca7a534518111c1a66-051218936162e5338d54836895e0b651e57973e1}&lt;br&gt;&lt;br&gt;
&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/.gitignore"&gt;.gitignore&lt;/a&gt;{#a084b794bc0759e7a6b77810e01874f2-e6aff5167df2097c253736b40468e7b21e577eeb}&lt;/p&gt;

&lt;p&gt;And you get the standard way to launch and collaborate to your project. Below is the long article on how and why this works.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NB:&lt;/strong&gt; In this article, we will consider projects which are runnable on InterSystems IRIS 2019.1 and newer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Choosing the launch environment for InterSystems IRIS projects&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Usually, we want a developer to try the project/library and be sure that this will be fast and safe exercise.&lt;/p&gt;

&lt;p&gt;IMHO the ideal approach to launch anything new fast and safe is the Docker container which gives a developer a guarantee that anything he/she launches, imports, compiles and calculates is safe for the host machine and no system or code would be destroyed or spoiled. If something goes wrong you just stop and remove the container. If the application takes an enormous amount of disk space - you wipe out it with the container and your space is back. If an application spoils the database configuration - you just delete the container with spoiled configuration. Simple and safe like that.&lt;/p&gt;

&lt;p&gt;Docker container gives you safety and standardization.&lt;/p&gt;

&lt;p&gt;The simplest way to run vanilla InterSystems IRIS Docker container is to run an &lt;a href="https://hub.docker.com/_/intersystems-iris-data-platform/plans/222f869e-567c-4928-b572-eb6a29706fbd?tab=instructions"&gt;IRIS Community Edition image&lt;/a&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Install &lt;a href="https://www.docker.com/products/docker-desktop"&gt;Docker desktop&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run in OS terminal the following:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;pre&gt;docker run --rm -p 52773:52773 --init --name my-iris store/intersystems/iris-community:2020.1.0.199.0&lt;/pre&gt;

&lt;ol&gt;
&lt;li&gt;Then open Management portal in your host browser on:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="http://localhost:52773/csp/sys/UtilHome.csp"&gt;http://localhost:52773/csp/sys/UtilHome.csp&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Or open a terminal to IRIS:&lt;/p&gt;

&lt;p&gt;docker exec -it my-iris iris session IRIS&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Stop IRIS container when you don't need it:&lt;/p&gt;

&lt;p&gt;docker stop my-iris&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;OK! We run IRIS in a docker container. But you want a developer to install your code into IRIS and maybe make some settings. This is what we will discuss below.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Importing ObjectScript files&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The simplest InterSystems ObjectScript project can contain a set of ObjectScript files like classes, routines, macro, and globals. Check the article on the naming and proposed folder structure.&lt;/p&gt;

&lt;p&gt;The question is how to import all this code into an IRIS container?&lt;/p&gt;

&lt;p&gt;Here is the momennt where Dockerfile helps us which we can use to take the vanilla IRIS container and import all the code from a repository to IRIS and do some settings with IRIS if we need. We need to add a Dockerfile in the repo.&lt;/p&gt;

&lt;p&gt;Let's examine the &lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/Dockerfile"&gt;Dockerfile&lt;/a&gt; from &lt;a href="https://github.com/intersystems-community/objectscript-docker-template"&gt;ObjectScript template&lt;/a&gt; repo:&lt;/p&gt;

&lt;pre&gt;ARG IMAGE=store/intersystems/irishealth:2019.3.0.308.0-community
ARG IMAGE=store/intersystems/iris-community:2019.3.0.309.0
ARG IMAGE=store/intersystems/iris-community:2019.4.0.379.0
ARG IMAGE=store/intersystems/iris-community:2020.1.0.199.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 iris.script /tmp/iris.script # run iris and initial 

RUN iris start IRIS \
    &amp;amp;&amp;amp; iris session IRIS &amp;lt; /tmp/iris.script&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;First ARG lines set the $IMAGE variable - which we will use then in FROM. This is suitable to test/run the code in different IRIS versions switching them just by what is the last line before FROM to change the $IMAGE variable. &lt;/p&gt;

&lt;p&gt;Here we have: &lt;/p&gt;

&lt;pre&gt;ARG IMAGE=store/intersystems/iris-community:2020.1.0.199.0

FROM $IMAGE&lt;/pre&gt;

&lt;p&gt;This means that we are taking IRIS 2020 Community Edition build 199.&lt;/p&gt;

&lt;p&gt;We want to import the code from the repository - that means we need to copy the files from a repository into a docker container. The lines below help to do that:&lt;/p&gt;

&lt;pre&gt;USER root

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

USER irisowner

COPY  Installer.cls .
COPY  src src&lt;/pre&gt;

&lt;p&gt;&lt;span&gt;USER root&lt;/span&gt; - here we switch user to a root to create a folder and copy files in docker.&lt;/p&gt;

&lt;p&gt;&lt;span&gt;WORKDIR  /opt/irisapp -&lt;/span&gt; in this line we setup the workdir in which we will copy files.&lt;/p&gt;

&lt;p&gt;&lt;span&gt;RUN chown ${ISC_PACKAGE_MGRUSER}:${ISC_PACKAGE_IRISGROUP} /opt/irisapp   &lt;/span&gt;-  here we give the rights to irisowner user and group which are run IRIS.&lt;/p&gt;

&lt;p&gt;&lt;span&gt;USER irisowner -&lt;/span&gt; switching user from root to irisowner&lt;/p&gt;

&lt;p&gt;&lt;span&gt;COPY Installer.cls .  -&lt;/span&gt; coping &lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/Installer.cls"&gt;Installer.cls&lt;/a&gt; to a root of workdir. Don't miss the dot, here.&lt;/p&gt;

&lt;p&gt;&lt;span&gt;COPY src src &lt;/span&gt;- copy source files from &lt;a href="https://github.com/intersystems-community/objectscript-docker-template/tree/master/src/"&gt;src folder in the repo&lt;/a&gt; to src folder in workdir in the docker.&lt;/p&gt;

&lt;p&gt;In the next block we run the initial script, where we call installer and ObjectScript code:&lt;/p&gt;

&lt;pre&gt;COPY iris.script /tmp/iris.script # run iris and initial 
RUN iris start IRIS \
    &amp;amp;&amp;amp; iris session IRIS &amp;lt; /tmp/iris.script&lt;/pre&gt;

&lt;p&gt;&lt;span&gt;COPY iris.script /&lt;/span&gt; - we copy iris.script into the root directory. It contains ObjectScript we want to call to setup the container.&lt;/p&gt;

&lt;p&gt;&lt;span&gt;RUN iris start IRIS&amp;lt;/span&amp;gt; &lt;span&gt; &lt;/span&gt;- start IRIS&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span&gt;&amp;amp;&amp;amp; iris session IRIS &amp;lt; /tmp/iris.script - &lt;/span&gt;start IRIS terminal and input the initial ObjectScript to it.&lt;/p&gt;

&lt;p&gt;Fine! We have the Dockerfile, which imports files in docker. But we faced two other files: installer.cls and iris.script Let's examine it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/Installer.cls"&gt;&lt;strong&gt;Installer.cls&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Class App.Installer
{

XData setup
{
&amp;lt;Manifest&amp;gt;
  &amp;lt;Default Name="SourceDir" Value="#{$system.Process.CurrentDirectory()}src"/&amp;gt;
  &amp;lt;Default Name="Namespace" Value="IRISAPP"/&amp;gt;
  &amp;lt;Default Name="app" Value="irisapp" /&amp;gt;

  &amp;lt;Namespace Name="${Namespace}" Code="${Namespace}" Data="${Namespace}" Create="yes" Ensemble="no"&amp;gt;

    &amp;lt;Configuration&amp;gt;
      &amp;lt;Database Name="${Namespace}" Dir="/opt/${app}/data" Create="yes" Resource="%DB_${Namespace}"/&amp;gt;

      &amp;lt;Import File="${SourceDir}" Flags="ck" Recurse="1"/&amp;gt;
    &amp;lt;/Configuration&amp;gt;
    &amp;lt;CSPApplication Url="/csp/${app}" Directory="${cspdir}${app}"  ServeFiles="1" Recurse="1" MatchRoles=":%DB_${Namespace}" AuthenticationMethods="32"
       
    /&amp;gt;
  &amp;lt;/Namespace&amp;gt;

&amp;lt;/Manifest&amp;gt;
}

ClassMethod setup(ByRef pVars, pLogLevel As %Integer = 3, pInstaller As %Installer.Installer, pLogger As %Installer.AbstractLogger) As %Status [ CodeMode = objectgenerator, Internal ]
{
  #; Let XGL document generate code for this method. 
  Quit ##class(%Installer.Manifest).%Generate(%compiledclass, %code, "setup")
}

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Frankly, we do not need Installer.cls to import files. This could be done with one line. But often besides importing code we need to setup the CSP app, introduce security settings, create databases and namespaces.&lt;/p&gt;

&lt;p&gt;In this Installer.cls we create a new database and namespace with the name IRISAPP and create the default /csp/irisapp application for this namespace.&lt;/p&gt;

&lt;p&gt;All this we perform in  element:&lt;/p&gt;

&lt;pre&gt;&amp;lt;Namespace Name="${Namespace}" Code="${Namespace}" Data="${Namespace}" Create="yes" Ensemble="no"&amp;gt;

    &amp;lt;Configuration&amp;gt;
      &amp;lt;Database Name="${Namespace}" Dir="/opt/${app}/data" Create="yes" Resource="%DB_${Namespace}"/&amp;gt;

      &amp;lt;Import File="${SourceDir}" Flags="ck" Recurse="1"/&amp;gt;
    &amp;lt;/Configuration&amp;gt;
    &amp;lt;CSPApplication Url="/csp/${app}" Directory="${cspdir}${app}"  ServeFiles="1" Recurse="1" MatchRoles=":%DB_${Namespace}" AuthenticationMethods="32"
       
    /&amp;gt;
  &amp;lt;/Namespace&amp;gt;&lt;/pre&gt;

&lt;p&gt;And we import files all the files from SourceDir with Import tag:&lt;/p&gt;

&lt;pre&gt;&amp;lt;Import File="${SourceDir}" Flags="ck" Recurse="1"/&amp;gt;&lt;span&gt; &lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;SourceDir here is a variable, which is set to the current directory/src folder:&lt;/p&gt;

&lt;pre&gt;&amp;lt;Default Name="SourceDir" Value="#{$system.Process.CurrentDirectory()}src"/&amp;gt;&lt;/pre&gt;

&lt;p&gt;Installer.cls with these settings gives us confidence, that we create a clear new database IRISAPP in which we import arbitrary ObjectScript code from src folder.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/iris.script"&gt;iris.script&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here you are welcome to provide any initial ObjectScript setup code you want to start your IRIS container.&lt;/p&gt;

&lt;p&gt;E.g. here we load and run installer.cls and then we make UserPasswords forever just to avoid the first request to change the password cause we don't need this prompt for development.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;; run installer to create namespace
do $SYSTEM.OBJ.Load("/opt/irisapp/Installer.cls", "ck")
set sc = ##class(App.Installer).setup()  zn "%SYS"
Do ##class(Security.Users).UnExpireUserPasswords("*") ; call your initial methods here
halt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/docker-compose.yml"&gt;docker-compose.yml&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Why do we need docker-compose.yml - couldn't we just build and run the image just with Dockerfile? Yes, we could. But docker-compose.yml simplifies the life.&lt;/p&gt;

&lt;p&gt;Usually, docker-compose.yml is used to launch several docker images connected to one network.&lt;/p&gt;

&lt;p&gt;docker-compose.yml could be used to also make launches of one docker image easier when we deal with a lot of parameters. You can use it to pass parameters to docker, such as ports mapping, volumes, VSCode connection parameters.&lt;/p&gt;

&lt;pre&gt;version: '3.6' 
services:
  iris:
    build: 
      context: .
      dockerfile: Dockerfile
    restart: always
    ports: 
      - 51773
      - 52773
      - 53773
    volumes:
      - ~/iris.key:/usr/irissys/mgr/iris.key
      - ./:/irisdev/app&lt;/pre&gt;

&lt;p&gt;Here we declare service iris, which uses docker file Dockerfile and which exposes the following ports of IRIS: 51773, 52773, 53773. Also this service maps two volumes: iris.key from home directory of host machine to IRIS folder where it is expected and it maps the root folder of source code to /irisdev/app folder.&lt;/p&gt;

&lt;p&gt;Docker-compose gives us the shorter and unified command to build and run the image whatever parameters you setup in docker compose.&lt;/p&gt;

&lt;p&gt;in any case, the command to build and launch the image is:&lt;/p&gt;

&lt;pre&gt;$ docker-compose up -d&lt;/pre&gt;

&lt;p&gt; and to open IRIS terminal:&lt;/p&gt;

&lt;pre&gt;$ docker-compose exec iris iris session iris

Node: 05a09e256d6b, Instance: IRIS

USER&amp;gt;&lt;/pre&gt;

&lt;p&gt;Also, docker-compose.yml helps to set up the connection for VSCode ObjectScript plugin.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/.vscode/settings.json"&gt;.vscode/settings.json&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The part, which relates to ObjectScript addon connection settings is this:&lt;/p&gt;

&lt;pre&gt;{
    "objectscript.conn" :{
      "ns": "IRISAPP",
      "active": true,
      "docker-compose": {
        "service": "iris",
        "internalPort": 52773
      }
    }     

}&lt;/pre&gt;

&lt;p&gt;Here we see the settings, which are different from default settings of VSCode ObjectScript plugin.&lt;/p&gt;

&lt;p&gt;Here we say, that we want to connect to IRISAPP namespace (which we create with Installer.cls):&lt;/p&gt;

&lt;pre&gt;"ns": "IRISAPP",&lt;span&gt; &lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;and there is a docker-compose setting, which tells, that in docker-compose file inside service "iris" VSCode will connect to the port, which 52773 is mapped to:&lt;/p&gt;

&lt;pre&gt;"docker-compose": {
        "service": "iris",
        "internalPort": 52773
      }&lt;/pre&gt;

&lt;p&gt;If we check, what we have for 52773 we see that this is the mapped port is not defined for 52773:&lt;/p&gt;

&lt;pre&gt;ports: 
      - 51773
      - 52773
      - 53773&lt;/pre&gt;

&lt;p&gt;This means that a random available on a host machine port will be taken and VSCode will connect to this IRIS on docker via random port automatically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This is a very handy feature, cause it gives you the option to run any amount of docker images with IRIS on random ports and having VSCode connected to them automatically.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;What about other files?&lt;/p&gt;

&lt;p&gt;We also have:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/.dockerignore"&gt;.dockerignore&lt;/a&gt;  - file which you can use to filter host machine files you don't want to be copied into docker image you build. Usually .git and .DS_Store are mandatory lines.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/.gitattributes"&gt;.gitattributes&lt;/a&gt; - attributes for git, which unify line endings for ObjectScript files in sources. This is very useful if the repo is collaborated by Windows and Mac/Ubuntu owners.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/.gitignore"&gt;.gitignore&lt;/a&gt; - files, which you don't want git to track the changes history for. Typically some hidden OS level files, like .DS_Store.&lt;/p&gt;

&lt;p&gt;Fine!&lt;/p&gt;

&lt;p&gt;How to make your repository docker-runnable and collaboration friendly?&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Clone &lt;a href="https://github.com/intersystems-community/objectscript-docker-template"&gt;this repository&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Copy all this files:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/Dockerfile"&gt;Dockerfile&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/docker-compose.yml"&gt;docker-compose.yml&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/Installer.cls"&gt;Installer.cls&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/iris.script"&gt;iris.script&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/.vscode/settings.json"&gt;settings.json&lt;/a&gt;{#9f423fcac90bf80939d78b509e9c2dd2-d165a4a3719c56158cd42a4899e791c99338ce73}&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/.dockerignore"&gt;.dockerignore&lt;/a&gt;{#f7c5b4068637e2def526f9bbc7200c4e-c292b730421792d809e51f096c25eb859f53b637}&lt;br&gt;&lt;br&gt;
&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/.gitattributes"&gt;.gitattributes&lt;/a&gt;{#fc723d30b02a4cca7a534518111c1a66-051218936162e5338d54836895e0b651e57973e1}&lt;br&gt;&lt;br&gt;
&lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/master/.gitignore"&gt;.gitignore&lt;/a&gt;{#a084b794bc0759e7a6b77810e01874f2-e6aff5167df2097c253736b40468e7b21e577eeb}&lt;/p&gt;

&lt;p&gt;to your repository.&lt;/p&gt;

&lt;p&gt;Change &lt;a href="https://github.com/intersystems-community/objectscript-docker-template/blob/10f4422c105d5c75111fde16a184a83f5ff86d06/Dockerfile#L15"&gt;this line in Dockerfile&lt;/a&gt; to match the directory with ObjectScript in the repo you want to import into IRIS (or don't change if you have it in /src folder).&lt;/p&gt;

&lt;p&gt;That's it. And everyone (and you too) will have your code imported into IRIS in a new IRISAPP namespace.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How will people launch your project&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;the algorithm to execute any ObjectScript project in IRIS would be:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Git clone the project locally&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run the project:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;pre&gt;$ docker-compose up -d&lt;/pre&gt;

&lt;pre&gt;$ docker-compose exec iris iris session iris

Node: 05a09e256d6b, Instance: IRIS

USER&amp;gt;zn "IRISAPP"&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;How would any the developer contribute to your project &lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Fork the repository and git clone the forked repo locally&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open the folder in VSCode (they also need &lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker"&gt;Docker&lt;/a&gt; and &lt;a href="https://marketplace.visualstudio.com/items?itemName=daimor.vscode-objectscript&amp;amp;ssr=false#review-details"&gt;ObjectScript&lt;/a&gt; extensions are installed in VSCode)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Right-click on docker-compose.yml-&amp;gt;Restart - &lt;a href="https://openexchange.intersystems.com/package/VSCode-ObjectScript"&gt;VSCode ObjectScript&lt;/a&gt; will automatically connect and be ready to edit/compile/debug&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Commit, Push and Pull request changes to your repository&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is the short gif on how this works:&lt;/p&gt;

&lt;p&gt;&lt;a href="/sites/default/files/inline/images/images/launch_and_edit1.gif" class="article-body-image-wrapper"&gt;&lt;img src="/sites/default/files/inline/images/images/launch_and_edit1.gif" alt=""&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;That's it! Happy coding!&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

</description>
      <category>docker</category>
      <category>intersystems</category>
      <category>objectscript</category>
      <category>devops</category>
    </item>
    <item>
      <title>Importing CSV data into InterSystems IRIS programmatically</title>
      <dc:creator>Evgeny Shvarov</dc:creator>
      <pubDate>Tue, 30 Jun 2020 09:40:33 +0000</pubDate>
      <link>https://dev.to/intersystems/importing-csv-data-into-intersystems-iris-programmatically-5bno</link>
      <guid>https://dev.to/intersystems/importing-csv-data-into-intersystems-iris-programmatically-5bno</guid>
      <description>&lt;p&gt;Sometimes we need to import CSV data to InterSystems IRIS either from CSV or from URL. And we expect the class with proper datatypes to be created and the data to be imported. You can do it manually via the IRIS management portal, but often we need to do this programmatically.&lt;/p&gt;

&lt;p&gt;I published a module &lt;a href="https://openexchange.intersystems.com/package/csvgen"&gt;csvgen&lt;/a&gt; on InterSystems Open Exchange which does exactly that.&lt;/p&gt;

&lt;p&gt;If you just need the CSV file to be imported into IRIS you can do the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;USER&amp;gt;do ##class(community.csvgen).Generate("/usr/data/titanic.csv",,"Data.Titanic")

Class name: Data.Titanic
Header: PassengerId INTEGER,Survived INTEGER,Pclass INTEGER,Name VARCHAR(250),Sex VARCHAR(250),Age INTEGER,SibSp INTEGER,Parch INTEGER,Ticket VARCHAR(250),Fare MONEY,Cabin VARCHAR(250),Embarked VARCHAR(250)
Records imported: 891
USER&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or if you have the CSV on the internet, e.g. &lt;a href="https://github.com/CSSEGISandData/COVID-19/blob/master/csse_covid_19_data/csse_covid_19_daily_reports/05-29-2020.csv"&gt;COVID-19 Data on Github&lt;/a&gt; you can get the data in the following way:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;USER&amp;gt;d ##class(community.csvgen).GenerateFromURL("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_daily_reports/05-29-2020.csv",",","Data.Covid19")

Class name: Data.Covid19
Header: FIPS INTEGER,Admin2 VARCHAR(250),Province_State VARCHAR(250),Country_Region VARCHAR(250),Last_Update DATE,Lat MONEY,Long_ DOUBLE,Confirmed INTEGER,Deaths INTEGER,Recovered INTEGER,Active INTEGER,Combined_Key VARCHAR(250),Incidence_Rate DOUBLE,Case-Fatality_Ratio DOUBLE
Records imported: 3522
USER&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;You can install the package with &lt;a href="https://openexchange.intersystems.com/package/ObjectScript-Package-Manager-2"&gt;ObjectScript Package Manager ZPM&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;USER&amp;gt;zpm

zpm:USER&amp;gt;install csvgen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The csvgen module is a wrapper of &lt;a href="https://cedocs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?APP=1&amp;amp;CLASSNAME=%25SQL.Util.Procedures"&gt;CSV2CLASS method &lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.objectscriptquality.com/dashboard?id=intersystems_iris_community%2Fcsvgen"&gt;The ObjectScript Quality profile.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's not ideal, so &lt;a href="https://github.com/evshvarov/csvgen"&gt;collaboration&lt;/a&gt; is very welcome!&lt;/p&gt;

</description>
      <category>database</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
