From 0344c2ab29b1de8732112df88841d84a42e2da79 Mon Sep 17 00:00:00 2001 From: Pierre Chanson Date: Thu, 23 Jan 2020 10:34:33 +0100 Subject: [PATCH 1/5] Remove Iceberg repositroy version fetching for a version set at start from environment variable --- source/SnapDump-Server/SDServer.class.st | 9 +-------- source/SnapDump-Server/SDServerDelegate.class.st | 2 +- source/SnapDump-Server/SDServerVersionCall.class.st | 2 +- source/SnapDump-Server/SnapDumpAPI.class.st | 2 +- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/source/SnapDump-Server/SDServer.class.st b/source/SnapDump-Server/SDServer.class.st index 8874237..145dfa5 100644 --- a/source/SnapDump-Server/SDServer.class.st +++ b/source/SnapDump-Server/SDServer.class.st @@ -27,13 +27,6 @@ SDServer class >> port: aNumber path: aFileReference [ yourself ] -{ #category : #accessing } -SDServer class >> repositoryDescription [ - | snapDumpRepo | - snapDumpRepo := IceRepository registry detect: [ :each | each name = 'SnapDump' ]. - ^ snapDumpRepo head description -] - { #category : #'as yet unclassified' } SDServer class >> startOnPort: aNumber path: aFileReference [ ^ self instance @@ -50,7 +43,7 @@ SDServer class >> stop [ { #category : #accessing } SDServer class >> version [ - ^ version + ^ version ifNil: [ 'None' ] ] { #category : #accessing } diff --git a/source/SnapDump-Server/SDServerDelegate.class.st b/source/SnapDump-Server/SDServerDelegate.class.st index 6d27fd5..025f399 100644 --- a/source/SnapDump-Server/SDServerDelegate.class.st +++ b/source/SnapDump-Server/SDServerDelegate.class.st @@ -12,7 +12,7 @@ SDServerDelegate >> serverError: request exception: exception [ [ self store storeSnapshot: (exception asSnapshot projectName: 'SnapDump'; - versionString: (SDServer version ifNil: [ 'None' ]); + versionString: SDServer version; yourself ) ] on: Error do: [ :err | "nothing we can do here" ] . ^ super serverError: request exception: exception diff --git a/source/SnapDump-Server/SDServerVersionCall.class.st b/source/SnapDump-Server/SDServerVersionCall.class.st index fd34db1..bfa3580 100644 --- a/source/SnapDump-Server/SDServerVersionCall.class.st +++ b/source/SnapDump-Server/SDServerVersionCall.class.st @@ -13,6 +13,6 @@ SDServerVersionCall class >> path [ SDServerVersionCall >> get [ response := ZnResponse ok: ( ZnEntity - with: SDServer repositoryDescription + with: SDServer version type: ZnMimeType applicationJson setCharSetUTF8) ] diff --git a/source/SnapDump-Server/SnapDumpAPI.class.st b/source/SnapDump-Server/SnapDumpAPI.class.st index 41b7801..a0bdb3c 100644 --- a/source/SnapDump-Server/SnapDumpAPI.class.st +++ b/source/SnapDump-Server/SnapDumpAPI.class.st @@ -16,7 +16,7 @@ SnapDumpAPI class >> rootCallClass [ SnapDumpAPI >> info [ ^ OAInfo new description: 'SnapDump API'; - version: '0.7'; + version: SDServer version; title: 'SnapDump API'; contact: (OAContact new name: 'Norbert Hartl'; From 285a900ab42c6d9925571dcb03a1b00d47d2744e Mon Sep 17 00:00:00 2001 From: Pierre Chanson Date: Thu, 23 Jan 2020 10:37:51 +0100 Subject: [PATCH 2/5] uses docker tag env variable at start to set the server version. fixes #24 --- start.st | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/start.st b/start.st index 86b44dc..c111239 100644 --- a/start.st +++ b/start.st @@ -1,4 +1,4 @@ -| apiHandler healthHandler metricsHandler prefixHandler server | +| apiHandler healthHandler metricsHandler prefixHandler server dockerTag | Author fullName: 'docker'. ZnLogEvent logToTranscript. @@ -6,4 +6,7 @@ ZnLogEvent logToTranscript. SnapDump hackUIManager. "SnapDump current store: (SDFilesystemStore new path: '/snapshots')." +dockerTag := (OSEnvironment current getEnv: 'DOCKER_TAG'). +SDServer version: dockerTag. + SDServer startOnPort: 5555 path: '/snapshots' From f35bf213fbf87b3afe7c30fd3ea31f83260d6093 Mon Sep 17 00:00:00 2001 From: Pierre Chanson Date: Thu, 23 Jan 2020 11:00:08 +0100 Subject: [PATCH 3/5] eval version setting of SDServer in DockerFile Run --- Dockerfile | 1 + start.st | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9ee1bcb..0c2bbdf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,7 @@ ARG CACHEBUST=1 RUN \ /opt/pharo /opt/SnapDump.image eval --save "Metacello new repository: 'filetree:///opt/source'; baseline: #SnapDump; load: #('server')" && \ /opt/pharo /opt/SnapDump.image eval --save "SnapDump prepareForDeployment" && \ + /opt/pharo /opt/SnapDump.image eval --save "SDServer version: '$DOCKER_TAG'" && \ rm -rf /opt/pharo-local RUN \ diff --git a/start.st b/start.st index c111239..754d51e 100644 --- a/start.st +++ b/start.st @@ -6,7 +6,4 @@ ZnLogEvent logToTranscript. SnapDump hackUIManager. "SnapDump current store: (SDFilesystemStore new path: '/snapshots')." -dockerTag := (OSEnvironment current getEnv: 'DOCKER_TAG'). -SDServer version: dockerTag. - SDServer startOnPort: 5555 path: '/snapshots' From 4a8326fc47827c78b7c75d46b5bb0267af4f1ccd Mon Sep 17 00:00:00 2001 From: Pierre Chanson Date: Thu, 23 Jan 2020 11:02:59 +0100 Subject: [PATCH 4/5] remove extra variable name --- start.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.st b/start.st index 754d51e..86b44dc 100644 --- a/start.st +++ b/start.st @@ -1,4 +1,4 @@ -| apiHandler healthHandler metricsHandler prefixHandler server dockerTag | +| apiHandler healthHandler metricsHandler prefixHandler server | Author fullName: 'docker'. ZnLogEvent logToTranscript. From d2c4bcfa415bade97e0db09c826416ed3ae4568a Mon Sep 17 00:00:00 2001 From: Pierre Chanson Date: Thu, 23 Jan 2020 17:05:36 +0100 Subject: [PATCH 5/5] use Snapshot apiVersion for openAPi api version --- source/SnapDump-Server/SnapDumpAPI.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/SnapDump-Server/SnapDumpAPI.class.st b/source/SnapDump-Server/SnapDumpAPI.class.st index a0bdb3c..522a47b 100644 --- a/source/SnapDump-Server/SnapDumpAPI.class.st +++ b/source/SnapDump-Server/SnapDumpAPI.class.st @@ -16,7 +16,7 @@ SnapDumpAPI class >> rootCallClass [ SnapDumpAPI >> info [ ^ OAInfo new description: 'SnapDump API'; - version: SDServer version; + version: SDSnapshot apiVersion; title: 'SnapDump API'; contact: (OAContact new name: 'Norbert Hartl';