-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:platformatic/docs
- Loading branch information
Showing
14 changed files
with
497 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import Issues from '../../getting-started/issues.md'; | ||
|
||
# Configuration | ||
|
||
Platformatic Astro is configured with a configuration file. It supports the use | ||
of environment variables as setting values with [configuration placeholders](#configuration-placeholders). | ||
|
||
## `application` | ||
|
||
Supported object properties: | ||
|
||
- **`basePath`**: Service proxy base path when exposing this application in a [composer](../../composer/configuration.md) when setting the `proxy` property. If not specified, the service will be exposed on the service or a value specified in the service code via `platformatic.setBasePath()`. | ||
- **`outputDirectory`**: The subdirectory where production build is stored at when using `wattpm build` or `plt build`. The default is `dist`. | ||
- **`include`**: The paths to include when deploying the service. The default is `['dist']`. | ||
- **`commands`**: An object specifying the commands to manage the application instead of using the Astro defaults. Supported commands are: | ||
- **`install`**: The command to execute to install the service dependencies. The default is `npm ci --omit-dev`. | ||
- **`build`**: The command to execute to build the application. | ||
- **`development`**: The command to execute to start the application in development mode. | ||
- **`production`**: The command to execute to start the application in production mode. | ||
|
||
## `logger` | ||
|
||
Configures the logger, see the [logger configuration](https://www.fastify.io/docs/latest/Reference/Server/#logger) for more information. | ||
|
||
## `server` | ||
|
||
Configures the HTTP server, see the [runtime](../../runtime/configuration.md#server) documentation. | ||
|
||
## `watch` | ||
|
||
Manages watching of the service, see the [service](../../service/configuration.md#watch) documentation. | ||
|
||
<Issues /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
title: Overview | ||
label: Astro | ||
--- | ||
|
||
import Issues from '../../getting-started/issues.md'; | ||
|
||
# Platformatic Astro | ||
|
||
The Platformatic Astro allows to run an [Astro](https://astro.build/) application as a Platformatic Runtime service with no modifications. | ||
|
||
## Getting Started | ||
|
||
Create or copy an Astro application inside the `web` or `services` folder. If you are not using [`autoload`](../../runtime/configuration.md#autoload), you also have to explictly add the new service. | ||
|
||
You are all set, you can now start your runtime as usual via `wattpm dev` or `plt start`. | ||
|
||
## Example configuration file | ||
|
||
```json | ||
{ | ||
"$schema": "https://schemas.platformatic.dev/@platformatic/astro/2.0.0.json", | ||
"application": { | ||
"basePath": "/frontend" | ||
} | ||
} | ||
``` | ||
|
||
## Architecture | ||
|
||
When running in development mode, the Astro Vite development server is run a in worker thread in the same process of the Platformatic runtime. The server port is chosen randomly and it will override any user setting. | ||
|
||
When running in production mode, a custom Fastify server will serve the static or dynamic (for SSR) application. The service is run a in worker thread in the same process of the Platformatic runtime and it will not start a TCP server unless it's the runtime entrypoint. | ||
|
||
In both modes if the service uses the `commands` property then it's responsible to start a HTTP server. The Platformatic runtime will modify the server port replacing it with a random port and then it will integrate the external service in the runtime. | ||
|
||
## Configuration | ||
|
||
See the [configuration](./configuration.md) page. | ||
|
||
## API | ||
|
||
- **`platformatic.setBasePath(path)`**: This function can be use to override the base path for the service. If not properly configure in the composer, this can make your application unaccessible. | ||
- **`platformatic.id`**: The id of the service. | ||
- **`platformatic.root`**: The root directory of the service. | ||
- **`platformatic.basePath`**: The base path of the service in the composer. | ||
- **`platformatic.logLevel`**: The log level configured for the service. | ||
|
||
<Issues /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import Issues from '../../getting-started/issues.md'; | ||
|
||
# Configuration | ||
|
||
Platformatic Next is configured with a configuration file. It supports the use | ||
of environment variables as setting values with [configuration placeholders](#configuration-placeholders). | ||
|
||
## `application` | ||
|
||
Supported object properties: | ||
|
||
- **`basePath`**: Service proxy base path when exposing this application in a [composer](../../composer/configuration.md) when setting the `proxy` property. If not specified, the service will be exposed on the service or a value specified in the service code via `platformatic.setBasePath()`. | ||
- **`outputDirectory`**: The subdirectory where production build is stored at when using `wattpm build` or `plt build`. The default is `dist`. | ||
- **`include`**: The paths to include when deploying the service. The default is `['dist']`. | ||
- **`commands`**: An object specifying the commands to manage the application instead of using the Next defaults. Supported commands are: | ||
- **`install`**: The command to execute to install the service dependencies. The default is `npm ci --omit-dev`. | ||
- **`build`**: The command to execute to build the application. | ||
- **`development`**: The command to execute to start the application in development mode. | ||
- **`production`**: The command to execute to start the application in production mode. | ||
|
||
## `logger` | ||
|
||
Configures the logger, see the [logger configuration](https://www.fastify.io/docs/latest/Reference/Server/#logger) for more information. | ||
|
||
## `server` | ||
|
||
Configures the HTTP server, see the [runtime](../../runtime/configuration.md#server) documentation. | ||
|
||
## `watch` | ||
|
||
Manages watching of the service, see the [service](../../service/configuration.md#watch) documentation. | ||
|
||
<Issues /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
title: Overview | ||
label: Astro | ||
--- | ||
|
||
import Issues from '../../getting-started/issues.md'; | ||
|
||
# Platformatic Next | ||
|
||
The Platformatic Next allows to run a [Next](https://nextjs.org/) application as a Platformatic Runtime service with no modifications. | ||
|
||
## Getting Started | ||
|
||
Create or copy an Next application inside the `web` or `services` folder. If you are not using [`autoload`](../../runtime/configuration.md#autoload), you also have to explictly add the new service. | ||
|
||
You are all set, you can now start your runtime as usual via `wattpm dev` or `plt start`. | ||
|
||
## Example configuration file | ||
|
||
```json | ||
{ | ||
"$schema": "https://schemas.platformatic.dev/@platformatic/next/2.0.0.json", | ||
"application": { | ||
"basePath": "/frontend" | ||
} | ||
} | ||
``` | ||
|
||
## Architecture | ||
|
||
When starting Next.js in development mode, production mode or by using the `commands` property, Platformatic will choose a random port for the HTTP server and it will override any user or application setting. | ||
|
||
## Configuration | ||
|
||
See the [configuration](./configuration.md) page. | ||
|
||
## API | ||
|
||
- **`platformatic.setBasePath(path)`**: This function can be use to override the base path for the service. If not properly configure in the composer, this can make your application unaccessible. | ||
- **`platformatic.id`**: The id of the service. | ||
- **`platformatic.root`**: The root directory of the service. | ||
- **`platformatic.basePath`**: The base path of the service in the composer. | ||
- **`platformatic.logLevel`**: The log level configured for the service. | ||
|
||
<Issues /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import Issues from '../../getting-started/issues.md'; | ||
|
||
# Configuration | ||
|
||
Platformatic Node is configured with a configuration file. It supports the use | ||
of environment variables as setting values with [configuration placeholders](#configuration-placeholders). | ||
|
||
## `application` | ||
|
||
Supported object properties: | ||
|
||
- **`basePath`**: Service proxy base path when exposing this application in a [composer](../../composer/configuration.md) when setting the `proxy` property. If not specified, the service will be exposed on the service or a value specified in the service code via `platformatic.setBasePath()`. | ||
- **`outputDirectory`**: The subdirectory where production build is stored at when using `wattpm build` or `plt build`. The default is `dist`. | ||
- **`include`**: The paths to include when deploying the service. The default is `['dist']`. | ||
- **`commands`**: An object specifying the commands to manage the application instead of directly executing the service entrypoint. Supported commands are: | ||
- **`install`**: The command to execute to install the service dependencies. The default is `npm ci --omit-dev`. | ||
- **`build`**: The command to execute to build the application. | ||
- **`development`**: The command to execute to start the application in development mode. | ||
- **`production`**: The command to execute to start the application in production mode. | ||
|
||
## `node` | ||
|
||
Configures Node. Supported object properties: | ||
|
||
- **`main`**: The entrypoint of the application. This is only needed if the `main` property is not set in the service `package.json` file. | ||
- **`absoluteUrl`**: If set to `true`, then the service will receive the full URL from a Platformatic Composer. The default is `false`. | ||
|
||
## `logger` | ||
|
||
Configures the logger, see the [logger configuration](https://www.fastify.io/docs/latest/Reference/Server/#logger) for more information. | ||
|
||
## `server` | ||
|
||
Configures the HTTP server, see the [runtime](../../runtime/configuration.md#server) documentation. | ||
|
||
## `watch` | ||
|
||
Manages watching of the service, see the [service](../../service/configuration.md#watch) documentation. | ||
|
||
<Issues /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
--- | ||
title: Overview | ||
label: Astro | ||
--- | ||
|
||
import Issues from '../../getting-started/issues.md'; | ||
|
||
# Platformatic Node | ||
|
||
The Platformatic Node allows to run a [Fastify](https://fastify.io/), [Express](https://expressjs.com/), [Koa](https://koajs.com/#) or plain Node application as a Platformatic Runtime service with no modifications. | ||
|
||
## Getting Started | ||
|
||
Create or copy your application inside the `web` or `services` folder. If you are not using [`autoload`](../../runtime/configuration.md#autoload), you also have to explictly add the new service. | ||
|
||
You are all set, you can now start your runtime as usual via `wattpm dev` or `plt start`. | ||
|
||
## Example configuration file | ||
|
||
```json | ||
{ | ||
"$schema": "https://schemas.platformatic.dev/@platformatic/node/2.0.0.json", | ||
"application": { | ||
"basePath": "/frontend" | ||
} | ||
} | ||
``` | ||
|
||
## Architecture | ||
|
||
If your server entrypoint exports a `create` or `build` function, then Platformatic Node will execute it and then will wait for it to return a server object. In this situation the server will be used without starting a TCP server. The TCP server is started if the service is the runtime entrypoint. | ||
|
||
If your server entrypoint does not export a function, then Platformatic runtime will execute the function and wait for a TCP server to be started. | ||
|
||
In both cases, the listening port is always modified and chosen randomly, overriding any user or application setting. | ||
|
||
If the service uses the `commands` property then it's always responsible to start a HTTP server and the `create` or `build` functions are not supported anymore. | ||
|
||
In all cases, Platformatic runtime will modify the server port replacing it with a random port and then it will integrate the external service in the runtime. | ||
|
||
## Example services entrypoints | ||
|
||
### Fastify with build function | ||
|
||
```js | ||
import fastify from 'fastify' | ||
|
||
export function create() { | ||
const app = fastify({ | ||
logger: { level: globalThis.platformatic?.logLevel ?? 'info' } | ||
}) | ||
|
||
const prefix = globalThis.platformatic?.basePath ?? '' | ||
|
||
app.get(`${prefix}/env`, async () => { | ||
return { production: process.env.NODE_ENV === 'production' } | ||
}) | ||
|
||
return app | ||
} | ||
``` | ||
### Express with no build function | ||
```js | ||
import express from 'express' | ||
|
||
const app = express() | ||
|
||
const prefix = globalThis.platformatic?.basePath ?? '' | ||
|
||
app.get(`${prefix}/env`, (req, res) => { | ||
res.send({ production: process.env.NODE_ENV === 'production' }) | ||
}) | ||
|
||
app.listen(3000) | ||
``` | ||
## Configuration | ||
See the [configuration](./configuration.md) page. | ||
## API | ||
- **`platformatic.setBasePath(path)`**: This function can be use to override the base path for the service. If not properly configure in the composer, this can make your application unaccessible. | ||
- **`platformatic.id`**: The id of the service. | ||
- **`platformatic.root`**: The root directory of the service. | ||
- **`platformatic.basePath`**: The base path of the service in the composer. | ||
- **`platformatic.logLevel`**: The log level configured for the service. | ||
<Issues /> | ||
```` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Issues from '../../getting-started/issues.md'; | ||
|
||
# Configuration | ||
|
||
Platformatic Remix is configured with a configuration file. It supports the use | ||
of environment variables as setting values with [configuration placeholders](#configuration-placeholders). | ||
|
||
It supports all the [settings supported by Platformatic Vite](../vite/configuration.md), plus the following one: | ||
|
||
- **`remix.outputDirectory`**: The subdirectory where production build is stored at when using `wattpm build` or `plt build`. The default is `build`. | ||
|
||
:::note | ||
Platformatic Remix uses this property instead of `application.outputDirectory` (which is ignored). | ||
::: | ||
|
||
<Issues /> |
Oops, something went wrong.