Skip to content

Commit

Permalink
chore: move IRIS script to separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-tleavitt committed Nov 19, 2024
1 parent 6c8ef96 commit 16e0c88
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 81 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
**
!docker-entrypoint.sh
!iriscli
!iris_ipm.py
!iris_ipm.py
!iris.script
43 changes: 3 additions & 40 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,13 @@ FROM --platform=$BUILDPLATFORM intersystems/iris-community:2024.1-linux-${BUILDA

ARG IPM_INSTALLER=https://pm.community.intersystems.com/packages/zpm/latest/installer

COPY ./iris.script /tmp/iris.script

RUN \
wget -q $IPM_INSTALLER -O /tmp/zpm.xml && \
mkdir /usr/irissys/mgr/zpm && \
iris start $ISC_PACKAGE_INSTANCENAME quietly && \
/bin/echo -e \
"set pNS(\"Globals\")=\"%DEFAULTDB\"\n" \
"set sc=##class(Config.Namespaces).Create(\"%ALL\",.pNS)\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"set pDB(\"Directory\")=\"/usr/irissys/mgr/zpm/\"\n" \
"set sc=##class(SYS.Database).CreateDatabase(pDB(\"Directory\"), 30)\n" \
"do ##class(SYS.Database).MountDatabase(pDB(\"Directory\"))\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"set sc=##class(Config.Databases).Create(\"IPM\",.pDB)\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"set pNamespace(\"Globals\")=\"IPM\"\n" \
"set pNamespace(\"Routines\")=\"IPM\"\n" \
"set sc=##Class(Config.Namespaces).Create(\"IPM\",.pNamespace)\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"set pMap(\"Database\")=\"IPM\"\n" \
"set sc=##Class(Config.MapPackages).Create(\"%ALL\",\"%IPM\",.pMap)\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"set sc=##Class(Config.MapPackages).Create(\"%ALL\",\"IPM\",.pMap)\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"set sc=##Class(Config.MapGlobals).Create(\"%ALL\",\"%IPM.*\",.pMap)\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"set sc=##Class(Config.MapGlobals).Create(\"%SYS\",\"IPM.*\",.pMap)\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"set sc=##Class(Config.MapRoutines).Create(\"%ALL\",\"%IPM.*\",.pMap)\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"set sc=##Class(Config.MapRoutines).Create(\"%ALL\",\"%ZLANGF00\",.pMap)\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"set sc=##Class(Config.MapRoutines).Create(\"%ALL\",\"%ZLANGC00\",.pMap)\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"zn \"IPM\"\n" \
"set sc = ##class(%SYSTEM.OBJ).Load(\"/tmp/zpm.xml\", \"c\")\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"zn \"%SYS\"\n" \
"do ##class(Config.Namespaces).Delete(\"IPM\")\n" \
"do ##class(SYS.Database).Defragment(pDB(\"Directory\"))\n" \
"do ##class(SYS.Database).CompactDatabase(pDB(\"Directory\"),100)\n" \
"do ##class(SYS.Database).ReturnUnusedSpace(pDB(\"Directory\"))\n" \
"do ##class(SYS.Database).DismountDatabase(pDB(\"Directory\"))\n" \
"halt\n" \
| iris session $ISC_PACKAGE_INSTANCENAME -U %SYS && \
iris session $ISC_PACKAGE_INSTANCENAME -U %SYS < /tmp/iris.script && \
iris stop $ISC_PACKAGE_INSTANCENAME quietly

FROM --platform=$TARGETPLATFORM intersystems/iris-community:2024.1-linux-${BUILDARCH}
Expand Down
43 changes: 3 additions & 40 deletions Dockerfile-phase1
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,11 @@ FROM $IMAGE

ARG IPM_INSTALLER=https://pm.community.intersystems.com/packages/zpm/latest/installer

COPY ./iris.script /tmp/iris.script

RUN \
wget -q $IPM_INSTALLER -O /tmp/zpm.xml && \
mkdir /usr/irissys/mgr/zpm && \
iris start $ISC_PACKAGE_INSTANCENAME quietly && \
/bin/echo -e \
"set pNS(\"Globals\")=\"%DEFAULTDB\"\n" \
"set sc=##class(Config.Namespaces).Create(\"%ALL\",.pNS)\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"set pDB(\"Directory\")=\"/usr/irissys/mgr/zpm/\"\n" \
"set sc=##class(SYS.Database).CreateDatabase(pDB(\"Directory\"), 30)\n" \
"do ##class(SYS.Database).MountDatabase(pDB(\"Directory\"))\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"set sc=##class(Config.Databases).Create(\"IPM\",.pDB)\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"set pNamespace(\"Globals\")=\"IPM\"\n" \
"set pNamespace(\"Routines\")=\"IPM\"\n" \
"set sc=##Class(Config.Namespaces).Create(\"IPM\",.pNamespace)\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"set pMap(\"Database\")=\"IPM\"\n" \
"set sc=##Class(Config.MapPackages).Create(\"%ALL\",\"%IPM\",.pMap)\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"set sc=##Class(Config.MapPackages).Create(\"%ALL\",\"IPM\",.pMap)\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"set sc=##Class(Config.MapGlobals).Create(\"%ALL\",\"%IPM.*\",.pMap)\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"set sc=##Class(Config.MapGlobals).Create(\"%SYS\",\"IPM.*\",.pMap)\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"set sc=##Class(Config.MapRoutines).Create(\"%ALL\",\"%IPM.*\",.pMap)\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"set sc=##Class(Config.MapRoutines).Create(\"%ALL\",\"%ZLANGF00\",.pMap)\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"set sc=##Class(Config.MapRoutines).Create(\"%ALL\",\"%ZLANGC00\",.pMap)\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"zn \"IPM\"\n" \
"set sc = ##class(%SYSTEM.OBJ).Load(\"/tmp/zpm.xml\", \"c\")\n" \
"if '\$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)\n" \
"zn \"%SYS\"\n" \
"do ##class(Config.Namespaces).Delete(\"IPM\")\n" \
"do ##class(SYS.Database).Defragment(pDB(\"Directory\"))\n" \
"do ##class(SYS.Database).CompactDatabase(pDB(\"Directory\"),100)\n" \
"do ##class(SYS.Database).ReturnUnusedSpace(pDB(\"Directory\"))\n" \
"do ##class(SYS.Database).DismountDatabase(pDB(\"Directory\"))\n" \
"halt\n" \
| iris session $ISC_PACKAGE_INSTANCENAME -U %SYS && \
iris session $ISC_PACKAGE_INSTANCENAME -U %SYS < /tmp/iris.script && \
iris stop $ISC_PACKAGE_INSTANCENAME quietly
38 changes: 38 additions & 0 deletions iris.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
set pNS("Globals")="%DEFAULTDB"
set sc=##class(Config.Namespaces).Create("%ALL",.pNS)
if '$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)
set pDB("Directory")="/usr/irissys/mgr/zpm/"
set sc=##class(SYS.Database).CreateDatabase(pDB("Directory"), 30)
do ##class(SYS.Database).MountDatabase(pDB("Directory"))
if '$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)
set sc=##class(Config.Databases).Create("IPM",.pDB)
if '$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)
set pNamespace("Globals")="IPM"
set pNamespace("Routines")="IPM"
set sc=##Class(Config.Namespaces).Create("IPM",.pNamespace)
if '$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)
set pMap("Database")="IPM"
set sc=##Class(Config.MapPackages).Create("%ALL","%IPM",.pMap)
if '$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)
set sc=##Class(Config.MapPackages).Create("%ALL","IPM",.pMap)
if '$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)
set sc=##Class(Config.MapGlobals).Create("%ALL","%IPM.*",.pMap)
if '$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)
set sc=##Class(Config.MapGlobals).Create("%SYS","IPM.*",.pMap)
if '$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)
set sc=##Class(Config.MapRoutines).Create("%ALL","%IPM.*",.pMap)
if '$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)
set sc=##Class(Config.MapRoutines).Create("%ALL","%ZLANGF00",.pMap)
if '$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)
set sc=##Class(Config.MapRoutines).Create("%ALL","%ZLANGC00",.pMap)
if '$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)
zn "IPM"
set sc = ##class(%SYSTEM.OBJ).Load("/tmp/zpm.xml", "c")
if '$Get(sc,1) do ##class(%SYSTEM.Process).Terminate(, 1)
zn "%SYS"
do ##class(Config.Namespaces).Delete("IPM")
do ##class(SYS.Database).Defragment(pDB("Directory"))
do ##class(SYS.Database).CompactDatabase(pDB("Directory"),100)
do ##class(SYS.Database).ReturnUnusedSpace(pDB("Directory"))
do ##class(SYS.Database).DismountDatabase(pDB("Directory"))
halt

0 comments on commit 16e0c88

Please sign in to comment.