@platformatic/foundation 3.13.1 → 3.15.0
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/lib/cli.js +29 -12
- package/lib/schema.js +80 -8
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -7,8 +7,9 @@ import { findConfigurationFileRecursive, loadConfigurationModule, saveConfigurat
|
|
|
7
7
|
import { hasJavascriptFiles } from './file-system.js'
|
|
8
8
|
import { detectApplicationType, getPlatformaticVersion } from './module.js'
|
|
9
9
|
|
|
10
|
-
/* c8 ignore next
|
|
10
|
+
/* c8 ignore next 4 - else branches */
|
|
11
11
|
let verbose = false
|
|
12
|
+
let prettyPrint = true
|
|
12
13
|
let executableId = ''
|
|
13
14
|
let executableName = ''
|
|
14
15
|
|
|
@@ -16,6 +17,10 @@ export function isVerbose () {
|
|
|
16
17
|
return verbose
|
|
17
18
|
}
|
|
18
19
|
|
|
20
|
+
export function usePrettyPrint () {
|
|
21
|
+
return prettyPrint
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
export function getExecutableId () {
|
|
20
25
|
return executableId
|
|
21
26
|
}
|
|
@@ -28,6 +33,10 @@ export function setVerbose (value) {
|
|
|
28
33
|
verbose = value
|
|
29
34
|
}
|
|
30
35
|
|
|
36
|
+
export function setPrettyPrint (value) {
|
|
37
|
+
prettyPrint = value
|
|
38
|
+
}
|
|
39
|
+
|
|
31
40
|
export function setExecutableId (id) {
|
|
32
41
|
executableId = id
|
|
33
42
|
}
|
|
@@ -76,15 +85,13 @@ export function logo (color = true) {
|
|
|
76
85
|
return color && isColorSupported ? str.replace(/\//g, s => green(s)) : str
|
|
77
86
|
}
|
|
78
87
|
|
|
79
|
-
export function createCliLogger (level) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
pinoPretty({
|
|
88
|
+
export function createCliLogger (level, noPretty) {
|
|
89
|
+
let pretty
|
|
90
|
+
|
|
91
|
+
if (noPretty) {
|
|
92
|
+
setPrettyPrint(false)
|
|
93
|
+
} else {
|
|
94
|
+
pretty = pinoPretty({
|
|
88
95
|
colorize: process.env.NO_COLOR !== 'true',
|
|
89
96
|
customPrettifiers: {
|
|
90
97
|
level (logLevel, _u1, _u2, { label, labelColorized }) {
|
|
@@ -94,6 +101,16 @@ export function createCliLogger (level) {
|
|
|
94
101
|
},
|
|
95
102
|
sync: true
|
|
96
103
|
})
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return pino(
|
|
107
|
+
{
|
|
108
|
+
level,
|
|
109
|
+
customLevels: {
|
|
110
|
+
done: 35
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
pretty
|
|
97
114
|
)
|
|
98
115
|
}
|
|
99
116
|
|
|
@@ -112,7 +129,7 @@ export function parseArgs (args, options, stopAtFirstPositional = true, strict =
|
|
|
112
129
|
args,
|
|
113
130
|
options,
|
|
114
131
|
allowPositionals: true,
|
|
115
|
-
allowNegative:
|
|
132
|
+
allowNegative: false,
|
|
116
133
|
strict: false,
|
|
117
134
|
tokens: true
|
|
118
135
|
})
|
|
@@ -129,7 +146,7 @@ export function parseArgs (args, options, stopAtFirstPositional = true, strict =
|
|
|
129
146
|
args,
|
|
130
147
|
options,
|
|
131
148
|
allowPositionals: true,
|
|
132
|
-
allowNegative:
|
|
149
|
+
allowNegative: false,
|
|
133
150
|
strict,
|
|
134
151
|
tokens: true
|
|
135
152
|
})
|
package/lib/schema.js
CHANGED
|
@@ -45,7 +45,20 @@ export const workers = {
|
|
|
45
45
|
type: 'number',
|
|
46
46
|
minimum: 1
|
|
47
47
|
},
|
|
48
|
-
{ type: 'string' }
|
|
48
|
+
{ type: 'string' },
|
|
49
|
+
{
|
|
50
|
+
type: 'object',
|
|
51
|
+
properties: {
|
|
52
|
+
static: { type: 'number', minimum: 1 },
|
|
53
|
+
dynamic: { type: 'boolean', default: false },
|
|
54
|
+
minimum: { type: 'number', minimum: 1 },
|
|
55
|
+
maximum: { type: 'number', minimum: 0 },
|
|
56
|
+
total: { type: 'number', minimum: 1 },
|
|
57
|
+
maxMemory: { type: 'number', minimum: 0 },
|
|
58
|
+
cooldown: { type: 'number', minimum: 0 },
|
|
59
|
+
gracePeriod: { type: 'number', minimum: 0 }
|
|
60
|
+
}
|
|
61
|
+
}
|
|
49
62
|
]
|
|
50
63
|
}
|
|
51
64
|
|
|
@@ -57,13 +70,13 @@ const verticalScaler = {
|
|
|
57
70
|
maxTotalMemory: { type: 'number', minimum: 0 },
|
|
58
71
|
minWorkers: { type: 'number', minimum: 1 },
|
|
59
72
|
maxWorkers: { type: 'number', minimum: 1 },
|
|
60
|
-
scaleUpELU: { type: 'number', minimum: 0, maximum: 1 },
|
|
61
|
-
scaleDownELU: { type: 'number', minimum: 0, maximum: 1 },
|
|
62
|
-
timeWindowSec: { type: 'number', minimum: 0 },
|
|
63
|
-
scaleDownTimeWindowSec: { type: 'number', minimum: 0 },
|
|
64
73
|
cooldownSec: { type: 'number', minimum: 0 },
|
|
65
|
-
|
|
66
|
-
|
|
74
|
+
gracePeriod: { type: 'number', minimum: 0 },
|
|
75
|
+
scaleUpELU: { type: 'number', minimum: 0, maximum: 1, deprecated: true },
|
|
76
|
+
scaleDownELU: { type: 'number', minimum: 0, maximum: 1, deprecated: true },
|
|
77
|
+
timeWindowSec: { type: 'number', minimum: 0, deprecated: true },
|
|
78
|
+
scaleDownTimeWindowSec: { type: 'number', minimum: 0, deprecated: true },
|
|
79
|
+
scaleIntervalSec: { type: 'number', minimum: 0, deprecated: true }
|
|
67
80
|
},
|
|
68
81
|
additionalProperties: false
|
|
69
82
|
}
|
|
@@ -731,7 +744,28 @@ export const applications = {
|
|
|
731
744
|
useHttp: {
|
|
732
745
|
type: 'boolean'
|
|
733
746
|
},
|
|
734
|
-
|
|
747
|
+
reuseTcpPorts: {
|
|
748
|
+
type: 'boolean',
|
|
749
|
+
default: true
|
|
750
|
+
},
|
|
751
|
+
workers: {
|
|
752
|
+
anyOf: [
|
|
753
|
+
{
|
|
754
|
+
type: 'number'
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
type: 'string'
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
type: 'object',
|
|
761
|
+
properties: {
|
|
762
|
+
static: { type: 'number', minimum: 1 },
|
|
763
|
+
minimum: { type: 'number', minimum: 1 },
|
|
764
|
+
maximum: { type: 'number', minimum: 0 }
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
]
|
|
768
|
+
},
|
|
735
769
|
health: { ...healthWithoutDefaults },
|
|
736
770
|
dependencies: {
|
|
737
771
|
type: 'array',
|
|
@@ -886,6 +920,10 @@ export const runtimeProperties = {
|
|
|
886
920
|
},
|
|
887
921
|
logger,
|
|
888
922
|
server,
|
|
923
|
+
reuseTcpPorts: {
|
|
924
|
+
type: 'boolean',
|
|
925
|
+
default: true
|
|
926
|
+
},
|
|
889
927
|
startTimeout: {
|
|
890
928
|
default: 30000,
|
|
891
929
|
type: 'number',
|
|
@@ -1147,6 +1185,40 @@ export const runtimeProperties = {
|
|
|
1147
1185
|
timeout: {
|
|
1148
1186
|
anyOf: [{ type: 'integer' }, { type: 'string' }],
|
|
1149
1187
|
default: 10000
|
|
1188
|
+
},
|
|
1189
|
+
otlpExporter: {
|
|
1190
|
+
type: 'object',
|
|
1191
|
+
description: 'Configuration for exporting metrics to an OTLP endpoint',
|
|
1192
|
+
properties: {
|
|
1193
|
+
enabled: {
|
|
1194
|
+
anyOf: [{ type: 'boolean' }, { type: 'string' }],
|
|
1195
|
+
description: 'Enable or disable OTLP metrics export'
|
|
1196
|
+
},
|
|
1197
|
+
endpoint: {
|
|
1198
|
+
type: 'string',
|
|
1199
|
+
description: 'OTLP endpoint URL (e.g., http://collector:4318/v1/metrics)'
|
|
1200
|
+
},
|
|
1201
|
+
interval: {
|
|
1202
|
+
anyOf: [{ type: 'integer' }, { type: 'string' }],
|
|
1203
|
+
default: 60000,
|
|
1204
|
+
description: 'Interval in milliseconds between metric pushes'
|
|
1205
|
+
},
|
|
1206
|
+
headers: {
|
|
1207
|
+
type: 'object',
|
|
1208
|
+
additionalProperties: { type: 'string' },
|
|
1209
|
+
description: 'Additional HTTP headers for authentication'
|
|
1210
|
+
},
|
|
1211
|
+
serviceName: {
|
|
1212
|
+
type: 'string',
|
|
1213
|
+
description: 'Service name for OTLP resource attributes'
|
|
1214
|
+
},
|
|
1215
|
+
serviceVersion: {
|
|
1216
|
+
type: 'string',
|
|
1217
|
+
description: 'Service version for OTLP resource attributes'
|
|
1218
|
+
}
|
|
1219
|
+
},
|
|
1220
|
+
required: ['endpoint'],
|
|
1221
|
+
additionalProperties: false
|
|
1150
1222
|
}
|
|
1151
1223
|
},
|
|
1152
1224
|
additionalProperties: false
|