Skip to content

Commit ec92b50

Browse files
Evgeny ShvarovEvgeny Shvarov
Evgeny Shvarov
authored and
Evgeny Shvarov
committed
docker environment update, zpm module.xml
1 parent f81663d commit ec92b50

File tree

7 files changed

+91
-53
lines changed

7 files changed

+91
-53
lines changed

.gitattributes

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.sh text eol=lf
2+
*.cls text eol=lf
3+
*.mac text eol=lf
4+
*.int text eol=lf
5+
Dockerfil* text eol=lf

.vscode/settings.json

+16-14
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
{
2-
"objectscript.conn": {
3-
"active": true,
4-
"host": "localhost",
5-
"port": 52791,
6-
"ns": "SAMPLES",
7-
},
8-
"objectscript.format": {
9-
"commandCase": "lower",
10-
"functionCase": "lower"
11-
},
12-
"objectscript.export": {
13-
"folder": "src",
14-
"addCategory": false
15-
}
2+
"files.associations": {
3+
4+
"Dockerfile*": "dockerfile",
5+
},
6+
"objectscript.conn" :{
7+
"ns": "SAMPLES",
8+
"active": true,
9+
"docker-compose": {
10+
"service": "iris",
11+
"internalPort": 52773
12+
}
13+
},
14+
"objectscript.conn.active": true,
15+
16+
17+
1618
}

Dockerfile

+15-22
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,25 @@
1-
ARG IMAGE=store/intersystems/iris-community:2019.2.0.107.0
1+
ARG IMAGE=intersystems/iris:2019.1.0S.111.0
2+
ARG IMAGE=store/intersystems/irishealth:2019.3.0.308.0-community
23
ARG IMAGE=store/intersystems/iris-community:2019.3.0.309.0
4+
ARG IMAGE=store/intersystems/iris-community:2019.4.0.379.0
35
FROM $IMAGE
46

57
USER root
68

7-
RUN mkdir /opt/app && chown irisowner:irisowner /opt/app
9+
WORKDIR /opt/irisapp
10+
RUN chown ${ISC_PACKAGE_MGRUSER}:${ISC_PACKAGE_IRISGROUP} /opt/irisapp
811

912
USER irisowner
1013

11-
WORKDIR /opt/app
14+
COPY Installer.cls .
15+
COPY src src
16+
COPY irissession.sh /
17+
SHELL ["/irissession.sh"]
1218

13-
COPY ./Installer.cls ./
14-
COPY ./src ./src/
19+
RUN \
20+
do $SYSTEM.OBJ.Load("Installer.cls", "ck") \
21+
set sc = ##class(App.Installer).setup()
1522

16-
RUN iris start $ISC_PACKAGE_INSTANCENAME quietly EmergencyId=sys,sys && \
17-
/bin/echo -e "sys\nsys\n" \
18-
" Do ##class(Security.Users).UnExpireUserPasswords(\"*\")\n" \
19-
" Do ##class(Security.Users).AddRoles(\"admin\", \"%ALL\")\n" \
20-
" Do ##class(Security.System).Get(,.p)\n" \
21-
" // 2**4 = 16; this sets bit 4 to enable OS authentication for the admin user" \
22-
" Set p(\"AutheEnabled\")=\$zboolean(p(\"AutheEnabled\"),16,7)\n" \
23-
" Do ##class(Security.System).Modify(,.p)\n" \
24-
" Do \$system.OBJ.Load(\"/opt/app/Installer.cls\",\"ck\")\n" \
25-
" Set sc = ##class(App.Installer).setup(, 3)\n" \
26-
" If 'sc do \$zu(4, \$JOB, 1)\n" \
27-
" halt" \
28-
| iris session $ISC_PACKAGE_INSTANCENAME && \
29-
/bin/echo -e "sys\nsys\n" \
30-
| iris stop $ISC_PACKAGE_INSTANCENAME quietly
31-
32-
CMD [ "-l", "/usr/irissys/mgr/messages.log" ]
23+
# bringing the standard shell back
24+
SHELL ["/bin/bash", "-c"]
25+
CMD [ "-l", "/usr/irissys/mgr/messages.log" ]

Installer.cls

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
Class App.Installer
22
{
33

4-
XData MyInstall [ XMLNamespace = INSTALLER ]
4+
XData setup
55
{
66
<Manifest>
7-
<Default Name="NAMESPACE" Value="SAMPLES"/>
8-
<Default Name="DBNAME" Value="SAMPLES"/>
9-
<Default Name="APPPATH" Dir="/opt/app/" />
10-
<Default Name="SOURCESPATH" Dir="${APPPATH}src" />
11-
<Default Name="RESOURCE" Value="%DB_${DBNAME}" />
7+
<Default Name="SourceDir" Value="#{$system.Process.CurrentDirectory()}src"/>
8+
<Default Name="Namespace" Value="SAMPLES"/>
9+
<Default Name="app" Value="irisapp" />
10+
11+
<Namespace Name="${Namespace}" Code="${Namespace}" Data="${Namespace}" Create="yes" Ensemble="no">
1212

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

19-
<Import File="${SOURCESPATH}" Recurse="1"/>
16+
<Import File="${SourceDir}" Flags="ck" Recurse="1"/>
17+
</Configuration>
18+
<CSPApplication Url="/csp/${app}" Directory="${cspdir}${app}" ServeFiles="1" Recurse="1" MatchRoles=":%DB_${Namespace}" AuthenticationMethods="32"
19+
20+
/>
2021
</Namespace>
2122

2223
</Manifest>
2324
}
2425

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

3032
}

docker-compose.yml

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
version: '2.4'
1+
version: '3.6'
22
services:
33
iris:
4-
build: .
4+
build:
5+
context: .
6+
dockerfile: Dockerfile
57
restart: always
6-
ports:
7-
- 52791:52773
8+
ports:
9+
- 51773
10+
- 52773
11+
- 53773
812
volumes:
913
- ~/iris.key:/usr/irissys/mgr/iris.key
10-
- ./:/iris/app
14+
- ./:/irisdev/app

irissession.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
iris start $ISC_PACKAGE_INSTANCENAME quietly
4+
5+
cat << EOF | iris session $ISC_PACKAGE_INSTANCENAME -U %SYS
6+
do ##class(%SYSTEM.Process).CurrentDirectory("$PWD")
7+
$@
8+
if '\$Get(sc) do ##class(%SYSTEM.Process).Terminate(, 1)
9+
zn "%SYS"
10+
do ##class(SYS.Container).QuiesceForBundling()
11+
Do ##class(Security.Users).UnExpireUserPasswords("*")
12+
halt
13+
EOF
14+
15+
exit=$?
16+
17+
iris stop $ISC_PACKAGE_INSTANCENAME quietly
18+
19+
exit $exit

module.xml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Export generator="Cache" version="25">
3+
<Document name="samples-objectscript.ZPM">
4+
<Module>
5+
<Name>samples-objectscript</Name>
6+
<Version>1.0.0</Version>
7+
<Packaging>module</Packaging>
8+
<SourcesRoot>src</SourcesRoot>
9+
<Resource Name="ObjectScript.PKG"/>
10+
</Module>
11+
12+
</Document>
13+
</Export>

0 commit comments

Comments
 (0)