presidium 0.19.1 → 0.19.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Docker.js +4 -2
- package/Docker.test.js +2 -2
- package/DockerService.js +2 -7
- package/DockerService.test.js +3 -3
- package/package.json +1 -1
package/Docker.js
CHANGED
|
@@ -873,10 +873,12 @@ Docker.prototype.createService = function dockerCreateService(service, options)
|
|
|
873
873
|
},
|
|
874
874
|
},
|
|
875
875
|
|
|
876
|
-
|
|
877
|
-
|
|
876
|
+
Mode: options.replicas == 'global' ? {
|
|
877
|
+
Global: {},
|
|
878
|
+
} : {
|
|
878
879
|
Replicated: { Replicas: options.replicas ?? 1 }
|
|
879
880
|
},
|
|
881
|
+
|
|
880
882
|
UpdateConfig: fork({
|
|
881
883
|
Parallelism: get('updateParallelism', 2),
|
|
882
884
|
Delay: get('updateDelay', 1e9),
|
package/Docker.test.js
CHANGED
|
@@ -373,7 +373,7 @@ EXPOSE 8888`,
|
|
|
373
373
|
{ // create another service
|
|
374
374
|
const response = await docker.createService('hey2', {
|
|
375
375
|
image: 'node:15-alpine',
|
|
376
|
-
replicas:
|
|
376
|
+
replicas: 'global',
|
|
377
377
|
cmd: ['node', '-e', 'http.createServer((request, response) => response.end(\'hey2\')).listen(3001)'],
|
|
378
378
|
workdir: '/opt/heyo',
|
|
379
379
|
env: { HEY: 'hey' },
|
|
@@ -401,7 +401,7 @@ EXPOSE 8888`,
|
|
|
401
401
|
{ // listTasks
|
|
402
402
|
const response = await docker.listTasks()
|
|
403
403
|
const body = await response.json()
|
|
404
|
-
assert.equal(body.length,
|
|
404
|
+
assert.equal(body.length, 3) // 2 for hey1, 1 for hey2 (global)
|
|
405
405
|
}
|
|
406
406
|
|
|
407
407
|
{ // inspectService
|
package/DockerService.js
CHANGED
|
@@ -47,7 +47,7 @@ const dockerServiceOptions = [
|
|
|
47
47
|
* new DockerService({
|
|
48
48
|
* name: string,
|
|
49
49
|
* image: string,
|
|
50
|
-
* replicas: 1|number,
|
|
50
|
+
* replicas: 'global'|1|number,
|
|
51
51
|
* restart: 'no'|'on-failure[:<max-retries>]'|'any',
|
|
52
52
|
* restartDelay: 10e9|number, // nanoseconds to delay between restarts
|
|
53
53
|
* logDriver: 'json-file'|'syslog'|'journald'|'gelf'|'fluentd'|'awslogs'|'splunk'|'none',
|
|
@@ -141,11 +141,6 @@ DockerService.prototype.deploy = async function deploy() {
|
|
|
141
141
|
|
|
142
142
|
// service exists
|
|
143
143
|
if (inspectServiceResponse.ok) {
|
|
144
|
-
const serviceData = await inspectServiceResponse.json()
|
|
145
|
-
const deployedImage = serviceData.Spec.TaskTemplate.ContainerSpec.Image
|
|
146
|
-
if (this.image == deployedImage) {
|
|
147
|
-
return { message: 'noop' }
|
|
148
|
-
}
|
|
149
144
|
await this.update(this.serviceOptions)
|
|
150
145
|
return { message: 'success' }
|
|
151
146
|
}
|
|
@@ -179,7 +174,7 @@ DockerService.prototype.synchronize = function dockerServiceSynchronize() {
|
|
|
179
174
|
* rollback: 'previous', // roll service back to previous version
|
|
180
175
|
*
|
|
181
176
|
* image: string,
|
|
182
|
-
* replicas:
|
|
177
|
+
* replicas: 'global'|number,
|
|
183
178
|
* restart: 'no'|'on-failure[:<max-retries>]'|'any',
|
|
184
179
|
* restartDelay: 10e9|number, // nanoseconds to delay between restarts
|
|
185
180
|
* logDriver: 'json-file'|'syslog'|'journald'|'gelf'|'fluentd'|'awslogs'|'splunk'|'none',
|
package/DockerService.test.js
CHANGED
|
@@ -106,16 +106,16 @@ const test = new Test('DockerService', DockerService)
|
|
|
106
106
|
await new Promise(resolve => logResponseStream.on('end', resolve))
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
// further deploys should
|
|
109
|
+
// further deploys should update
|
|
110
110
|
{
|
|
111
111
|
const { message } = await myService.deploy()
|
|
112
|
-
assert.equal(message, '
|
|
112
|
+
assert.equal(message, 'success')
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
// further deploys should noop
|
|
116
116
|
{
|
|
117
117
|
const { message } = await myService.deploy()
|
|
118
|
-
assert.equal(message, '
|
|
118
|
+
assert.equal(message, 'success')
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
})
|