Skip to content

This is an open source implementation of OpenCat for Team backend. You can deploy this backend service on Edges.

License

Notifications You must be signed in to change notification settings

C-Dao/opencatd_worker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploy OpenCat for Team on the Edges

License: MIT

This is an open source implementation of OpenCat for Team backend for edge platforms.

Supported platforms:

This project uses Cloudflare KV or Deno KV as backend database.

Deploy to Cloudflare Workers With Wrangler

Before you begin, you need to have a Cloudflare account and be able to use Cloudflare Workers. Have a joy!

1. Git clone the repo and enter repo

 cd ./opencatd_worker

2. Install dependencies

 pnpm install

3. Enable Tokens Count Service

 cd ./gpt_tokens && cp wrangler.toml.bak wrangler.toml && pnpm run deploy

4. Go into "./opencatd", Copy wrangler.toml.bak to wrangler.toml

 cd ../opencatd && cp wrangler.toml.bak wrangler.toml

5. Create Cloudflare KV Namespace

 npx wrangler kv:namespace create OPENCAT_DB

6. Then, copy the created Cloudflare KV config into wrangler.toml, replace 'xxxx...' into your created Cloudflare KV ID.

[[kv_namespaces]]
binding = "OPENCAT_DB"
id = "xxxxx"

7. Custom domain, edit the route configuration in wrangler.toml, rename "xxxxxx..." into your custom domain

[[routes]]
pattern = "xxxxx"
custom_domain = true

8. Use wrangler deploy

 pnpm run deploy

Run locally with Deno

You need to have Deno >= 1.32 installed.

1. Install Deno

MacOS user can use under command line to install deno. Read the official document to learn more

 brew install deno

2. Copy .env.bak to .env

 cp .env.bak .env

3. Run with Deno

Just do it, Deno includes a kv database on the local environment, deno kv database likes a localStorage, you can simple use it. learning more, you can see the comments.

 cd ./opencatd && deno run -A --unstable src/server-deno.ts

Deploy to Deno Deploy with Deployctl

You need to sign up Deno deploy
You need to have Deno >= 1.32 installed.
Learning how to use Deployctl

1. Install Deno

MacOS user can use under command line to install deno. Read the official document to learn more

 brew install deno

2. Install deployctl

deno install --allow-read --allow-write --allow-env --allow-net --allow-run --no-check -r -f https://deno.land/x/deploy/deployctl.ts

3. Deploy

 cd ./opencatd && deployctl deploy --project=opencat_worker src/server-deno.ts

License

This project is MIT licensed.

About

This is an open source implementation of OpenCat for Team backend. You can deploy this backend service on Edges.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •