Skip to content

Commit 0aabaf2

Browse files
authored
Merge pull request #71 from intersystems-community/publish_date
Publish date added
2 parents fa7872b + 843a419 commit 0aabaf2

File tree

6 files changed

+50
-28
lines changed

6 files changed

+50
-28
lines changed

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
**/.DS_Store
1+
**/.DS_Store
2+
.*

.vscode/settings.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@
77
"username": "_SYSTEM",
88
"password": "SYS",
99
"ns": "REGISTRY",
10-
"port": 52773,
11-
"addCategory": true,
10+
"host": "localhost",
11+
"port": 52774,
1212
"links": {
1313
"Swagger spec": "http://${host}:${port}/registry/_spec",
1414
"All Packages": "http://${host}:${port}/registry/packages/-/all"
1515
}
16+
},
17+
"objectscript.export": {
18+
"folder": "src",
19+
"addCategory": true
1620
}
1721
}

Dockerfile

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1-
#FROM store/intersystems/iris-community:2020.1.0.215.0
2-
FROM intersystemsdc/iris-community:2020.4.0.524.0-zpm
1+
FROM containers.intersystems.com/intersystems/iris-community:2022.2.0.270.0
32

4-
USER root
3+
WORKDIR /opt/registry
54

6-
COPY zpm-registry.yaml /usr/irissys/
5+
USER root
76

8-
WORKDIR /opt/zpm
9-
RUN chown ${ISC_PACKAGE_MGRUSER}:${ISC_PACKAGE_IRISGROUP} .
7+
RUN chown irisowner:irisowner .
108

119
USER irisowner
1210

13-
COPY Installer.cls .
14-
COPY SQLPriv.xml .
15-
COPY src src
16-
COPY irissession.sh /
17-
SHELL ["/irissession.sh"]
18-
19-
RUN \
20-
do $SYSTEM.OBJ.Load("Installer.cls", "ck") \
21-
set sc = ##class(ZPM.Installer).setup() \
22-
zn "registry" \
23-
zpm "install yaml-utils"
24-
25-
# bringing the standard shell back
26-
SHELL ["/bin/bash", "-c"]
27-
28-
11+
COPY --chown=irisowner:irisowner . .
12+
13+
RUN \
14+
VERSION=$(sed -n 's|.*<Version>\(.*\)</Version>.*|\1|p' module.xml | head -1) && \
15+
sed -i 's|^Parameter VERSION .*$|Parameter VERSION = "'"$VERSION"'";|g' \
16+
./src/cls/ZPM/Registry.cls && \
17+
iris start ${ISC_PACKAGE_INSTANCENAME} && \
18+
/bin/echo -e "" \
19+
" zn \"%SYS\"" \
20+
" do ##class(%SYSTEM.Process).CurrentDirectory(\"$PWD\")" \
21+
" do ##class(%SYSTEM.OBJ).Load(\"Installer.cls\", \"ck\")" \
22+
" set sc = ##class(ZPM.Installer).setup() " \
23+
" if '\$Get(sc) { do ##class(%SYSTEM.Process).Terminate(, 1) }" \
24+
" halt" \
25+
| iris session ${ISC_PACKAGE_INSTANCENAME} -U %SYS && \
26+
tail /usr/irissys/mgr/messages.log && \
27+
iris stop ${ISC_PACKAGE_INSTANCENAME} quietly && \
28+
rm -rf /usr/irissys/mgr/IRIS.WIJ && \
29+
rm -rf /usr/irissys/mgr/journal/*

module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<Module>
55
<Name>zpm-registry</Name>
66
<Description>Registry server for ZPM</Description>
7-
<Version>1.1.4</Version>
7+
<Version>1.1.5</Version>
88
<Packaging>module</Packaging>
99
<Dependencies>
1010
<ModuleReference>

src/cls/ZPM/Package.cls

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ Property versionPrerelease As %String [ SqlComputeCode = {Set {*} = $Piece($Piec
5555

5656
Property versionBuildmetadata As %String [ SqlComputeCode = {Set {*} = $Piece({version},"+",2)}, SqlComputed, SqlComputeOnChange = %%INSERT ];
5757

58+
Property publishTS As %PosixTime [ SqlComputeCode = {Set {*} = ##class(%Library.PosixTime).CurrentUTCTimeStamp()}, SqlComputed, SqlComputeOnChange = %%INSERT ];
59+
5860
Property UpLink As ZPM.UpLink(%JSONINCLUDE = "NONE");
5961

6062
ForeignKey UpLinkFK(UpLink) References ZPM.UpLink() [ OnDelete = cascade ];
@@ -97,7 +99,10 @@ ClassMethod ServerURL() As %String
9799
Set host = host_":"_port
98100
}
99101
}
100-
//Set host = host_$p(%request.Application,"/",1,*-1)
102+
#; If not behind the proxy where it have to be hidden redirect from / to /registry
103+
if %request.GetCgiEnv("HTTP_X_FORWARDED_HOST")="" {
104+
Set host = host _ $p(%request.Application, "/" ,1,*-1)
105+
}
101106
Return host
102107
}
103108

@@ -618,6 +623,9 @@ Storage Default
618623
<Value name="19">
619624
<Value>UpLink</Value>
620625
</Value>
626+
<Value name="20">
627+
<Value>publishTS</Value>
628+
</Value>
621629
</Data>
622630
<Data name="dependencies">
623631
<Attribute>dependencies</Attribute>

src/cls/ZPM/Registry.cls

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Class ZPM.Registry Extends ZPM.REST.Base
33
{
44

5+
Parameter VERSION = "1.0.0";
6+
57
XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]
68
{
79
<Routes>
@@ -50,7 +52,13 @@ XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]
5052
/// Package Manager general information
5153
ClassMethod GetInfo() As %Status
5254
{
53-
SET version = $get(^RegistryVersion, "0.0.2")
55+
SET version = ..#VERSION
56+
If $System.CLS.IsMthd("%ZPM.PackageManager.Developer.Module", "NameOpen") {
57+
Set zpmModule = ##class(%ZPM.PackageManager.Developer.Module).NameOpen("zpm-registry")
58+
If $IsObject(zpmModule) {
59+
Set version = zpmModule.VersionString
60+
}
61+
}
5462
SET info = {
5563
"version": (version)
5664
}

0 commit comments

Comments
 (0)