Skip to content

Commit

Permalink
The project has been redesigned
Browse files Browse the repository at this point in the history
  • Loading branch information
gevorg95 committed Mar 21, 2020
1 parent a8f814f commit 750e490
Show file tree
Hide file tree
Showing 9 changed files with 251 additions and 221 deletions.
45 changes: 18 additions & 27 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,25 @@
ARG IMAGE=intersystems/iris:2019.1.0S.111.0
ARG IMAGE=store/intersystems/iris:2019.1.0.511.0-community
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
ARG IMAGE=intersystemsdc/iris-community:2019.4.0.383.0-zpm
FROM $IMAGE

WORKDIR /opt/app
USER root

COPY ./Installer.cls ./
COPY ./cls/ ./src/
WORKDIR /opt/irisapp
RUN chown ${ISC_PACKAGE_MGRUSER}:${ISC_PACKAGE_IRISGROUP} /opt/irisapp

# download ZPM
RUN mkdir -p /tmp/deps \
USER irisowner

&& cd /tmp/deps \
COPY Installer.cls .
COPY src src
COPY irissession.sh /
SHELL ["/irissession.sh"]

&& wget -q https://pm.community.intersystems.com/packages/zpm/latest/installer -O zpm.xml
RUN \
do $SYSTEM.OBJ.Load("Installer.cls", "ck") \
set sc = ##class(App.Installer).setup()


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 ##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 \$system.OBJ.Load(\"/opt/app/Installer.cls\",\"ck\")\n" \
" Set sc = ##class(App.Installer).setup(, 3)\n" \
" If 'sc do \$zu(4, \$JOB, 1)\n" \
" halt" \
| iris session $ISC_PACKAGE_INSTANCENAME && \
/bin/echo -e "sys\nsys\n" \
| iris stop $ISC_PACKAGE_INSTANCENAME quietly

CMD [ "-l", "/usr/irissys/mgr/messages.log" ]
# bringing the standard shell back
SHELL ["/bin/bash", "-c"]
29 changes: 16 additions & 13 deletions Installer.cls
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
Class App.Installer
{

XData MyInstall [ XMLNamespace = INSTALLER ]
XData setup
{
<Manifest>
<Default Name="NAMESPACE" Value="TEST"/>
<Default Name="DBNAME" Value="TEST"/>
<Default Name="APPPATH" Dir="/opt/app/" />
<Default Name="SOURCESPATH" Dir="${APPPATH}src" />
<Default Name="RESOURCE" Value="%DB_${DBNAME}" />
<Default Name="SourceDir" Value="#{$system.Process.CurrentDirectory()}src"/>
<Default Name="Namespace" Value="IRISAPP"/>
<Default Name="app" Value="irisapp" />

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

<Namespace Name="${NAMESPACE}" Code="${DBNAME}-CODE" Data="${DBNAME}-DATA" Create="yes" Ensemble="0">
<Configuration>
<Database Name="${DBNAME}-CODE" Dir="${APPPATH}${DBNAME}-CODE" Create="yes" Resource="${RESOURCE}"/>
<Database Name="${DBNAME}-DATA" Dir="${APPPATH}${DBNAME}-DATA" Create="yes" Resource="${RESOURCE}"/>
</Configuration>
<Database Name="${Namespace}" Dir="/opt/${app}/data" Create="yes" Resource="%DB_${Namespace}"/>

<Import File="${SOURCESPATH}" Recurse="1"/>
<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 ]
{
Quit ##class(%Installer.Manifest).%Generate(%compiledclass, %code, "MyInstall")
#; Let XGL document generate code for this method.
Quit ##class(%Installer.Manifest).%Generate(%compiledclass, %code, "setup")
}

}
}
14 changes: 9 additions & 5 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:
- 52773:52773
ports:
- 51773
- 52773
- 53773
volumes:
- ~/iris.key:/usr/irissys/mgr/iris.key
- .:/opt
- ./:/irisdev/app
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
Loading

0 comments on commit 750e490

Please sign in to comment.