Skip to content

Latest commit

 

History

History

openai

Requirements

  • Node 20 or higher
brew install nvm
nvm use 20

Install Restack Web UI

To install the Restack Web UI, you can use Docker.

docker run -d --pull always --name restack -p 5233:5233 -p 6233:6233 -p 7233:7233 ghcr.io/restackio/restack:main

Start services

Where all your code is defined, including workflow steps.

add OPENAI_API_KEY in .env

npm i
npm run build
npm run dev

Your code will be running and syncing with Restack engine to execute workflows or functions.

This will start a 'restack' service for workflows and functions, and an 'openai' service for OpenAI functions.

Schedule a workflow

In another shell:

npm schedule

Will schedule to start example workflow immediately. Learn more about workflows

Architecture

flowchart TD
    C[fa:fa-bolt scheduleWorkflow client] -->|registers workflow with schedule| E{Restack Engine}
    E --> |queries results| C
    E -->|pulls queue with input| P1[fa:fa-ship restack pod]
    E -->|orchestrates with rate limit| P2[fa:fa-ship openai pod]
    P1 -->|runs| W[fa:fa-th-list example workflow]
    P1 -->|runs| Go[fa:fa-code goodbye function]
    P2 -->|runs| Gr[fa:fa-code greet function]
    P1 -->|sends status + output | E
    P2 -->|sends status output | E
Loading

Deploy on Restack

npm restack-up

To deploy the application on Restack, you can use the provided up.mjs script. This script utilizes the Restack Cloud SDK to define and deploy your application stack. It sets up the necessary environment variables and configures the application for deployment.

To get started, ensure you have the required Restack Cloud credentials and environment variables set up. Then, run the script to initiate the deployment process.

For more detailed information on deploying your repository to Restack, refer to the Restack Cloud deployment documentation.