IyXuan23 / ITProject2024SM2

Upgrading student handbook
https://api-test-gamma-nine.vercel.app
1 stars 0 forks source link

Unimelb Handbook Chatbot

Flask Vercel Postgres GitHub Actions

This is a chatbot integrated with OpenAI and Vanna AI, connected through a Chrome extension that provides users with real-time assistance based on the UoM Student Handbook.

Try the Chatbot

Deployment guideline

Prerequisites

Step 1: Clone the repository

git clone https://github.com/may-bee/it-project2024-sm-2.git

Step 2: Environment Setup

  1. Install Python
    Ensure Python 3.x is installed on your system. You can verify by running:

    python3 --version
  2. Create a Virtual Environment
    Set up a virtual environment to isolate the dependencies:

    python3 -m venv venv
  3. Activate the Virtual Environment
    For Windows:

    venv\Scripts\activate

    For Linux or macOS:

    source venv/bin/activate
  4. Install Dependencies
    Install the necessary dependencies from requirements.txt:

    pip install -r requirements.txt

Step 3: Vercel CLI Installation

  1. Install Node.js and NPM
    Ensure that Node.js and npm are installed on your machine, as Vercel requires npm. You can check the versions with:

    node -v
    npm -v
  2. Install Vercel CLI
    To install the Vercel command-line tool globally, run:

    npm install -g vercel

Step 4: Build Procedures

Vercel automatically detects and builds your project when deploying. However, to ensure everything goes smoothly, set up the necessary build command.

  1. Create a Start Script
    Add a start command to app.py if not already present:

    if __name__ == '__main__':
       from os import environ
       app.run(debug=False, port=int(environ.get('PORT', 5000)), host='0.0.0.0')
  2. Ensure Dependencies
    Make sure all necessary Python dependencies are included in requirements.txt.

Step 5: Deploying to Vercel

  1. Log in to Vercel
    Use the Vercel CLI to log in:

    vercel login
  2. Initialize Deployment
    Navigate to your project directory and initialize Vercel deployment:

    vercel

Step 6: Environment Variables

  1. Add Environment Variables
    Use the .env.sample as a reference for necessary environment variables. You can add these to Vercel's configuration:
    vercel env add VARIABLE_NAME VARIABLE_VALUE

    You can also use the Vercel Dashboard to manage environment variables.

Step 7: Push to Production

  1. Test the Deployment
    After the initial deployment, Vercel provides a unique staging URL where you can test your API to ensure it works as expected.

  2. Promote to Production
    If everything looks good on the staging URL, you can promote the app to production using:

    vercel --prod

Vercel will handle the build and deployment processes and provide you with an updated production link.

System Architecture Overview

image