Skip to content

Commit 6298fd2

Browse files
committed
docs(aigency): describe prerequisites
1 parent 0e95c5d commit 6298fd2

File tree

4 files changed

+38
-3
lines changed

4 files changed

+38
-3
lines changed

apps/crawler-backend/.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
OPENAI_API_KEY=sk-proj-example-key
2+
NEARAI_API_KEY={"account_id":"example.near","signature":"example==","public_key":"ed25519:example","callback_url":"http://localhost:54875/capture","nonce":"1234567890","recipient":"ai.near","message":"Welcome to NEAR AI","on_behalf_of":null}
3+
CRAWLER_API_PORT=3000
4+
CRAWLER_DATABASE_URL=postgres://mweb:mweb@postgres:5432/mweb
5+
OPENFAAS_USERNAME=admin
6+
OPENFAAS_PASSWORD=admin
7+
OPENFAAS_URL=http://gateway.aigency:8080

apps/crawler-backend/README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Backend
22

3+
## Prerequisites
4+
5+
1. Install [Docker Desktop](https://www.docker.com/products/docker-desktop/)
6+
2. Go to Settings, enable Kubernetes, click on Apply & Restart
7+
3. Create `helm/values.yaml` and `.env` files as written above (see also `helm/values.example.yaml` and `.example.env`)
8+
4. Install [Lens](https://k8slens.dev/) [Optionally]
9+
5. Install [`kubectl`](https://kubernetes.io/docs/tasks/tools/)
10+
6. Install [`helm`](https://helm.sh/docs/intro/install/)
11+
312
## Install with Helm
413

514
Create `values.yaml` with the following secrets:
@@ -11,12 +20,29 @@ nearAiApiKey: '{"account_id":"example.near","signature":"example==","public_key"
1120
1221
Install helm chart from GitHub Registry:
1322
14-
```sh
15-
helm upgrade aigency oci://ghcr.io/dapplets/aigency --install --create-namespace --namespace aigency -f ./values.yaml
23+
```bash
24+
cd apps/crawler-backend
25+
kubectl create namespace openfaas-fn
26+
helm upgrade aigency oci://ghcr.io/dapplets/aigency --install --create-namespace --namespace aigency -f ./helm/values.yaml
27+
```
28+
29+
If the `secrets "basic-auth" already exists` error occured, try this:
30+
31+
```bash
32+
helm upgrade aigency oci://ghcr.io/dapplets/aigency --install --create-namespace --namespace aigency -f ./helm/values.yaml
33+
helm uninstall aigency --namespace aigency
34+
helm upgrade aigency oci://ghcr.io/dapplets/aigency --install --create-namespace --namespace aigency -f ./helm/values.yaml
35+
helm upgrade aigency oci://ghcr.io/dapplets/aigency --install --create-namespace --namespace aigency -f ./helm/values.yaml
1636
```
1737

1838
Aigency will be available at `http://localhost:30001`
1939

40+
Add port forwarding to PostgreSQL
41+
42+
```
43+
kubectl port-forward service/postgres 5432 5432 --namespace aigency
44+
```
45+
2046
## Development
2147

2248
### Run PostgreSQL
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
openaiApiKey: sk-proj-example-key
2+
nearAiApiKey: '{"account_id":"example.near","signature":"example==","public_key":"ed25519:example","callback_url":"http://localhost:54875/capture","nonce":"1234567890","recipient":"ai.near","message":"Welcome to NEAR AI","on_behalf_of":null}'

apps/crawler-backend/src/env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const CRAWLER_PRIVATE_KEY =
66

77
export const CRAWLER_DATABASE_URL =
88
process.env.CRAWLER_DATABASE_URL ??
9-
'postgres://user:password@localhost:5432/mweb';
9+
'postgres://mweb:mweb@localhost:5432/mweb';
1010

1111
export const OPENAI_API_KEY = process.env.OPENAI_API_KEY;
1212

0 commit comments

Comments
 (0)