mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-15 09:32:22 +03:00
feat: 🎸 install (#1784)
now made easy # Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Checklist before requesting a review Please delete options that are not relevant. - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented hard-to-understand areas - [ ] I have ideally added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged ## Screenshots (if appropriate):
This commit is contained in:
parent
8650fdca77
commit
9e0bc0749f
@ -2,6 +2,9 @@
|
||||
|
||||
|
||||
OPENAI_API_KEY=CHANGE_ME
|
||||
CREATE_FIRST_USER=true # set to false if you want to create the first user manually by default it will create a user with the following credentials:
|
||||
# login: admin@quivr.app
|
||||
# password: admin
|
||||
|
||||
|
||||
|
||||
|
72
README.md
72
README.md
@ -58,72 +58,66 @@ Ensure you have the following installed:
|
||||
git clone git@github.com:StanGirard/Quivr.git && cd Quivr
|
||||
```
|
||||
|
||||
- **Step 2**: Install prerequisites:
|
||||
|
||||
```bash
|
||||
brew install gum # Windows (via Scoop) scoop install charm-gum
|
||||
brew install postgresql # Windows (via Scoop) scoop install postgresql
|
||||
```
|
||||
|
||||
|
||||
|
||||
- **Step 3**: Copy the `.env.example` files
|
||||
- **Step 2**: Copy the `.env.example` files
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
- **Step 4**: Update the `.env` files
|
||||
- **Step 3**: Update the `.env` files
|
||||
|
||||
Update **OPENAI_API_KEY** in the `.env` file.
|
||||
```bash
|
||||
vim .env # or emacs or vscode or nano
|
||||
```
|
||||
|
||||
You just need to update the `OPENAI_API_KEY` variable in the `.env` file. You can get your API key [here](https://platform.openai.com/api-keys). You need to create an account first. And put your credit card information. Don't worry, you won't be charged unless you use the API. You can find more information about the pricing [here](https://openai.com/pricing/).
|
||||
Update **OPENAI_API_KEY** in the `.env` file.
|
||||
|
||||
```bash
|
||||
vim .env # or emacs or vscode or nano
|
||||
```
|
||||
You just need to update the `OPENAI_API_KEY` variable in the `.env` file. You can get your API key [here](https://platform.openai.com/api-keys). You need to create an account first. And put your credit card information. Don't worry, you won't be charged unless you use the API. You can find more information about the pricing [here](https://openai.com/pricing/).
|
||||
|
||||
Quivr can be installed offline and is compatible with [Ollama.ai](https://ollama.ai) , in order to do so, follow the instructions [here](https://brain.quivr.app/docs/Developers/selfHosted/run_fully_local). It requires some technical expertise. If you need help, feel free to join our [Discord](https://discord.gg/HUpRgp2HG8) and ask for help. The OPENAI_API_KEY is still required if you install Quivr offline but you can put whatever you want in the `.env` file.
|
||||
|
||||
- **Step 5**: Launch the db
|
||||
Want to use [Ollama.ai](https://ollama.ai) instead, in order to do so, follow the instructions [here](https://brain.quivr.app/docs/Developers/selfHosted/run_fully_local).
|
||||
|
||||
- **Step 4**: Launch the project
|
||||
|
||||
```bash
|
||||
docker compose pull
|
||||
|
||||
docker compose up db -d
|
||||
docker compose up --build
|
||||
```
|
||||
|
||||
- **Step 6**: Use the `migration.sh` script to run the migration scripts
|
||||
|
||||
- **Step 5**: Login to the app
|
||||
|
||||
You can now sign in to the app with your new user. You can access the app at [http://localhost:3000/login](http://localhost:3000/login).
|
||||
Email: `admin@quivr.app`
|
||||
Password: `admin`
|
||||
|
||||
You can also connect to the supabase database at [http://localhost:8080](http://localhost:8080) with the following credentials: admin/admin in order to create new users.
|
||||
|
||||
You can access Quivr backend API at [http://localhost:5050/](http://localhost:5050/)
|
||||
|
||||
|
||||
## Updating Quivr 🚀
|
||||
|
||||
- **Step 1**: Pull the latest changes
|
||||
|
||||
```bash
|
||||
git pull
|
||||
```
|
||||
|
||||
- **Step 2**: Use the `migration.sh` script to run the migration scripts
|
||||
|
||||
```bash
|
||||
chmod +x migration.sh
|
||||
./migration.sh
|
||||
# Select 1) Create all tables
|
||||
# Select 2) Run migrations
|
||||
```
|
||||
|
||||
Choose either `Create all tables` if it's your first time or `Run migrations`
|
||||
if you are updating your database.
|
||||
|
||||
Alternatively, you can run the script on the Supabase database via the web
|
||||
interface (SQL Editor -> `New query` -> paste the script -> `Run`)
|
||||
|
||||
All the scripts can be found in the [scripts](scripts/) folder
|
||||
|
||||
|
||||
- **Step 7**: Launch the app
|
||||
|
||||
```bash
|
||||
docker compose up --build
|
||||
```
|
||||
|
||||
- **Step 8**: Navigate to `localhost:8000` in your browser
|
||||
|
||||
Once Quivr is running, you need to create an account to access the app. User is `admin` and password is `admin`. Go to [http://localhost:8000/project/default/auth/users](http://localhost:8000/project/default/auth/users) and create a new user in the `Users` section. You can then log in with your new user.
|
||||
|
||||
- **Step 9**: Login to the app
|
||||
|
||||
You can now sign in to the app with your new user. You can access the app at [http://localhost:3000/login](http://localhost:3000/login).
|
||||
|
||||
## Contributors ✨
|
||||
|
||||
Thanks go to these wonderful people:
|
||||
|
@ -1,6 +1,6 @@
|
||||
import os
|
||||
from fastapi import FastAPI
|
||||
|
||||
from packages.utils import handle_request_validation_error
|
||||
|
||||
if __name__ == "__main__":
|
||||
# import needed here when running main.py to debug backend
|
||||
@ -26,6 +26,8 @@ from routes.brain_routes import brain_router
|
||||
from routes.chat_routes import chat_router
|
||||
from routes.crawl_routes import crawl_router
|
||||
from routes.subscription_routes import subscription_router
|
||||
from logger import get_logger
|
||||
from packages.utils import handle_request_validation_error
|
||||
from sentry_sdk.integrations.fastapi import FastApiIntegration
|
||||
from sentry_sdk.integrations.starlette import StarletteIntegration
|
||||
|
||||
@ -50,6 +52,24 @@ if sentry_dsn:
|
||||
],
|
||||
)
|
||||
|
||||
if CREATE_FIRST_USER := os.getenv("CREATE_FIRST_USER", "False").lower() == "true":
|
||||
try:
|
||||
from supabase import create_client
|
||||
|
||||
supabase_client_auth = create_client(
|
||||
os.getenv("SUPABASE_URL"), os.getenv("SUPABASE_SERVICE_KEY")
|
||||
)
|
||||
res = supabase_client_auth.from_('users').select('*').eq('email', "admin@quivr.app").execute()
|
||||
if len(res.data) == 0:
|
||||
supabase_client_auth.auth.admin.create_user({"email": "admin@quivr.app","email_confirm": True, "password": "admin"})
|
||||
logger.info("👨💻 Created first user")
|
||||
else:
|
||||
logger.info("👨💻 First user already exists")
|
||||
except Exception as e:
|
||||
logger.error("👨💻 Error while creating first user")
|
||||
logger.error(e)
|
||||
|
||||
|
||||
telemetry_disabled = os.getenv("TELEMETRY_DISABLED", "False").lower() == "true"
|
||||
if not telemetry_disabled:
|
||||
try:
|
||||
|
@ -13,6 +13,8 @@ services:
|
||||
- NEXT_PUBLIC_CMS_URL=${NEXT_PUBLIC_CMS_URL}
|
||||
- NEXT_PUBLIC_FRONTEND_URL=${NEXT_PUBLIC_FRONTEND_URL}
|
||||
container_name: web
|
||||
depends_on:
|
||||
- backend-core
|
||||
restart: always
|
||||
ports:
|
||||
- 3000:3000
|
||||
@ -26,11 +28,21 @@ services:
|
||||
context: backend
|
||||
dockerfile: Dockerfile
|
||||
container_name: backend-core
|
||||
restart: always
|
||||
command:
|
||||
- "uvicorn"
|
||||
- "main:app"
|
||||
- "--host"
|
||||
- "0.0.0.0"
|
||||
- "--port"
|
||||
- "5050"
|
||||
- "--workers"
|
||||
- "1"
|
||||
restart: always
|
||||
depends_on:
|
||||
- redis
|
||||
- worker
|
||||
- beat
|
||||
db:
|
||||
condition: service_healthy
|
||||
kong:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- 5050:5050
|
||||
|
||||
@ -463,7 +475,7 @@ services:
|
||||
- ./volumes/db/data:/var/lib/postgresql/data:Z
|
||||
# Changes required for Analytics support
|
||||
- ./volumes/db/logs.sql:/docker-entrypoint-initdb.d/migrations/99-logs.sql:Z
|
||||
- ./volumes/db/init/data.sql:/docker-entrypoint-initdb.d/seed.sql
|
||||
- ./scripts/tables.sql:/docker-entrypoint-initdb.d/seed.sql
|
||||
|
||||
vector:
|
||||
container_name: supabase-vector
|
||||
|
Loading…
Reference in New Issue
Block a user