Skip to content

Commit

Permalink
Merge branch 'main' into single-dep
Browse files Browse the repository at this point in the history
  • Loading branch information
panford committed Oct 2, 2024
2 parents 43e042c + 0161aef commit 02c781b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 6 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

---

Expand Down Expand Up @@ -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 <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**:
Expand Down
32 changes: 32 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 2 additions & 2 deletions setup/docs/setup_sql.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**.

Expand Down

0 comments on commit 02c781b

Please sign in to comment.