Skip to content

Commit

Permalink
Merge pull request #278 from Genez-io/release
Browse files Browse the repository at this point in the history
Release v3.0.0
  • Loading branch information
vladiulianbogdan authored Dec 4, 2024
2 parents 0c2b9c5 + dd6a915 commit be09a2a
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 37 deletions.
71 changes: 71 additions & 0 deletions docs/features/cron-jobs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
description: A scheduled method or a cron job is a function that will run periodically. By using a specific syntax, you can define the frequency and timing for each method.
---

# Crons

<head>
<title>Crons | Genezio Documentation</title>
</head>

A scheduled method or a cron job is a function that will run periodically. By using a specific cron syntax, you can define the frequency and timing for each method. You can use Genezio functions to define cron jobs in your project.

## Create a cron job

To create a cron job, you will need a function that will run periodically. You can define the function in your code and then add the cron job in the configuration file. To learn more about Genezio functions, check the [functions documentation](../tutorials/how-to-deploy-a-serverless-function.md).

```yaml title="genezio.yaml"
name: cron-getting-started
region: us-east-1
yamlVersion: 2
backend:
path: ./
language:
name: js
packageManager: npm
functions:
- name: my-function
path: ./
handler: handler
entry: app.mjs
services:
crons:
- name: my-cron
function: ${{backend.functions.my-function.name}}
schedule: "* * * * *"
endpoint: "/my-cron"
```
This configuration file specifies the project name, deployment region, and details about the backend. It also specifies the cron job name, the name of function that will called, the schedule, and the endpoint. In this example, the cron job will run every minute and will call the url provided by your backend function at the specifed endpoint. The `endpoint` field is optional, if it is not provided, the cron job will call the base url of your function.

If you want to learn more about cron strings and how to define a valid schedule, check https://crontab.guru/.

:::info
You can also specify the function name manually like so:

```yaml title="genezio.yaml"
services:
crons:
- name: my-cron
function: my-function
schedule: "* * * * *"
endpoint: "/my-cron"
```

:::

## Testing

### Local

To test your crons locally you can simply run `genezio local` and check the terminal logs to see if the cron job is being executed.

### Remote

:::warning
Deploying your project will **sync** the state of the crons with what is in the `genezio.yaml` file. This means that if you delete a cron job from the file and deploy the project, it will be deleted from the cloud as well. Before deploying, make sure that the state provided in the `genezio.yaml` file is your desired output state after deployment.
:::

Simply run `genezio deploy` to deploy your project.

To test if your cron job was succesfully created, you can check the logs of the function that the cron job is calling to see if it is being executed.
2 changes: 1 addition & 1 deletion docs/frameworks/django.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Django is a popular Python web application framework that simplifies the develop
provides a robust set of features for building web servers and APIs.

