Skip to content

Commit

Permalink
updated docker
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny Shvarov authored and Evgeny Shvarov committed Jun 26, 2020
1 parent 08d9627 commit e822060
Show file tree
Hide file tree
Showing 13 changed files with 253 additions and 67 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/.DS_Store
.git
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.sh text eol=lf
*.cls text eol=lf
*.mac text eol=lf
*.int text eol=lf
Dockerfil* text eol=lf
12 changes: 12 additions & 0 deletions .github/workflows/objectscript-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: objectscriptquality
on: push

jobs:
linux:
name: Linux build
runs-on: ubuntu-latest

steps:
- name: Execute ObjectScript Quality Analysis
run: wget https://raw.githubusercontent.com/litesolutions/objectscriptquality-jenkins-integration/master/iris-community-hook.sh && sh ./iris-community-hook.sh

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.DS*
.DS_Store


18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "objectscript",
"request": "launch",
"name": "ObjectScript Debug Class",
"program": "##class(PackageSample.ObjectScript).Test()",
},
{
"type": "objectscript",
"request": "attach",
"name": "ObjectScript Attach",
"processId": "${command:PickProcess}",
"system": true
}
]
}
23 changes: 13 additions & 10 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{
"objectscript.conn": {
"active": true,
"port": 52774,
"user": "admin",
"password": "SYS",
"ns": "DCANALYTICS"
},
"objectscript.conn.version": 3,
"objectscript.conn.active": true,
"objectscript.export.addCategory": true
"objectscript.conn" :{
"ns": "DCANALYTICS",
"active": true,
"docker-compose": {
"service": "iris",
"internalPort": 52773
},
"links": {
"RESTForms2-UI": "http://localhost:${port}/restforms2-ui/index.html"

}
}

}
85 changes: 36 additions & 49 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,62 +1,49 @@
ARG IMAGE=store/intersystems/iris:2019.1.0.511.0-community
ARG IMAGE=store/intersystems/iris:2019.2.0.107.0-community
ARG IMAGE=intersystemsdc/iris-community:2020.2.0.204.0-zpm
FROM $IMAGE

WORKDIR /opt/app

COPY ./src/ ./src/
USER root
WORKDIR /opt/dcanalytics
RUN chown ${ISC_PACKAGE_MGRUSER}:${ISC_PACKAGE_IRISGROUP} /opt/dcanalytics
COPY irissession.sh /
RUN chmod +x /irissession.sh

RUN mkdir -p /tmp/deps \

&& cd /tmp/deps \

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

# Download globals data
&& wget -q -O - https://api.github.com/repos/intersystems-community/dc-analytics/releases/latest \
| egrep 'http.*DCAnalytics_globals.*gz' \
| cut -d : -f 2,3 \
| tr -d '"' \
| wget -O - -i - \
| gunzip > /opt/app/globals.xml

RUN iris start $ISC_PACKAGE_INSTANCENAME quietly EmergencyId=sys,sys && \
/bin/echo -e "sys\nsys\n" \
" do ##class(Security.Users).UnExpireUserPasswords(\"*\")\n" \
" do ##class(Security.Users).AddRoles(\"admin\", \"%ALL\")\n" \
" do \$system.OBJ.Load(\"/opt/app/dswinstaller.cls\",\"ck\")\n" \
" do ##class(Security.System).Get(,.p)\n" \
" set p(\"AutheEnabled\")=\$zb(p(\"AutheEnabled\"),16,7)\n" \
" do ##class(Security.System).Modify(,.p)\n" \
" Do \$system.OBJ.Load(\"/tmp/deps/zpm.xml\", \"ck\")" \
" do CreateDatabase^%SYS.SQLSEC(\"DCANALYTICS\",\"\",,0)\n" \
" zn \"DCANALYTICS\"" \
" zpm \"install dsw\"" \
" do \$system.OBJ.ImportDir(\"/opt/app/src\",,\"ck\",,1)\n" \
" do ##class(Community.Utils).setup(\"/opt/app/globals.xml\")" \
" zn \"%sys\"" \
" write \"Create web application ...\",!" \
" set webName = \"/csp/dcanalytics\"" \
" set webProperties(\"NameSpace\") = \"DCANALYTICS\"" \
" set webProperties(\"Enabled\") = 1" \
" set webProperties(\"IsNameSpaceDefault\") = 1" \
" set webProperties(\"CSPZENEnabled\") = 1" \
" set webProperties(\"AutheEnabled\") = 32" \
" set webProperties(\"iKnowEnabled\") = 1" \
" set webProperties(\"DeepSeeEnabled\") = 1" \
" set status = ##class(Security.Applications).Create(webName, .webProperties)" \
" write:'status \$system.Status.DisplayError(status)" \
" write \"Web application \"\"\"_webName_\"\"\" was created!\",!" \
" zn \"DCANALYTICS\"" \
" halt" \
| iris session $ISC_PACKAGE_INSTANCENAME && \
/bin/echo -e "sys\nsys\n" \
| iris stop $ISC_PACKAGE_INSTANCENAME quietly

