mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-09-11 14:36:35 +03:00
docs: ✏️ script
init and run
This commit is contained in:
parent
3e68000983
commit
4667dada0b
@ -1,11 +1,11 @@
|
|||||||
SUPABASE_URL=XXXXX
|
SUPABASE_URL=<change-me>
|
||||||
SUPABASE_SERVICE_KEY=eyXXXXX
|
SUPABASE_SERVICE_KEY=<change-me>
|
||||||
OPENAI_API_KEY=sk-XXXXXX
|
OPENAI_API_KEY=<change-me>
|
||||||
ANTHROPIC_API_KEY=XXXXXX
|
ANTHROPIC_API_KEY=null
|
||||||
JWT_SECRET_KEY=Found in Supabase settings in the API tab
|
JWT_SECRET_KEY=<change-me>
|
||||||
AUTHENTICATE=true
|
AUTHENTICATE=true
|
||||||
GOOGLE_APPLICATION_CREDENTIALS=/code/application_default_credentials.json
|
GOOGLE_APPLICATION_CREDENTIALS=<change-me>
|
||||||
GOOGLE_CLOUD_PROJECT=XXXXX to be changed with your GCP id
|
GOOGLE_CLOUD_PROJECT=<change-me>
|
||||||
MAX_BRAIN_SIZE=52428800
|
MAX_BRAIN_SIZE=52428800
|
||||||
MAX_REQUESTS_NUMBER=200
|
MAX_REQUESTS_NUMBER=200
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
NEXT_PUBLIC_ENV=local
|
NEXT_PUBLIC_ENV=local
|
||||||
NEXT_PUBLIC_BACKEND_URL=http://localhost:5050
|
NEXT_PUBLIC_BACKEND_URL=http://localhost:5050
|
||||||
NEXT_PUBLIC_SUPABASE_URL=XXXX
|
NEXT_PUBLIC_SUPABASE_URL=<change-me>
|
||||||
NEXT_PUBLIC_SUPABASE_ANON_KEY=XXX
|
NEXT_PUBLIC_SUPABASE_ANON_KEY=<change-me>
|
||||||
NEXT_PUBLIC_GROWTHBOOK_URL=https://cdn.growthbook.io/api/features/sdk-AjVqDdrxa4ETFCoD
|
|
||||||
NEXT_PUBLIC_GROWTHBOOK_API_KEY = "sdk-AjVqDdrxa4ETFCoD"
|
|
||||||
NEXT_PUBLIC_JUNE_API_KEY=<change-me>
|
NEXT_PUBLIC_JUNE_API_KEY=<change-me>
|
13
README.md
13
README.md
@ -71,7 +71,18 @@ Additionally, you'll need a [Supabase](https://supabase.com/) account for:
|
|||||||
git clone git@github.com:StanGirard/Quivr.git && cd Quivr
|
git clone git@github.com:StanGirard/Quivr.git && cd Quivr
|
||||||
```
|
```
|
||||||
|
|
||||||
- **Step 2**: Copy the `.XXXXX_env` files
|
- ** Step 2**: Use the install helper
|
||||||
|
|
||||||
|
You can use the install_helper.sh script to setup your env files
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install gum # Windows (via Scoop) scoop install charm-gum
|
||||||
|
|
||||||
|
chmod +x install_helper.sh
|
||||||
|
./install_helper.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Step 2 - Bis**: Copy the `.XXXXX_env` files
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cp .backend_env.example backend/.env
|
cp .backend_env.example backend/.env
|
||||||
|
78
install_helper.sh
Executable file
78
install_helper.sh
Executable file
@ -0,0 +1,78 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Function to print error message and exit
|
||||||
|
error_exit() {
|
||||||
|
echo "$1" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to replace variables in files
|
||||||
|
replace_in_file() {
|
||||||
|
local file="$1"
|
||||||
|
local search="$2"
|
||||||
|
local replace="$3"
|
||||||
|
if [ "$(uname)" = "Darwin" ]; then
|
||||||
|
# macOS
|
||||||
|
sed -i "" "s|${search}|${replace}|" "$file"
|
||||||
|
else
|
||||||
|
# Linux/Unix and Windows (Git Bash)
|
||||||
|
sed -i "s|${search}|${replace}|" "$file"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Step 2: Copy the .XXXXX_env files if they don't exist
|
||||||
|
if [ ! -f backend/.env ]; then
|
||||||
|
echo "Copying backend .env example file..."
|
||||||
|
cp .backend_env.example backend/.env
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f frontend/.env ]; then
|
||||||
|
echo "Copying frontend .env example file..."
|
||||||
|
cp .frontend_env.example frontend/.env
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 3: Ask the user for environment variables and update .env files
|
||||||
|
# only if they haven't been set.
|
||||||
|
|
||||||
|
# Update backend/.env
|
||||||
|
if grep -q "SUPABASE_URL=<change-me>" backend/.env; then
|
||||||
|
echo "SUPABASE_URL can be found in your Supabase dashboard under Settings > API."
|
||||||
|
SUPABASE_URL=$(gum input --placeholder "Enter SUPABASE_URL for backend")
|
||||||
|
replace_in_file backend/.env "SUPABASE_URL=.*" "SUPABASE_URL=${SUPABASE_URL}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -q "SUPABASE_SERVICE_KEY=<change-me>" backend/.env; then
|
||||||
|
echo "SUPABASE_SERVICE_KEY can be found in your Supabase dashboard under Settings > API. Use the anon public key found in the Project API keys section."
|
||||||
|
SUPABASE_SERVICE_KEY=$(gum input --placeholder "Enter SUPABASE_SERVICE_KEY for backend")
|
||||||
|
replace_in_file backend/.env "SUPABASE_SERVICE_KEY=.*" "SUPABASE_SERVICE_KEY=${SUPABASE_SERVICE_KEY}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -q "OPENAI_API_KEY=<change-me>" backend/.env; then
|
||||||
|
echo "OPENAI_API_KEY is the API key from OpenAI, if you are using OpenAI services."
|
||||||
|
OPENAI_API_KEY=$(gum input --placeholder "Enter OPENAI_API_KEY for backend")
|
||||||
|
replace_in_file backend/.env "OPENAI_API_KEY=.*" "OPENAI_API_KEY=${OPENAI_API_KEY}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -q "JWT_SECRET_KEY=<change-me>" backend/.env; then
|
||||||
|
echo "JWT_SECRET_KEY can be found in your Supabase project dashboard under Settings > API > JWT Settings > JWT Secret."
|
||||||
|
JWT_SECRET_KEY=$(gum input --placeholder "Enter JWT_SECRET_KEY for backend")
|
||||||
|
replace_in_file backend/.env "JWT_SECRET_KEY=.*" "JWT_SECRET_KEY=${JWT_SECRET_KEY}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update frontend/.env using the same SUPABASE_URL and SUPABASE_SERVICE_KEY
|
||||||
|
if grep -q "NEXT_PUBLIC_SUPABASE_URL=<change-me>" frontend/.env; then
|
||||||
|
replace_in_file frontend/.env "NEXT_PUBLIC_SUPABASE_URL=.*" "NEXT_PUBLIC_SUPABASE_URL=${SUPABASE_URL}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -q "NEXT_PUBLIC_SUPABASE_ANON_KEY=<change-me>" frontend/.env; then
|
||||||
|
replace_in_file frontend/.env "NEXT_PUBLIC_SUPABASE_ANON_KEY=.*" "NEXT_PUBLIC_SUPABASE_ANON_KEY=${SUPABASE_SERVICE_KEY}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 4: Run the migration scripts (this is supposed to be done manually as per the instructions)
|
||||||
|
|
||||||
|
# Step 5: Launch the app
|
||||||
|
echo "Launching the app..."
|
||||||
|
docker compose -f docker-compose.yml up --build
|
||||||
|
|
||||||
|
# Final message
|
||||||
|
echo "Navigate to localhost:3000 in your browser to access the app."
|
Loading…
Reference in New Issue
Block a user