Skip to content

Commit 5b62865

Browse files
committed
dockerise
1 parent 41658fc commit 5b62865

4 files changed

Lines changed: 121 additions & 1 deletion

File tree

Dockerfile

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
FROM intersystems/iris:2019.1.0S.111.0
2+
3+
# version DeepSeeWeb
4+
ARG DSW_VERSION=2.1.32
5+
6+
7+
WORKDIR /opt/app
8+
9+
COPY ./src/ ./src/
10+
COPY dswinstaller.cls ./
11+
12+
13+
RUN DEBIAN_FRONTEND=noninteractive apt-get update \
14+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
15+
curl
16+
17+
RUN mkdir -p /tmp/deps \
18+
19+
&& cd /tmp/deps \
20+
21+
# Download MDX2JSON, just master branch from github as archive
22+
&& curl -L -q https://github.com/eduard93/Cache-MDX2JSON/archive/master.tar.gz | tar xvfzC - . \
23+
24+
# Download DeepSeeWeb from releases
25+
&& curl -L -q https://github.com/intersystems-ru/DeepSeeWeb/releases/download/${DSW_VERSION}/DSW.Installer.${DSW_VERSION}.xml -o deepseeweb.xml \
26+
27+
# Download globals data
28+
&& curl -s https://api.github.com/repos/intersystems-community/dc-analytics/releases/latest \
29+
| egrep 'http.*DCAnalytics_globals.*gz' \
30+
| cut -d : -f 2,3 \
31+
| tr -d '"' \
32+
| wget -O - -i - \
33+
| gunzip > /opt/app/globals.xml
34+
35+
36+
RUN iris start $ISC_PACKAGE_INSTANCENAME quietly EmergencyId=sys,sys && \
37+
/bin/echo -e "sys\nsys\n" \
38+
" Do ##class(Security.Users).UnExpireUserPasswords(\"*\")\n" \
39+
" Do ##class(Security.Users).AddRoles(\"admin\", \"%ALL\")\n" \
40+
" do \$system.OBJ.Load(\"/opt/app/dswinstaller.cls\",\"ck\")\n" \
41+
# " do \$system.OBJ.Load(\"/tmp/deps/Cache-MDX2JSON-master/MDX2JSON/Installer.cls.xml\",\"ck\")\n" \
42+
# " do \$system.OBJ.Load(\"/tmp/deps/deepseeweb.xml\",\"ck\")\n" \
43+
" s sc=##class(DSWMDX2JSON.Installer).setup()\n" \
44+
" If 'sc do \$zu(4, \$JOB, 1)\n" \
45+
"do CreateDatabase^%SYS.SQLSEC(\"DCANALYTICS\",\"\",,0)\n" \
46+
"zn \"DCANALYTICS\"\n" \
47+
" do \$system.OBJ.ImportDir(\"/opt/app/src\",,\"ck\",,1)\n" \
48+
" do ##class(Community.Utils).setup(\"/opt/app/globals.xml\")" \
49+
" halt" \
50+
| iris session $ISC_PACKAGE_INSTANCENAME && \
51+
/bin/echo -e "sys\nsys\n" \
52+
| iris stop $ISC_PACKAGE_INSTANCENAME quietly
53+
54+
COPY ./other/dcanalytics.json /usr/irissys/csp/dsw/configs/
55+
56+
CMD [ "-l", "/usr/irissys/mgr/messages.log" ]

docker-compose.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: '2.4'
2+
services:
3+
iris:
4+
build: .
5+
restart: always
6+
ports:
7+
- 52774:52773
8+
volumes:
9+
- ~/iris.key:/usr/irissys/mgr/iris.key

dswinstaller.cls

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
Class DSWMDX2JSON.Installer
2+
{
3+
4+
XData setup [ XMLNamespace = INSTALLER ]
5+
{
6+
<Manifest>
7+
<Var Name="Namespace" Value="MDX2JSON"/>
8+
<Var Name="Import" Value="0"/>
9+
10+
<If Condition='(##class(Config.Namespaces).Exists("${Namespace}")=0)'>
11+
<Log Text="Creating namespace ${Namespace}" Level="0"/>
12+
<Namespace Name="${Namespace}" Create="yes" Code="${Namespace}" Ensemble="" Data="${Namespace}">
13+
<Configuration>
14+
<Database Name="${Namespace}"
15+
Dir="${MGRDIR}/${Namespace}"
16+
Create="yes"
17+
Resource="%DB_${Namespace}"
18+
PublicPermissions="RW"
19+
MountAtStartup="true"/>
20+
</Configuration>
21+
</Namespace>
22+
<Log Text="End Creating namespace ${Namespace}" Level="0"/>
23+
</If>
24+
25+
<Namespace Name="${Namespace}">
26+
<Import File="/tmp/deps/Cache-MDX2JSON-master/MDX2JSON/" Flags="ck" Recurse="1"/>
27+
</Namespace>
28+
29+
<Namespace Name="${CURRENTNS}">
30+
<Import File="/tmp/deps/Cache-MDX2JSON-master/MDX2JSON/Installer.cls.xml" Flags="ck"/>
31+
32+
<Import File="/tmp/deps/deepseeweb.xml" Flags="ck"/>
33+
34+
<RunInstall Class="MDX2JSON.Installer" Method="setup"/>
35+
36+
<RunInstall Class="DSW.Installer" Method="setup"/>
37+
</Namespace>
38+
</Manifest>
39+
}
40+
41+
ClassMethod setup(
42+
ByRef pVars,
43+
pLogLevel As %Integer = 3,
44+
pInstaller As %Installer.Installer,
45+
pLogger As %Installer.AbstractLogger
46+
) As %Status [ CodeMode = objectgenerator, Internal ]
47+
{
48+
do %code.WriteLine($char(9)_"set pVars(""CURRENTCLASS"")="""_%classname_"""")
49+
do %code.WriteLine($char(9)_"set pVars(""CURRENTNS"")="""_$namespace_"""")
50+
#; Let our XGL document generate code for this method.
51+
Quit ##class(%Installer.Manifest).%Generate(%compiledclass, %code, "setup")
52+
}
53+
54+
}

src/cls/Community/Utils.cls

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ ClassMethod setup(globalPath As %String = "") As %Status
99
}
1010

1111
try {
12-
do ..importXMLGlobal(globalPath)
12+
if globalPath[".gz" do ..importXMLGlobal(globalPath)
13+
if globalPath[".xml" do $System.OBJ.Load(globalPath)
1314
} catch e {
1415
set sc = e.AsStatus()
1516
w "Err ",e.Name, ": ", e.Data, ": ", e.Location, !

0 commit comments

Comments
 (0)