@platformatic/runtime 3.0.6 → 3.2.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/config.d.ts +1 -2
- package/lib/generator.js +1 -1
- package/lib/prom-server.js +9 -0
- package/lib/runtime.js +20 -21
- package/package.json +16 -16
- package/schema.json +14 -3
package/config.d.ts
CHANGED
package/lib/generator.js
CHANGED
package/lib/prom-server.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import fastifyAccepts from '@fastify/accepts'
|
|
2
2
|
import fastifyBasicAuth from '@fastify/basic-auth'
|
|
3
|
+
import { loadModule } from '@platformatic/foundation'
|
|
3
4
|
import fastify from 'fastify'
|
|
5
|
+
import { createRequire } from 'node:module'
|
|
6
|
+
import { resolve } from 'node:path'
|
|
4
7
|
|
|
5
8
|
const DEFAULT_HOSTNAME = '0.0.0.0'
|
|
6
9
|
const DEFAULT_PORT = 9090
|
|
@@ -218,6 +221,12 @@ export async function startPrometheusServer (runtime, opts) {
|
|
|
218
221
|
})
|
|
219
222
|
}
|
|
220
223
|
|
|
224
|
+
const require = createRequire(resolve(import.meta.filename))
|
|
225
|
+
for (const pluginPath of opts.plugins ?? []) {
|
|
226
|
+
const plugin = await loadModule(require, pluginPath)
|
|
227
|
+
await promServer.register(plugin)
|
|
228
|
+
}
|
|
229
|
+
|
|
221
230
|
await promServer.listen({ port, host })
|
|
222
231
|
return promServer
|
|
223
232
|
}
|
package/lib/runtime.js
CHANGED
|
@@ -294,20 +294,24 @@ export class Runtime extends EventEmitter {
|
|
|
294
294
|
|
|
295
295
|
const stopInvocations = []
|
|
296
296
|
|
|
297
|
-
const allApplications = await this.getApplications(true)
|
|
298
|
-
|
|
299
297
|
// Construct the reverse dependency graph
|
|
300
298
|
const dependents = {}
|
|
301
|
-
for (const application of allApplications.applications) {
|
|
302
|
-
for (const dependency of application.dependencies ?? []) {
|
|
303
|
-
let applicationDependents = dependents[dependency]
|
|
304
|
-
if (!applicationDependents) {
|
|
305
|
-
applicationDependents = new Set()
|
|
306
|
-
dependents[dependency] = applicationDependents
|
|
307
|
-
}
|
|
308
299
|
|
|
309
|
-
|
|
300
|
+
try {
|
|
301
|
+
const allApplications = await this.getApplications(true)
|
|
302
|
+
for (const application of allApplications.applications) {
|
|
303
|
+
for (const dependency of application.dependencies ?? []) {
|
|
304
|
+
let applicationDependents = dependents[dependency]
|
|
305
|
+
if (!applicationDependents) {
|
|
306
|
+
applicationDependents = new Set()
|
|
307
|
+
dependents[dependency] = applicationDependents
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
applicationDependents.add(application.id)
|
|
311
|
+
}
|
|
310
312
|
}
|
|
313
|
+
} catch (e) {
|
|
314
|
+
// Noop - This only happens if stop is invoked after a failed start, in which case we don't care about deps
|
|
311
315
|
}
|
|
312
316
|
|
|
313
317
|
for (const application of this.getApplicationsIds()) {
|
|
@@ -1606,17 +1610,12 @@ export class Runtime extends EventEmitter {
|
|
|
1606
1610
|
if (enabled && config.restartOnError > 0) {
|
|
1607
1611
|
// if gracePeriod is 0, it will be set to 1 to start health checks immediately
|
|
1608
1612
|
// however, the health event will start when the worker is started
|
|
1609
|
-
setTimeout(
|
|
1610
|
-
|
|
1611
|
-
config,
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
index,
|
|
1616
|
-
worker,
|
|
1617
|
-
label
|
|
1618
|
-
)
|
|
1619
|
-
}, gracePeriod > 0 ? gracePeriod : 1).unref()
|
|
1613
|
+
setTimeout(
|
|
1614
|
+
() => {
|
|
1615
|
+
this.#setupHealthCheck(config, applicationConfig, workersCount, id, index, worker, label)
|
|
1616
|
+
},
|
|
1617
|
+
gracePeriod > 0 ? gracePeriod : 1
|
|
1618
|
+
).unref()
|
|
1620
1619
|
}
|
|
1621
1620
|
} catch (err) {
|
|
1622
1621
|
const error = ensureError(err)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/runtime",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"typescript": "^5.5.4",
|
|
35
35
|
"undici-oidc-interceptor": "^0.5.0",
|
|
36
36
|
"why-is-node-running": "^2.2.2",
|
|
37
|
-
"@platformatic/
|
|
38
|
-
"@platformatic/
|
|
39
|
-
"@platformatic/gateway": "3.0
|
|
40
|
-
"@platformatic/service": "3.0
|
|
41
|
-
"@platformatic/sql-graphql": "3.0
|
|
42
|
-
"@platformatic/node": "3.0
|
|
43
|
-
"@platformatic/
|
|
44
|
-
"@platformatic/
|
|
37
|
+
"@platformatic/composer": "3.2.0",
|
|
38
|
+
"@platformatic/db": "3.2.0",
|
|
39
|
+
"@platformatic/gateway": "3.2.0",
|
|
40
|
+
"@platformatic/service": "3.2.0",
|
|
41
|
+
"@platformatic/sql-graphql": "3.2.0",
|
|
42
|
+
"@platformatic/node": "3.2.0",
|
|
43
|
+
"@platformatic/sql-mapper": "3.2.0",
|
|
44
|
+
"@platformatic/wattpm-pprof-capture": "3.2.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@fastify/accepts": "^5.0.0",
|
|
@@ -71,15 +71,15 @@
|
|
|
71
71
|
"undici": "^7.0.0",
|
|
72
72
|
"undici-thread-interceptor": "^0.14.0",
|
|
73
73
|
"ws": "^8.16.0",
|
|
74
|
-
"@platformatic/basic": "3.0
|
|
75
|
-
"@platformatic/
|
|
76
|
-
"@platformatic/
|
|
77
|
-
"@platformatic/
|
|
78
|
-
"@platformatic/metrics": "3.0
|
|
79
|
-
"@platformatic/telemetry": "3.0
|
|
74
|
+
"@platformatic/basic": "3.2.0",
|
|
75
|
+
"@platformatic/foundation": "3.2.0",
|
|
76
|
+
"@platformatic/generators": "3.2.0",
|
|
77
|
+
"@platformatic/itc": "3.2.0",
|
|
78
|
+
"@platformatic/metrics": "3.2.0",
|
|
79
|
+
"@platformatic/telemetry": "3.2.0"
|
|
80
80
|
},
|
|
81
81
|
"engines": {
|
|
82
|
-
"node": ">=22.
|
|
82
|
+
"node": ">=22.19.0"
|
|
83
83
|
},
|
|
84
84
|
"scripts": {
|
|
85
85
|
"test": "npm run test:main && npm run test:api && npm run test:cli && npm run test:start && npm run test:multiple-workers",
|
package/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/runtime/3.0.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/runtime/3.2.0.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"title": "Platformatic Runtime Config",
|
|
5
5
|
"type": "object",
|
|
@@ -1665,8 +1665,19 @@
|
|
|
1665
1665
|
}
|
|
1666
1666
|
]
|
|
1667
1667
|
},
|
|
1668
|
-
"
|
|
1669
|
-
|
|
1668
|
+
"plugins": {
|
|
1669
|
+
"type": "array",
|
|
1670
|
+
"items": {
|
|
1671
|
+
"anyOf": [
|
|
1672
|
+
{
|
|
1673
|
+
"type": "string",
|
|
1674
|
+
"resolvePath": true
|
|
1675
|
+
}
|
|
1676
|
+
]
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
},
|
|
1680
|
+
"additionalProperties": false
|
|
1670
1681
|
}
|
|
1671
1682
|
]
|
|
1672
1683
|
},
|