Skip to content

Commit 5975cf0

Browse files
committed
add client redirects for old quick start watt link
Signed-off-by: Leonardo Rossi <leonardo.rossi@gmail.com>
1 parent 0f7c98c commit 5975cf0

File tree

6 files changed

+408
-2
lines changed

6 files changed

+408
-2
lines changed

docs/reference/runtime/_shared-configuration.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,34 @@ This configures the Platformatic Runtime Prometheus server. The Prometheus serve
384384
- **`plugins`** (array of `string`): A list of Fastify plugin to add to the Prometheus server.
385385
- **`applicationLabel`** (`string`, default: `'applicationId'`): The label name to use for the application identifier in metrics (e.g., `'applicationId'`, `'serviceId'`, or any custom label name).
386386
- **`timeout`** (`number`, default: `10000`): The timeout to wait for each worker metrics before skipping it.
387+
<<<<<<< HEAD
388+
=======
389+
- **`otlpExporter`** (`object`): Optional configuration for exporting Prometheus metrics to an OpenTelemetry Protocol (OTLP) endpoint. This enables pushing metrics to OTLP-compatible collectors like OpenTelemetry Collector, Grafana Cloud, or other observability platforms. The object supports the following settings:
390+
- **`enabled`** (`boolean` or `string`): Enable or disable OTLP metrics export. Default: `true` if endpoint is configured.
391+
- **`endpoint`** (**required**, `string`): OTLP endpoint URL for metrics (e.g., `http://localhost:4318/v1/metrics`).
392+
- **`interval`** (`number` or `string`): Interval in milliseconds between metric pushes. Default: `60000` (60 seconds).
393+
- **`headers`** (`object`): Additional HTTP headers for authentication or custom metadata. Common use cases include API keys or authentication tokens.
394+
- **`serviceName`** (`string`): Service name for OTLP resource attributes. Defaults to the application ID.
395+
- **`serviceVersion`** (`string`): Service version for OTLP resource attributes. Optional.
396+
397+
```json title="Example OTLP Metrics Configuration"
398+
{
399+
"metrics": {
400+
"enabled": true,
401+
"port": 9090,
402+
"otlpExporter": {
403+
"endpoint": "http://otel-collector:4318/v1/metrics",
404+
"interval": 30000,
405+
"headers": {
406+
"x-api-key": "{OTLP_API_KEY}"
407+
},
408+
"serviceName": "my-platformatic-app",
409+
"serviceVersion": "1.0.0"
410+
}
411+
}
412+
}
413+
```
414+
>>>>>>> 56907777 (add client redirects for old quick start watt link)
387415
388416
If the `metrics` object is not provided, the Prometheus server will not be started.
389417

docs/reference/runtime/programmatic.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,74 @@ import { loadConfiguration } from '@platformatic/runtime'
5454
const config = await loadConfiguration('/path/to/platformatic.config.json')
5555
```
5656

57+
## Adding and Removing applications at runtime
58+
59+
The Runtime object provides methods to dynamically add and remove applications during runtime execution.
60+
61+
### API Documentation
62+
63+
### `runtime.addApplications(applications, start = false)`
64+
65+
Dynamically adds new applications to a running runtime instance. This allows you to register applications after the runtime has been initialized.
66+
67+
If `start` is `true`, then the new application will immediately be started in parallel. Defaults to `false`.
68+
69+
**Important**: Application objects passed in the `applications` argument should always be processed via `prepareApplication` first to ensure proper options normalization.
70+
71+
```js
72+
import { create, prepareApplication } from '@platformatic/runtime'
73+
74+
const app = await create('path/to/platformatic.runtime.json')
75+
// const app = await create('path/to/watt.json')
76+
await app.start()
77+
78+
// Prepare and add new applications dynamically
79+
const newApplications = [
80+
await prepareApplication(app.getRuntimeConfig(true), { id: 'my-new-service', path: './new-service' })
81+
]
82+
83+
await app.addApplications(newApplications, true) // true to start immediately
84+
```
85+
86+
#### `runtime.removeApplications(applications, silent = false)`
87+
88+
Dynamically removes applications from the runtime. This will stop the applications and clean up their resources.
89+
90+
```js
91+
import { create } from '@platformatic/runtime'
92+
93+
const app = await create('path/to/watt.json')
94+
await app.start()
95+
96+
// Remove applications by ID
97+
const applicationsToRemove = ['service-1', 'service-2']
98+
99+
await app.removeApplications(applicationsToRemove)
100+
```
101+
102+
If `silent` is `true`, then logging will be suppressed during the removal process. Defaults to `false`.
103+
104+
**Important**: The entrypoint application cannot be removed, attempting to do so will throw a `CannotRemoveEntrypointError`.
105+
106+
### Example: Dynamic Service Management
107+
108+
```js
109+
import { create, prepareApplication } from '@platformatic/runtime'
110+
111+
const app = await create('path/to/watt.json')
112+
await app.start()
113+
114+
// Add a new service dynamically
115+
const newService = await prepareApplication(app.getRuntimeConfig(true), {
116+
id: 'analytics-service',
117+
path: './analytics',
118+
workers: 2
119+
})
120+
121+
await app.addApplications([newService], true)
122+
123+
// Later, remove it when no longer needed
124+
await app.removeApplications(['analytics-service'])
125+
```
126+
57127
<Issues />

docs/reference/wattpm/cli-commands.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ npm install wattpm
2323
npx wattpm --help
2424
```
2525

26+
## Global Options
27+
28+
These options are available for all `wattpm` commands:
29+
30+
- `-r, --no-pretty` - Disable pretty-printed output for logs and console messages
31+
- `-v, --verbose` - Enable verbose output for detailed information
32+
- `-V, --version` - Display the current wattpm version
33+
- `-h, --help` - Show help information
34+
2635
## Core Watt Commands (`wattpm`)
2736

2837
These are the primary commands for working with Watt applications:

0 commit comments

Comments
 (0)