RUN apt update && apt install -y git && git clone https://github.com/intersystems-community/dsw-reports.git && cp -r dsw-reports/src/web/reports /usr/irissys/csp/dsw/ && cp -r src/reports /usr/irissys/csp/dsw/ && rm -rf dsw-reports

COPY ./other/dcanalytics.json /usr/irissys/csp/dsw/configs/

COPY ./fixoverlay.sh ./

CMD [ "-b", "/opt/app/fixoverlay.sh" ]
| gunzip > /opt/dcanalytics/globals.xml


USER ${ISC_PACKAGE_MGRUSER}

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

RUN \
do $SYSTEM.OBJ.Load("Installer.cls", "ck") \
set sc = ##class(App.Installer).setup() \
zn "DCANALYTICS" \
zpm "install dsw" \
zpm "install isc-dev" \
do ##class(dev.code).workdir("/irisdev/app/src") \
do EnableDeepSee^%SYS.cspServer("/csp/dcanalytics/") \
do ##class(Community.Utils).setup("/opt/dcanalytics/globals.xml") \
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) \


SHELL ["/bin/bash", "-c"]

COPY /dsw/dcanalytics.json /usr/irissys/csp/dsw/configs/

87 changes: 87 additions & 0 deletions Dockerfile_old
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
ARG IMAGE=store/intersystems/iris:2019.1.0.511.0-community
ARG IMAGE=store/intersystems/iris:2019.2.0.107.0-community
ARG IMAGE=intersystemsdc/iris-community:2020.2.0.204.0-zpm
FROM $IMAGE

USER root
WORKDIR /opt/irisapp
RUN chown ${ISC_PACKAGE_MGRUSER}:${ISC_PACKAGE_IRISGROUP} /opt/irisapp
COPY irissession.sh /
RUN chmod +x /irissession.sh

RUN mkdir -p /tmp/deps \

&& cd /tmp/deps \

# Download globals data
&& wget -q -O - https://api.github.com/repos/intersystems-community/dc-analytics/releases/latest \
| egrep 'http.*DCAnalytics_globals.*gz' \
| cut -d : -f 2,3 \
| tr -d '"' \
| wget -O - -i - \
| gunzip > /opt/irisapp/globals.xml


USER ${ISC_PACKAGE_MGRUSER}

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

RUN \
do $SYSTEM.OBJ.Load("Installer.cls", "ck") \
set sc = ##class(App.Installer).setup() \
zn "DCANALYTICS" \
zpm "install dsw" \
zpm "install isc-dev" \
do ##class(dev.code).workdir("/irisdev/app/src") \
do EnableDeepSee^%SYS.cspServer("/csp/dcanalytics/") \
do ##class(Community.Utils).setup("/opt/irisapp/globals.xml") \
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) \


