Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp for self host #276

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions .env.template

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ coursera-dl/
wandb
*.ipynb
*.pem
qdrant_data/*

# don't expose env files
.env
Expand Down
2 changes: 1 addition & 1 deletion .trunk/configs/.isort.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[settings]
profile=black
profile=google
2 changes: 1 addition & 1 deletion .trunk/configs/.style.yapf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[style]
based_on_style = google
column_limit = 120
column_limit = 140
indent_width = 2
1 change: 0 additions & 1 deletion .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ lint:
paths:
- .github/**/*
- .trunk/**/*
- mkdocs.yml
- .DS_Store
- .vscode/**/*
- README.md
Expand Down
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use an official Python runtime as a parent image
FROM python:3.10-slim

# Set the working directory in the container
WORKDIR /usr/src/app


# Copy the requirements file first to leverage Docker cache
COPY ai_ta_backend/requirements.txt .

# Install any needed packages specified in requirements.txt
RUN pip install -r requirements.txt

# Mkdir for sqlite db
RUN mkdir -p /usr/src/app/db

# Copy the rest of the local directory contents into the container
COPY . .

# Set the Python path to include the ai_ta_backend directory
ENV PYTHONPATH="${PYTHONPATH}:/usr/src/app/ai_ta_backend"

# Make port 8000 available to the world outside this container
EXPOSE 8000

# Run the application using Gunicorn with specified configuration
CMD ["gunicorn", "--workers=1", "--threads=100", "--worker-class=gthread", "ai_ta_backend.main:app", "--timeout=1800", "--bind=0.0.0.0:8000"]
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ Architecture diagram of Flask + Next.js & React hosted on Vercel.

Automatic [API Reference](https://uiuc-chatbot.github.io/ai-ta-backend/reference/)

## Docker Deployment

1. Just run Docker Compose `docker compose up --build`

Works on version: `Docker Compose version v2.27.1-desktop.1`

Works on Apple Silicon M1 `aarch64`, and `x86`.

## 📣 Development

1. Rename `.env.template` to `.env` and fill in the required variables
Expand All @@ -36,3 +44,4 @@ The docs are auto-built and deployed to [our docs website](https://uiuc-chatbot.
'url': doc.metadata.get('url'), # wouldn't this error out?
'base_url': doc.metadata.get('base_url'),
```

Loading