diff --git a/README.md b/README.md index 5b2a47a6..7a649db5 100644 --- a/README.md +++ b/README.md @@ -20,10 +20,7 @@ The setup can also be run locally at http://127.0.0.1 or http://localhost. - [Cloud Run Deployment](#cloud-run-deployment) 2. [Web Hosted Application for Data Annotation](#web-hosted-application-for-data-annotation) - [Application Overview](#application-overview) - - [Installation](#installation) - [Usage](#usage) -3. [Contributing](#contributing) -4. [License](#license) --- @@ -54,7 +51,12 @@ This section guides you through setting up the Google Cloud infrastructure neces ```sh uvicorn setup.backend.app.main:app --reload --port ``` - +4. **Install Google Cloud SDK**: \ + Ensure you have [Google Cloud SDK](https://cloud.google.com/sdk/docs/install) installed and authenticate. + ```sh + gcloud auth login + gcloud config set project YOUR_PROJECT_ID + ``` ### Database Setup 1. **Cloud SQL Configuration**: diff --git a/setup.sh b/setup.sh new file mode 100644 index 00000000..5ba8fd75 --- /dev/null +++ b/setup.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# Checking for all required dependencies +command -v git >/dev/null 2>&1 || { echo "Git is required. Please install Git."; exit 1; } +command -v node >/dev/null 2>&1 || { echo "Node.js is required. Please install Node.js."; exit 1; } +command -v npm >/dev/null 2>&1 || { echo "npm is required. Please install npm."; exit 1; } +command -v uvicorn >/dev/null 2>&1 || { echo "Installing Uvicorn..."; pip install uvicorn; } + +cd setup/frontend || { echo "Failed to navigate to frontend directory"; exit 1; } + +echo "Installing and building npm packages and files..." +npm install +npm run build + +cd ../.. + +# Start the FastAPI server +PORT=${1:-8800} +echo "Starting the FastAPI server on port $PORT..." +uvicorn setup.backend.app.main:app --reload --port "$PORT" & + +sleep 2 + +OS=${2:-linux} + +if [[ "$OS" == "macos" ]]; then + open "http://localhost:$PORT" +else + xdg-open "http://localhost:$PORT" +fi + +echo "Setup complete! Access the application at http://localhost:$PORT" diff --git a/setup/docs/setup_sql.md b/setup/docs/setup_sql.md index 1821ba99..6220bedd 100644 --- a/setup/docs/setup_sql.md +++ b/setup/docs/setup_sql.md @@ -16,8 +16,8 @@ You can create a Cloud SQL instance using the Google Cloud Console or via the co ### Using Google Cloud Console #### Create Instance 1. In the Google Cloud Console, navigate to **SQL**. -2. Click on **Create Instance**. -3. Select **PostgreSQL** (or your desired database type). +2. Click on **Create Instance**. You might have to enable Compute Engine API if not already enabled. +3. Select **PostgreSQL**. 4. Enter the instance ID, password for the default `postgres` user, and configure other settings (region, machine type, etc.). 5. Click **Create**.