Skip to content

Commit

Permalink
Add persistent/long-running docs
Browse files Browse the repository at this point in the history
Signed-off-by: Andreia Ocănoaia <[email protected]>
  • Loading branch information
andreia-oca committed Feb 19, 2025
1 parent 77521de commit 0b0544d
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
60 changes: 60 additions & 0 deletions docs/deploy/persistent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
description: Genezio offers seamless application deployments. Deploy a long-running backend service with a single command `genezio deploy`.
---

# Persistent (Long-Running) Server

Genezio supports deploying persistent or long-running servers, ensuring that your application remains active without scaling down to zero.
This is particularly useful for applications that require continuous processing or stateful operations.


## What is a Persistent Server?

A persistent or long-running server is an application that stays active and does not automatically scale down to zero when there are no incoming requests.
Unlike serverless functions that are event-driven and ephemeral, persistent servers allow for stateful operations and long-running tasks.

## Deploy Persistent Server in Genezio

To deploy a persistent server on Genezio, you need to define the function type as persistent in your genezio.yaml configuration file.

Here's an example of a genezio.yaml configuration file with a persistent function:

```yaml
name: my-project
region: us-east-1
yamlVersion: 2
backend:
path: .
language:
name: js
functions:
- name: persistent-server
path: .
entry: server.mjs
handler: handler
type: persistent
```
Once you have configured the `genezio.yaml` file, you can either commit it to your GitHub repository or deploy it directly using the Genezio CLI:

```bash
genezio deploy
```

Genezio will provision the necessary resources to ensure that your server remains running continuously.

After deploying, you can send requests to your server using the generated endpoint URL available in the Genezio dashboard or in the CLI output.

:::tip info
To send requests to your persistent server, do not forget to prepend `compute-` to the endpoint URL.
The format should be `https://compute-<server-uuid>.<region>.cloud.genez.io`.
:::

Note: Sending requests to the URL `https://<server-uuid>.<region>.cloud.genez.io` will trigger a serverless call instead of a persistent server call.

## Enterprise Support

Persistent servers are available as an Enterprise-only feature.
If you are interested in deploying a persistent server on Genezio, please [contact us](mailto:[email protected]) for more information.

For further details on server types and configurations, refer to the [Genezio Configuration File](/docs/project-structure/genezio-configuration-file.md).
3 changes: 2 additions & 1 deletion docs/project-structure/genezio-configuration-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,11 @@ This resource exposes `url` as an output expression: `${{backend.functions.<func

- `type`: `string` **Optional**

The type of the function. This can be `aws` or `httpServer`. If this field is not specified, the default value is `aws`.
The type of the function. This can be: `aws`, `httpServer`, or `persistent`. If this field is not specified, the default value is `aws`.

- `aws` indicates that the function will be deployed as an AWS Lambda handler. This means that the function is either a Lambda event handler or it uses [`serverless-http`](https://www.npmjs.com/package/serverless-http) to convert an Express app to a Lambda event handler.
- `httpServer` indicates that the function will be deployed as a standalone HTTP server, such as those built with frameworks like `express`, `fastify`, `flask`, `django`, etc.
- `persistent` indicates that the function will be deployed as a long-running server that will not be scaled down to 0. This is an Enterprise-only feature, please [contact us](mailto:[email protected]) for more information.

Note 1: The recommended way to deploy your app is to use the `httpServer` type unless you are explicitly migrating from an existing AWS Lambda function or using `serverless-http`.
Note 2: Websocket are supported only for `httpServer` functions.
Expand Down
1 change: 1 addition & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ const sidebars = {
items: [
"deploy/backend",
"deploy/frontend",
"deploy/persistent",
"deploy/serverless-containers",
],
},
Expand Down

0 comments on commit 0b0544d

Please sign in to comment.