mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +00:00
Update default docker compose configuration with Khoj local mode
This commit is contained in:
parent
8c36079f74
commit
20ce3d0c78
2 changed files with 51 additions and 27 deletions
|
@ -10,7 +10,15 @@ services:
|
|||
POSTGRES_DB: postgres
|
||||
volumes:
|
||||
- khoj_db:/var/lib/postgresql/data/
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
server:
|
||||
depends_on:
|
||||
database:
|
||||
condition: service_healthy
|
||||
# Use the following line to use the latest version of khoj. Otherwise, it will build from source.
|
||||
image: ghcr.io/khoj-ai/khoj:latest
|
||||
# Uncomment the following line to build from source. This will take a few minutes. Comment the next two lines out if you want to use the offiicial image.
|
||||
|
@ -47,9 +55,11 @@ services:
|
|||
- POSTGRES_PASSWORD=postgres
|
||||
- POSTGRES_HOST=database
|
||||
- POSTGRES_PORT=5432
|
||||
- GOOGLE_CLIENT_SECRET=bar
|
||||
- GOOGLE_CLIENT_ID=foo
|
||||
command: --host="0.0.0.0" --port=42110 -vv
|
||||
- KHOJ_DJANGO_SECRET_KEY=secret
|
||||
- KHOJ_DEBUG=True
|
||||
- ADMIN_EMAIL=username@example.com
|
||||
- ADMIN_PASSWORD=password
|
||||
command: --host="0.0.0.0" --port=42110 -vv --anonymous-mode
|
||||
|
||||
|
||||
volumes:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import logging
|
||||
import os
|
||||
|
||||
from database.models import (
|
||||
KhojUser,
|
||||
|
@ -17,9 +18,11 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
def initialization():
|
||||
def _create_admin_user():
|
||||
logger.info("👩✈️ Setting up admin user")
|
||||
email_addr = input("Email Address: ")
|
||||
password = input("Password: ")
|
||||
logger.info(
|
||||
"👩✈️ Setting up admin user. These credentials will allow you to configure your server at /django/admin."
|
||||
)
|
||||
email_addr = os.getenv("ADMIN_EMAIL") or input("Email: ")
|
||||
password = os.getenv("ADMIN_PASSWORD") or input("Password: ")
|
||||
admin_user = KhojUser.objects.create_superuser(email=email_addr, username=email_addr, password=password)
|
||||
logger.info(f"👩✈️ Created admin user: {admin_user.email}")
|
||||
|
||||
|
@ -27,6 +30,15 @@ def initialization():
|
|||
logger.info(
|
||||
"🗣️ Configure chat models available to your server. You can always update these at /django/admin using the credentials of your admin account"
|
||||
)
|
||||
try:
|
||||
# Some environments don't support interactive input. We catch the exception and return if that's the case. The admin can still configure their settings from the admin page.
|
||||
input()
|
||||
except EOFError:
|
||||
return
|
||||
|
||||
try:
|
||||
import gpt4all
|
||||
|
||||
use_offline_model = input("Use offline chat model? (y/n): ")
|
||||
if use_offline_model == "y":
|
||||
logger.info("🗣️ Setting up offline chat model")
|
||||
|
@ -48,6 +60,8 @@ def initialization():
|
|||
max_prompt_size=max_tokens,
|
||||
tokenizer=tokenizer,
|
||||
)
|
||||
except ModuleNotFoundError as e:
|
||||
logger.warning("Offline models are not supported on this device.")
|
||||
|
||||
use_openai_model = input("Use OpenAI chat model? (y/n): ")
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue