presidium 4.5.2 → 4.5.4
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 +18 -11
- package/README.md +10 -1
- package/internal/createUpdateServiceSpec.js +8 -2
- package/package.json +5 -4
package/Docker.js
CHANGED
|
@@ -1650,6 +1650,7 @@ class Docker {
|
|
|
1650
1650
|
* * `rollbackMonitor` - the amount of time in nanoseconds to monitor each rolled back task for failures. Defaults to `15e9`.
|
|
1651
1651
|
* * `rollbackMaxFailureRatio` - the maximum ratio of tasks that may fail during a rollback before the failure action is invoked. Defaults to `0.15`.
|
|
1652
1652
|
* * `network` - the network name or ID for attachment.
|
|
1653
|
+
* * `networks` - the names or IDs of networks for attachment.
|
|
1653
1654
|
* * `cmd` - the command that to be run by the Docker service.
|
|
1654
1655
|
* * `workdir` - the working directory of the containers of the Docker service.
|
|
1655
1656
|
* * `env` - an object of the Docker service's environment variables. Maps environment variable names to environment variable values, e.g. `{ FOO: 'bar' }`.
|
|
@@ -1684,7 +1685,7 @@ class Docker {
|
|
|
1684
1685
|
* * [Docker Swarm](https://docs.docker.com/engine/swarm/)
|
|
1685
1686
|
*/
|
|
1686
1687
|
async createService(service, options = {}) {
|
|
1687
|
-
const
|
|
1688
|
+
const config = {
|
|
1688
1689
|
Name: service,
|
|
1689
1690
|
Labels: options.labels ?? {},
|
|
1690
1691
|
TaskTemplate: {
|
|
@@ -1739,6 +1740,20 @@ class Docker {
|
|
|
1739
1740
|
}),
|
|
1740
1741
|
},
|
|
1741
1742
|
|
|
1743
|
+
...options.networks ? {
|
|
1744
|
+
Networks: options.networks.map(all({
|
|
1745
|
+
Target: __,
|
|
1746
|
+
Aliases: [],
|
|
1747
|
+
DriverOpts: {},
|
|
1748
|
+
}))
|
|
1749
|
+
} : options.network ? {
|
|
1750
|
+
Networks: [{
|
|
1751
|
+
Target: options.network,
|
|
1752
|
+
Aliases: [],
|
|
1753
|
+
DriverOpts: {},
|
|
1754
|
+
}],
|
|
1755
|
+
} : {},
|
|
1756
|
+
|
|
1742
1757
|
Resources: {
|
|
1743
1758
|
Reservations: {
|
|
1744
1759
|
...options.memory ? {
|
|
@@ -1789,14 +1804,6 @@ class Docker {
|
|
|
1789
1804
|
MaxFailureRatio: get('rollbackMaxFailureRatio', 0.15),
|
|
1790
1805
|
})(options),
|
|
1791
1806
|
|
|
1792
|
-
...options.network && {
|
|
1793
|
-
Networks: [{
|
|
1794
|
-
Target: options.network,
|
|
1795
|
-
Aliases: [],
|
|
1796
|
-
DriverOpts: {},
|
|
1797
|
-
}],
|
|
1798
|
-
},
|
|
1799
|
-
|
|
1800
1807
|
...options.publish && {
|
|
1801
1808
|
EndpointSpec: {
|
|
1802
1809
|
Ports: Object.entries(options.publish).map(pipe([
|
|
@@ -1814,10 +1821,10 @@ class Docker {
|
|
|
1814
1821
|
])),
|
|
1815
1822
|
},
|
|
1816
1823
|
},
|
|
1817
|
-
}
|
|
1824
|
+
}
|
|
1818
1825
|
|
|
1819
1826
|
const response = await this.http.post('/services/create', {
|
|
1820
|
-
body,
|
|
1827
|
+
body: JSON.stringify(config),
|
|
1821
1828
|
headers: {
|
|
1822
1829
|
'Content-Type': 'application/json',
|
|
1823
1830
|
'X-Registry-Auth': pipe(options, [
|
package/README.md
CHANGED
|
@@ -28,6 +28,15 @@ License: [CFOSS](https://cloutsworld.com/en-us/legal/license/cfoss)
|
|
|
28
28
|
[](https://codecov.io/gh/richytong/presidium-db)
|
|
29
29
|
[](https://www.npmjs.com/package/presidium-db)
|
|
30
30
|
|
|
31
|
+
### Presidium DB Client and Server
|
|
32
|
+
|
|
33
|
+
Source code: [GitHub](https://github.com/richytong/presidium-db-client-server) |
|
|
34
|
+
License: [CFOSS](https://cloutsworld.com/en-us/legal/license/cfoss)
|
|
35
|
+
|
|
36
|
+

|
|
37
|
+
[](https://codecov.io/gh/richytong/presidium-db-client-server)
|
|
38
|
+
[](https://www.npmjs.com/package/presidium-db-client-server)
|
|
39
|
+
|
|
31
40
|
## Installation
|
|
32
41
|
with [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm):
|
|
33
42
|
```bash
|
|
@@ -521,5 +530,5 @@ for await (const postJson of postHt.reverseIterator()) {
|
|
|
521
530
|
## License
|
|
522
531
|
Presidium is distributed under the [CFOSS License](https://cloutsworld.com/en-us/legal/license/cfoss).
|
|
523
532
|
|
|
524
|
-
|
|
533
|
+
## Support
|
|
525
534
|
* minimum Node.js version: 16
|
|
@@ -228,8 +228,14 @@ const createUpdateServiceSpec = function (options) {
|
|
|
228
228
|
result.RollbackConfig.MaxFailureRatio = options.rollbackMaxFailureRatio
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
if (options.
|
|
232
|
-
result.Networks =
|
|
231
|
+
if (options.networks) {
|
|
232
|
+
result.TaskTemplate.Networks = options.networks.map(all({
|
|
233
|
+
Target: __,
|
|
234
|
+
Aliases: [],
|
|
235
|
+
DriverOpts: {},
|
|
236
|
+
}))
|
|
237
|
+
} else if (options.network) {
|
|
238
|
+
result.TaskTemplate.Networks = [{
|
|
233
239
|
Target: options.network,
|
|
234
240
|
Aliases: [],
|
|
235
241
|
DriverOpts: {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "presidium",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.4",
|
|
4
4
|
"description": "The Presidium library.",
|
|
5
5
|
"author": "Richard Tong",
|
|
6
6
|
"license": "CFOSS",
|
|
@@ -64,9 +64,10 @@
|
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"adm-zip": "^0.6.1",
|
|
66
66
|
"html-entities": "^2.6.0",
|
|
67
|
-
"presidium-db": "
|
|
68
|
-
"presidium-
|
|
69
|
-
"
|
|
67
|
+
"presidium-db": "^4.6.2",
|
|
68
|
+
"presidium-db-client-server": "^0.3.1",
|
|
69
|
+
"presidium-websocket": "^4.2.2",
|
|
70
|
+
"rubico": "^2.21.0",
|
|
70
71
|
"uniqid": "^5.4.0"
|
|
71
72
|
},
|
|
72
73
|
"scripts": {
|