Skip to content

Grit One Installation

This document will get you up and running with Grit One.

Requirements

  • Python 3.11+
  • MacOS 15.6+ or Linux

How to install Grit

Install dependencies

Before running the application, make sure to install the necessary dependencies. Follow these steps:

  1. Open a terminal or command prompt.
  2. Navigate to the project directory.
  3. Assuming that you have a supported version of Python installed, you can first set up your environment with:
    python3.11 -m venv env
    . env/bin/activate
    
    Note: If command not found: python3.11, use brew install python@3.11
  4. Install the backend dependencies using pip:
    pip install -r requirements.txt
    
    This command will install all the Python packages listed in the requirements.txt file.
  5. Perform necessary installation. This is to install Tailwind CSS.
    chmod +x ./scripts/install.sh
    ./scripts/install.sh
    
  6. For local development, add this in BASE_DIR/credentials.json:
    {
        "SECRET_KEY": "xxxx",
        "DATABASE_PASSWORD": ""
    }
    
  7. Go to aws.amazon.com -> RDS -> DB Instances -> database instance. Copy this endpoint. Update 'HOST' in DATABASES in settings.py to use this value.
    DATABASES = {
        'default': {
        ...
        'HOST': 'database-1-instance-1.xxxx.us-east-1.rds.amazonaws.com'
        }
    }
    
  8. Edit security group for the RDS.
    • In aws.amazon.com, RDS, click on database-1-instance-1 -> connectivity & security -> EC2 Security Group - inbound -> Edit inbound rules.
    • Remove the default rule, then add Type: PostgreSQL, Source: Anywhere-IPv4, then save rules.
    • Note that this is for development only. Change this setting in production.
  9. In aws.amazon.com, go to S3, then create (if it doesn't exist yet) a bucket for your chatbot vectorstores (assets).
    @dataclass
    class CustomConfig(Config):
       aws_s3_bucket_name: str = "yourdomain.example.com-assets"
    
  10. In IAM, create a new user (if it doesn't exist yet) to access the S3 bucket. Then, add in credentials.json:
    {
        ...
        "AWS_ACCESS_KEY_ID": "YOUR_AWS_ACCESS_KEY_ID",
        "AWS_SECRET_ACCESS_KEY": "YOUR_AWS_SECRET_ACCESS_KEY"
    }
    
  11. Run python manage.py migrate to apply database migrations for the first time.
  12. Create a new super admin. Run python manage.py createsuperuser, input email and password.

Run Local Development

  1. Activate environment
    . env/bin/activate
    
  2. Run server locally
    python manage.py runserver
    

Test Authentication

To test authentication run the following:

curl -X POST -d "username=your_username&password=your_password" http://localhost:8000/auth/login/ -c cookies.txt

Set Up Database

  1. Perform schema check
    python manage.py check
    
  2. Perform make migrations
    python manage.py makemigrations
    
  3. Apply migrations
    python manage.py migrate
    

Deployment To Production

Deployment To AWS

python scripts.py build_image
python scripts.py deploy