Skip to content

Automate EduAid Installation with setup.sh #219

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

Open
wants to merge 4 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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ backend/token.json
backend/service_account_key.json
venv
backend/Eduaid
.DS_Store
._s2v_old
.DS_Store

80 changes: 80 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/bin/bash

S2V_URL="https://github.com/explosion/sense2vec/releases/download/v1.0.0/s2v_reddit_2015_md.tar.gz"

BACKEND_DIR="backend"
WEB_DIR="eduaid_web"
EXTENSION_DIR="extension"
S2V_ARCHIVE="s2v_reddit_2015_md.tar.gz"

echo "Setting up EduAid"

# Detect OS
OS="$(uname)"
if [[ "$OS" == "Linux" || "$OS" == "Darwin" ]]; then
PYTHON_CMD="python3"
VENV_PATH="./venv/bin/activate"
elif [[ "$OS" =~ MINGW.* || "$OS" =~ MSYS.* || "$OS" =~ CYGWIN.* ]]; then
PYTHON_CMD="python"
VENV_PATH="./venv/Scripts/activate"
else
echo "Unsupported OS: $OS"
exit 1
fi

if [ ! -d "venv" ]; then
echo "creating virtual environment"
${PYTHON_CMD} -m venv venv
pip install -r requirements.txt
fi

echo "virtual environment activating"

# VENV_PATH="./venv/Scripts/activate"
source "$VENV_PATH"
echo "insstalling requirements for python"
pip install -r requirements.txt

echo "going to backend"

cd backend

if [ ! -f "$S2V_ARCHIVE" ]; then
echo "Downloading sense2vec archive"
curl -L $S2V_URL --output $S2V_ARCHIVE

fi

if [ -f "$S2V_ARCHIVE" ]; then

echo "Extracting"
tar -xvf "$S2V_ARCHIVE"
else
echo "Error: Archive file not found: $S2V_ARCHIVE"
exit 1
fi

echo Removing ${S2V_ARCHIVE}
rm -rf ${S2V_ARCHIVE}

cd ..


# React dependencies for web app
echo "Setting up web application dependencies"
cd "$WEB_DIR"

# create a .env file and copy the .env.example content to .env
echo "Setting up environment configuration"
cp .env.example .env

npm install
cd ..

# React dependencies for extension
echo "Setting up extension dependencies"
cd "$EXTENSION_DIR"
npm install
cd ..

echo "Setup complete! All components are ready."
Loading