mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-22 23:31:12 +02:00
fix: Define BACKEND_DIR and correct usage in oneclick-conda-install.sh
This commit is contained in:
parent
0a11de9e95
commit
184df08f80
1 changed files with 31 additions and 7 deletions
|
|
@ -26,6 +26,7 @@ set -euo pipefail
|
|||
readonly PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly FRONTEND_DIR="${PROJECT_ROOT}/surfsense_web"
|
||||
readonly EXTENSION_DIR="${PROJECT_ROOT}/surfsense_browser_extension"
|
||||
readonly BACKEND_DIR="${PROJECT_ROOT}/surfsense_backend"
|
||||
|
||||
ENV_NAME="${SURFSENSE_ENV_NAME:-surfsense}"
|
||||
PYTHON_VERSION="${SURFSENSE_PYTHON_VERSION:-3.12}"
|
||||
|
|
@ -74,17 +75,41 @@ main() {
|
|||
conda_run python -m pip install --upgrade pip setuptools wheel
|
||||
|
||||
info "Installing SurfSense backend dependencies…"
|
||||
if [[ ! -d "${BACKEND_DIR}" ]]; then
|
||||
error "Backend directory not found at '${BACKEND_DIR}'. Verify repository layout and adjust BACKEND_DIR."
|
||||
fi
|
||||
conda_run python -m pip install -e "${BACKEND_DIR}"
|
||||
|
||||
info "Installing optional developer helpers…"
|
||||
conda_run python -m pip install "pre-commit>=3.8.0"
|
||||
|
||||
if command -v npm >/dev/null 2>&1; then
|
||||
info "Installing frontend dependencies (surfsense_web)…"
|
||||
(cd "${FRONTEND_DIR}" && npm install)
|
||||
|
||||
info "Installing browser extension dependencies (surfsense_browser_extension)…"
|
||||
(cd "${EXTENSION_DIR}" && npm install)
|
||||
if command -v node >/dev/null 2>&1; then
|
||||
NODE_MAJOR="$(node -v | sed -E 's/^v([0-9]+).*/\1/')"
|
||||
if [[ "${NODE_MAJOR}" -lt 18 ]]; then
|
||||
warn "Detected Node.js v$(node -v). Require >= v18; skipping frontend installs."
|
||||
NODE_OK=false
|
||||
else
|
||||
NODE_OK=true
|
||||
fi
|
||||
else
|
||||
warn "node not found (only npm present); skipping frontend installs."
|
||||
NODE_OK=false
|
||||
fi
|
||||
if [[ "${NODE_OK:-false}" == true ]]; then
|
||||
if [[ -d "${FRONTEND_DIR}" ]]; then
|
||||
info "Installing frontend dependencies (surfsense_web)…"
|
||||
(cd "${FRONTEND_DIR}" && npm install)
|
||||
else
|
||||
warn "Frontend directory not found at '${FRONTEND_DIR}'. Skipping web app install."
|
||||
fi
|
||||
if [[ -d "${EXTENSION_DIR}" ]]; then
|
||||
info "Installing browser extension dependencies (surfsense_browser_extension)…"
|
||||
(cd "${EXTENSION_DIR}" && npm install)
|
||||
else
|
||||
warn "Extension directory not found at '${EXTENSION_DIR}'. Skipping extension install."
|
||||
fi
|
||||
fi
|
||||
else
|
||||
warn "npm not found; skipping frontend dependency installation. Install Node.js 18+ to enable the web UI."
|
||||
fi
|
||||
|
|
@ -96,7 +121,7 @@ main() {
|
|||
conda activate ${ENV_NAME}
|
||||
|
||||
2. Start the backend API:
|
||||
(cd ${BACKEND_DIR} && uvicorn app.app:app --reload)
|
||||
(cd "${BACKEND_DIR}" && uvicorn app.app:app --reload)
|
||||
or refer to DEPLOYMENT_GUIDE.md for production options.
|
||||
|
||||
3. Start the web app (if npm was available):
|
||||
|
|
@ -107,4 +132,3 @@ EOF
|
|||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue