80 lines
1.9 KiB
Markdown
80 lines
1.9 KiB
Markdown
# AKERN Assistant
|
|
|
|
1. Have `gcloud` CLI configured (https://docs.cloud.google.com/sdk/docs/install-sdk?hl=it).
|
|
2. Setup the Google Cloud project:
|
|
|
|
**Login**
|
|
|
|
```sh
|
|
gcloud auth login
|
|
```
|
|
|
|
**Set the correct Google project**
|
|
|
|
```sh
|
|
gcloud config set core/project akqa-ita-ai-poc1
|
|
```
|
|
|
|
## Build the image
|
|
|
|
Setup Docker first:
|
|
|
|
```sh
|
|
gcloud auth configure-docker \
|
|
europe-west3-docker.pkg.dev
|
|
```
|
|
|
|
This allows Docker to use gcloud credentials to authenticate in the registry. Then to push the image:
|
|
|
|
```sh
|
|
docker buildx build \
|
|
--platform linux/amd64 \
|
|
-t europe-west3-docker.pkg.dev/akqa-ita-ai-poc1/akern-repository/akern_assistant:latest \
|
|
--push \
|
|
.
|
|
```
|
|
|
|
## Deployment
|
|
|
|
```sh
|
|
gcloud run deploy akern-assistant \
|
|
--image europe-west3-docker.pkg.dev/akqa-ita-ai-poc1/akern-repository/akern_assistant:latest \
|
|
--platform managed \
|
|
--region europe-west3 \
|
|
--port 8080 \
|
|
--allow-unauthenticated \
|
|
--set-secrets "GOOGLE_APPLICATION_CREDENTIALS_JSON=google-credentials:latest,AUTH_USER=auth-user:latest,PASSWORD=auth-password:latest"
|
|
```
|
|
|
|
## Run the project locally
|
|
|
|
### 1 - Install dependencies
|
|
|
|
```sh
|
|
uv sync
|
|
```
|
|
|
|
### 2 - Add the `credentials.json` to the project root
|
|
|
|
The file must be asked to a coworker (ask Matteo or Antonio).
|
|
|
|
### 3 - Run the database "migration"
|
|
|
|
The project currently uses a very minimal sqlite3 db. To initialize it, run:
|
|
|
|
```sh
|
|
uv run models/orm.py
|
|
```
|
|
|
|
This will create the `example.db` file.
|
|
|
|
After doing this, you will have to create at least one prompt record into the database. I suggest to use a SQLite viewer software for desktop called DB Browser for SQLite. Once you have downloaded the program, open the database that has just been created by the migration and add at least one row for one prompt.
|
|
|
|
You can use the `prompt.md` file to have a prompt example.
|
|
|
|
### 4 - Run the dev server
|
|
|
|
```sh
|
|
uv run fastapi dev app.py
|
|
```
|