This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
diana esteves
committed
Aug 7, 2024
1 parent
9ed4ea7
commit e05a857
Showing
4 changed files
with
25 additions
and
91 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,41 @@ | ||
# Cloudflare Workers AI Demo | ||
# Cloudflare Workers AI deployed with Pulumi | ||
|
||
The app displays a random quote and a text-to-image AI background representative of such. | ||
|
||
![Screenshot](./docs/images/hero.png) | ||
|
||
## Overview | ||
|
||
- [App code](./app/) | ||
- [Infra code](./infra/) | ||
- [App Dev code -- Single Worker](./app/) | ||
- [App Prod code -- Multiple Workers](./app=prod/) | ||
- [Infra Test+Prod code](./infra/) | ||
|
||
## Pre-reqs | ||
|
||
### Local development | ||
- npm | ||
- Pulumi CLI | ||
- Wrangler | ||
- Pulumi Cloud account | ||
- Cloudflare account with a Zone configured. | ||
|
||
- Use the Wrangler CLI via Makefile | ||
### Local development (Wrangler) | ||
|
||
```bash | ||
cd app | ||
npx wrangler kv:namespace create "KV" | ||
# ensure to update wrangler.toml | ||
- Use the Wrangler CLI to test the Worker | ||
|
||
# KV_NS_ID=$( npx wrangler kv:namespace list | jq '.[] | select(.title == "kv-wrangler") | .id' -r ) | ||
KV_NS_ID=3dfdfc3f927c4698a3fbac85363eb419 | ||
npx wrangler kv:key put '1' 'one I uno un' --namespace-id="${KV_NS_ID}" | ||
npx wrangler kv:key put '2' 'two II dos deux' --namespace-id="${KV_NS_ID}" | ||
npx wrangler kv:key put '3' 'three III tres trois' --namespace-id="${KV_NS_ID}" | ||
npx wrangler kv:key put 'count' '3' --namespace-id="${KV_NS_ID}" | ||
### Testing (Pulumi) | ||
|
||
- Using the `test` Pulumi stack to incrementally add the Cloudflare Resources. | ||
- Uses a sample size for the data | ||
- Adds a `DEMO` flag to the Cloudflare resources | ||
- Triggered manually via `pulumi up` commands | ||
- Stores all secrets + config in Pulumi ESC | ||
- Running under [`quote-demo.atxyall.com`](https://quote-demo.atxyall.com/) | ||
|
||
# TODO | ||
``` | ||
### Production (GitHub Actions + Pulumi) | ||
|
||
### E2E Testing && Production | ||
|
||
#### Infra code | ||
|
||
- Use Pulumi and CI/CD to adhere to GitOps best practices | ||
|
||
```bash | ||
``` | ||
- Uses GitHub Actions | ||
- preview prod on GitHub commit to a PR against main | ||
- update prod on GitHub merge to the main branch | ||
- Uses GitHub OIDC to auth against Pulumi Cloud | ||
- Uses the full prod size data, 2400+ CSV Entries | ||
- Running under [`quote.atxyall.com`](https://quote.atxyall.com/) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.