RUN iris start $ISC_PACKAGE_INSTANCENAME quietly EmergencyId=sys,sys && \
/bin/echo -e "sys\nsys\n" \
" do ##class(Security.Users).UnExpireUserPasswords(\"*\")\n" \
" do ##class(Security.Users).AddRoles(\"admin\", \"%ALL\")\n" \
" do \$system.OBJ.Load(\"/opt/app/dswinstaller.cls\",\"ck\")\n" \
" do ##class(Security.System).Get(,.p)\n" \
" set p(\"AutheEnabled\")=\$zb(p(\"AutheEnabled\"),16,7)\n" \
" do ##class(Security.System).Modify(,.p)\n" \
" Do \$system.OBJ.Load(\"/tmp/deps/zpm.xml\", \"ck\")" \
" do CreateDatabase^%SYS.SQLSEC(\"DCANALYTICS\",\"\",,0)\n" \
" zn \"DCANALYTICS\"" \
" zpm \"install dsw\"" \
" do \$system.OBJ.ImportDir(\"/opt/app/src\",,\"ck\",,1)\n" \
" do ##class(Community.Utils).setup(\"/opt/app/globals.xml\")" \
" zn \"%sys\"" \
" write \"Create web application ...\",!" \
" set webName = \"/csp/dcanalytics\"" \
" set webProperties(\"NameSpace\") = \"DCANALYTICS\"" \
" set webProperties(\"Enabled\") = 1" \
" set webProperties(\"IsNameSpaceDefault\") = 1" \
" set webProperties(\"CSPZENEnabled\") = 1" \
" set webProperties(\"AutheEnabled\") = 32" \
" set webProperties(\"iKnowEnabled\") = 1" \
" set webProperties(\"DeepSeeEnabled\") = 1" \
" set status = ##class(Security.Applications).Create(webName, .webProperties)" \
" write:'status \$system.Status.DisplayError(status)" \
" write \"Web application \"\"\"_webName_\"\"\" was created!\",!" \
" zn \"DCANALYTICS\"" \
" halt" \
| iris session $ISC_PACKAGE_INSTANCENAME && \
/bin/echo -e "sys\nsys\n" \
| iris stop $ISC_PACKAGE_INSTANCENAME quietly

RUN apt update && apt install -y git && git clone https://github.com/intersystems-community/dsw-reports.git && cp -r dsw-reports/src/web/reports /usr/irissys/csp/dsw/ && cp -r src/reports /usr/irissys/csp/dsw/ && rm -rf dsw-reports

COPY ./other/dcanalytics.json /usr/irissys/csp/dsw/configs/

COPY ./fixoverlay.sh ./

CMD [ "-b", "/opt/app/fixoverlay.sh" ]
32 changes: 32 additions & 0 deletions Installer.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Class App.Installer
{

XData setup
{
<Manifest>
<Default Name="SourceDir" Value="#{$system.Process.CurrentDirectory()}src"/>
<Default Name="Namespace" Value="DCANALYTICS"/>
<Default Name="app" Value="dcanalytics" />

<Namespace Name="${Namespace}" Code="${Namespace}" Data="${Namespace}" Create="yes" Ensemble="no">

<Configuration>
<Database Name="${Namespace}" Dir="/opt/${app}/data" Create="yes" Resource="%DB_${Namespace}"/>

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

/>
</Namespace>

</Manifest>
}

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")
}

}
17 changes: 16 additions & 1 deletion dev.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
## export globals from COMMUNITYPUBLIC
```
// export globals from COMMUNITYPUBLIC
set gbl="Com*D.GBL,His*D.GBL"
s fn="DCPublic_globals.gz"
s s=##class(%Stream.FileBinaryGzip).%New() do s.LinkToFile(fn) do $System.OBJ.ExportToStream(gbl,s,"/mapped") do s.%Save() kill s
```

## build container with no cache
```
docker-compose build --no-cache
```
## open terminal to docker
```
docker-compose exec iris iris session iris -U IRISAPP
```

## global export
$System.OBJ.Export("GlobalName.GBL","/irisdev/app/src/gbl/globalname.xml")
```
16 changes: 10 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
version: '2.4'
version: '3.6'
services:
iris:
build: .
build:
context: .
dockerfile: Dockerfile
restart: always
ports:
- 52774:52773
- 51774:51773
ports:
- 51773
- 52773
- 53773
volumes:
- ./src:/usr/src
- ~/iris.key:/usr/irissys/mgr/iris.key
- ./:/irisdev/app
File renamed without changes.
19 changes: 19 additions & 0 deletions irissession.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

iris start $ISC_PACKAGE_INSTANCENAME quietly

cat << EOF | iris session $ISC_PACKAGE_INSTANCENAME -U %SYS
do ##class(%SYSTEM.Process).CurrentDirectory("$PWD")
$@
if '\$Get(sc) do ##class(%SYSTEM.Process).Terminate(, 1)
zn "%SYS"
do ##class(SYS.Container).QuiesceForBundling()
Do ##class(Security.Users).UnExpireUserPasswords("*")
halt
EOF

exit=$?

iris stop $ISC_PACKAGE_INSTANCENAME quietly

exit $exit

0 comments on commit e822060

Please sign in to comment.