:::tip
Get started in no time with the [Django template](https://app.genez.io/start/deploy?repository=https://github.com/Genez-io/django-getting-started))
Get started in no time with the [Django template](https://app.genez.io/start/deploy?repository=https://github.com/Genez-io/django-getting-started)
:::

# Deployment
Expand Down
2 changes: 1 addition & 1 deletion docs/frameworks/fastapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import TabItem from '@theme/TabItem';
FastAPI is a modern Python web application framework that simplifies the development of server-side applications. It provides a robust set of features for building web servers and APIs.

:::tip
Get started in no time with the [FastAPI template](https://app.genez.io/start/deploy?repository=https://github.com/Genez-io/fastapi-getting-started)).
Get started in no time with the [FastAPI template](https://app.genez.io/start/deploy?repository=https://github.com/Genez-io/fastapi-getting-started).
:::

# Deployment
Expand Down
2 changes: 1 addition & 1 deletion docs/frameworks/flask.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Flask is a popular Python web application framework that simplifies the developm
provides a robust set of features for building web servers and APIs.

:::tip
Get started in no time with the [Flask template](https://app.genez.io/start/deploy?repository=https://github.com/Genez-io/flask-getting-started)).
Get started in no time with the [Flask template](https://app.genez.io/start/deploy?repository=https://github.com/Genez-io/flask-getting-started).
:::

# Deployment
Expand Down
2 changes: 1 addition & 1 deletion docs/genezio-typesafe/cron-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The time specified in the cron strings is in UTC. You can use this [converter](h

## Use scheduled methods in your project

There are two ways to declare a scheduled method:
There are two ways to declare a scheduled method in a Genezio typsafe project:

- Using decorators (only available for TypeScript, JavaScript and Go projects)
- Using the `genezio.yaml` configuration file (available for all supported languages, including TypeScript, JavaScript, Go)
Expand Down
66 changes: 33 additions & 33 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ const sidebars = {
link: { type: "doc", id: "getting-started/README" },
items: [
"getting-started/use-a-template",
"getting-started/import-existing-project"
"getting-started/import-existing-project",
],
collapsed: false
collapsed: false,
},
{
type: "category",
Expand All @@ -48,7 +48,7 @@ const sidebars = {
"frameworks/refine",
"frameworks/svelte",
"frameworks/typesafe-project",
"frameworks/vue"
"frameworks/vue",
],
},
{
Expand All @@ -68,31 +68,30 @@ const sidebars = {
label: "Create your first Web3 App", // The link label
href: "https://genezio.com/blog/create-your-first-web3-app/", // The external URL
description:
"In this tutorial, you will learn how to create your first Web3 application on Ethereum using genezio and Blast API. You don’t have to know anything beforehand to follow along. I will introduce you to the most basic blockchain concepts and tools to get you from zero to hero in Web3 development. Excited? Let’s get started 🤩"
"In this tutorial, you will learn how to create your first Web3 application on Ethereum using genezio and Blast API. You don’t have to know anything beforehand to follow along. I will introduce you to the most basic blockchain concepts and tools to get you from zero to hero in Web3 development. Excited? Let’s get started 🤩",
},
{
type: "link",
label: "Create your first Chat GPT App", // The link label
href: "https://genezio.com/blog/create-your-first-app-using-chatgpt/", // The external URL
description:
"In this tutorial, you will learn how to create an app called the Rephrasing App. The app that you are going to build has a simple UI written in React, uses the ChatGPT API and is deployed on genezio."
"In this tutorial, you will learn how to create an app called the Rephrasing App. The app that you are going to build has a simple UI written in React, uses the ChatGPT API and is deployed on genezio.",
},
{
type: "link",
label: "Implement a Shopping Cart", // The link label
href:
"https://genezio.com/blog/implement-a-shopping-cart-using-typescript-redis-and-react/", // The external URL
href: "https://genezio.com/blog/implement-a-shopping-cart-using-typescript-redis-and-react/", // The external URL
description:
"In this tutorial, you will learn how to use Redis, NodeJs, and React to easily implement a shopping cart for your online store."
"In this tutorial, you will learn how to use Redis, NodeJs, and React to easily implement a shopping cart for your online store.",
},
{
type: "link",
label: "Integrate Stripe Payments", // The link label
href: "https://genezio.com/blog/integrate-stripe-payments/", // The external URL
description:
"This guide will walk you through integrating Stripe payments using a genezio backend and a React frontend."
}
]
"This guide will walk you through integrating Stripe payments using a genezio backend and a React frontend.",
},
],
},
{
type: "category",
Expand All @@ -102,7 +101,7 @@ const sidebars = {
"deploy/backend",
"deploy/frontend",
"deploy/serverless-containers",
]
],
},
{
type: "category",
Expand All @@ -111,14 +110,15 @@ const sidebars = {
items: [
"features/databases",
"features/authentication",
"features/cron-jobs",
"features/testing",
"features/deployment-environments",
"features/email-service",
"features/custom-domain-configuration",
"features/project-collaboration",
"features/check-genezio-dashboard",
"features/genezio-deploy-button"
]
"features/genezio-deploy-button",
],
},
{
type: "category",
Expand All @@ -132,8 +132,8 @@ const sidebars = {
"genezio-typesafe/cron-methods",
"genezio-typesafe/genezio-decorators",
"genezio-typesafe/project-template",
"genezio-typesafe/genezio-context"
]
"genezio-typesafe/genezio-context",
],
},
{
type: "category",
Expand All @@ -142,8 +142,8 @@ const sidebars = {
items: [
"project-structure/genezio-configuration-file",
"project-structure/.genezioignore",
"project-structure/backend-environment-variables"
]
"project-structure/backend-environment-variables",
],
},
{
type: "category",
Expand All @@ -170,12 +170,12 @@ const sidebars = {
"cli-tool/cli-commands/delete",
"cli-tool/cli-commands/login",
"cli-tool/cli-commands/account",
"cli-tool/cli-commands/logout"
]
"cli-tool/cli-commands/logout",
],
},
"cli-tool/install",
"cli-tool/update",
]
],
},
{
type: "category",
Expand All @@ -185,8 +185,8 @@ const sidebars = {
"integrations/github-action",
"integrations/upstash-redis",
"integrations/neon-postgres",
"integrations/upstash-qstash"
]
"integrations/upstash-qstash",
],
},
{
type: "category",
Expand All @@ -207,8 +207,8 @@ const sidebars = {
"examples/typescript/trivia-application",
"examples/typescript/crud-application",
"examples/typescript/shopping-cart",
"examples/typescript/webhook-example"
]
"examples/typescript/webhook-example",
],
},
{
type: "category",
Expand All @@ -225,24 +225,24 @@ const sidebars = {
"examples/javascript/blockchain-app",
"examples/javascript/chatgpt-project",
"examples/javascript/stripe-integration",
"examples/javascript/html-example"
]
}
]
"examples/javascript/html-example",
],
},
],
},
{
type: "category",
label: "Learn more",
link: { type: "doc", id: "learn-more/README" },
items: ["learn-more/upgrading-to-v1", "learn-more/supported-languages"]
items: ["learn-more/upgrading-to-v1", "learn-more/supported-languages"],
},
"troubleshooting",
{
type: "link",
label: "Release Notes", // The link label
href: "https://github.com/Genez-io/genezio/releases" // The external URL
}
]
href: "https://github.com/Genez-io/genezio/releases", // The external URL
},
],
};

export default sidebars;

0 comments on commit be09a2a

Please sign in to comment.