From 43302c31350c888493c84c779250a2ea98fb4a30 Mon Sep 17 00:00:00 2001 From: Mike Liao Date: Thu, 31 Oct 2024 00:38:41 -0700 Subject: [PATCH] fix log bash path for local --- apps/content/start_fastapi.sh | 41 ++++++++++++++++++++++++- sites/authentication/deploy/local/.env | 1 + sites/central_storage/deploy/local/.env | 1 + sites/content/deploy/local/.env | 4 +++ 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 sites/content/deploy/local/.env diff --git a/apps/content/start_fastapi.sh b/apps/content/start_fastapi.sh index a2a36e1..71e5a30 100644 --- a/apps/content/start_fastapi.sh +++ b/apps/content/start_fastapi.sh @@ -1 +1,40 @@ -uvicorn webapi.main:app --reload --host 0.0.0.0 --port 8103 \ No newline at end of file +#! /bin/bash +rp=$(dirname "$(realpath '$1'))") +pushd $rp + +APP_NAME=content +APP_PARENT_FOLDER=apps + +GIT_REPO_ROOT=$(git rev-parse --show-toplevel) +CODEBASE_ROOT=$GIT_REPO_ROOT/$APP_PARENT_FOLDER/$APP_NAME +SITE_DEPLOY_FOLDER=$GIT_REPO_ROOT/sites/$APP_NAME/deploy + + +echo APP_NAME=$APP_NAME > .env +cat $SITE_DEPLOY_FOLDER/common/.env >> .env +echo GIT_REPO_ROOT=$(git rev-parse --show-toplevel) >> .env +echo CODEBASE_ROOT=$GIT_REPO_ROOT/$APP_PARENT_FOLDER/$APP_NAME >> .env +echo SITE_DEPLOY_FOLDER=$GIT_REPO_ROOT/sites/$APP_NAME/deploy >> .env +cat $SITE_DEPLOY_FOLDER/common/.host.env >> .env +cat $SITE_DEPLOY_FOLDER/local/.env >> .env + +. .env + +if [ -d "$VENV_DIR" ] +then + echo "Folder $VENV_DIR exists. Proceed to next steps" +else + echo "Folder $VENV_DIR dosen't exist. create it" + sudo apt install python3-pip + python3 -m pip install virtualenv + python3 -m virtualenv $VENV_DIR +fi + +source $VENV_DIR/bin/activate +pip install --upgrade pip +pip install -r requirements.txt + +uvicorn webapi.main:app --reload --host 0.0.0.0 --port $SERVICE_API_ACCESS_PORT + + +popd diff --git a/sites/authentication/deploy/local/.env b/sites/authentication/deploy/local/.env index 4938c5e..aec25fc 100644 --- a/sites/authentication/deploy/local/.env +++ b/sites/authentication/deploy/local/.env @@ -1,3 +1,4 @@ export MONGODB_URI=mongodb://localhost:27017/ export FREELEAPS_ENV=local +export LOG_BASE_PATH=${CODEBASE_ROOT}/log diff --git a/sites/central_storage/deploy/local/.env b/sites/central_storage/deploy/local/.env index 4938c5e..aec25fc 100644 --- a/sites/central_storage/deploy/local/.env +++ b/sites/central_storage/deploy/local/.env @@ -1,3 +1,4 @@ export MONGODB_URI=mongodb://localhost:27017/ export FREELEAPS_ENV=local +export LOG_BASE_PATH=${CODEBASE_ROOT}/log diff --git a/sites/content/deploy/local/.env b/sites/content/deploy/local/.env new file mode 100644 index 0000000..aec25fc --- /dev/null +++ b/sites/content/deploy/local/.env @@ -0,0 +1,4 @@ +export MONGODB_URI=mongodb://localhost:27017/ +export FREELEAPS_ENV=local +export LOG_BASE_PATH=${CODEBASE_ROOT}/log +