github-actions[bot] commited on
Commit
049a5b4
·
1 Parent(s): 5641301

🚀 Auto-deploy backend from GitHub (0dabfcc)

Browse files
scripts/download_vectorstore_from_firebase.py CHANGED
@@ -67,7 +67,19 @@ def download_vectorstore(dest_dir: Path, prefix: str = REMOTE_PREFIX):
67
 
68
 
69
  if __name__ == "__main__":
 
 
 
 
70
  logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")
71
  dest_dir = _resolve_dest_dir()
72
- logger.info("Using vectorstore destination: %s", dest_dir)
73
- download_vectorstore(dest_dir, REMOTE_PREFIX)
 
 
 
 
 
 
 
 
 
67
 
68
 
69
  if __name__ == "__main__":
70
+ import firebase_admin
71
+ print("DEBUG: firebase_admin location:", firebase_admin.__file__)
72
+ print("DEBUG: firebase_admin apps:", firebase_admin._apps)
73
+ print("DEBUG: FIREBASE_SERVICE_ACCOUNT_JSON set:", bool(firebase_admin._GLOBAL_APP is None))
74
  logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")
75
  dest_dir = _resolve_dest_dir()
76
+ print(f"INFO: Using vectorstore destination: {dest_dir}")
77
+ print(f"INFO: CURRICULUM_VECTORSTORE_DIR env: {os.environ.get('CURRICULUM_VECTORSTORE_DIR', 'not set')}")
78
+ print(f"INFO: VECTORSTORE_DIR env: {os.environ.get('VECTORSTORE_DIR', 'not set')}")
79
+ print(f"INFO: FIREBASE_STORAGE_BUCKET env: {os.environ.get('FIREBASE_STORAGE_BUCKET', 'not set')}")
80
+ print(f"INFO: FIREBASE_SERVICE_ACCOUNT_JSON length: {len(os.environ.get('FIREBASE_SERVICE_ACCOUNT_JSON', ''))}")
81
+ result = download_vectorstore(dest_dir, REMOTE_PREFIX)
82
+ if result:
83
+ print("SUCCESS: Vectorstore download completed")
84
+ else:
85
+ print("FAILURE: Vectorstore download failed")
startup.sh CHANGED
@@ -1,6 +1,15 @@
1
  #!/bin/sh
2
  set -eu
3
 
 
 
 
 
 
 
 
 
 
4
  if [ -d "/data" ]; then
5
  : "${CURRICULUM_DIR:=/data/curriculum}"
6
  : "${VECTORSTORE_DIR:=/data/vectorstore}"
@@ -13,6 +22,9 @@ export CURRICULUM_DIR
13
  export VECTORSTORE_DIR
14
  export CURRICULUM_VECTORSTORE_DIR="${VECTORSTORE_DIR}"
15
 
 
 
 
16
  mkdir -p "${CURRICULUM_DIR}" "${VECTORSTORE_DIR}"
17
 
18
  _vectorstore_cache_dir="${VECTORSTORE_DIR}/.chroma"
@@ -35,8 +47,14 @@ fi
35
 
36
  _vectorstore_download_script="/app/scripts/download_vectorstore_from_firebase.py"
37
  if [ -f "${_vectorstore_download_script}" ]; then
 
 
 
 
38
  echo "INFO: Downloading vectorstore from Firebase Storage..."
39
  python "${_vectorstore_download_script}" || echo "WARNING: Vectorstore download failed, continuing anyway"
 
 
40
  _vectorstore_summary_file="${VECTORSTORE_DIR}/ingest_summary.json"
41
  if [ -f "${_vectorstore_summary_file}" ]; then
42
  echo "INFO: Vectorstore summary found at ${_vectorstore_summary_file}"
 
1
  #!/bin/sh
2
  set -eu
3
 
4
+ echo "=========================================="
5
+ echo "MathPulse AI Startup"
6
+ echo "=========================================="
7
+ echo "VECTORSTORE_DIR=${VECTORSTORE_DIR}"
8
+ echo "CURRICULUM_VECTORSTORE_DIR=${CURRICULUM_VECTORSTORE_DIR}"
9
+ echo "FIREBASE_SERVICE_ACCOUNT_JSON set: $(if [ -n "${FIREBASE_SERVICE_ACCOUNT_JSON:-}" ]; then echo YES; else echo NO; fi)"
10
+ echo "FIREBASE_STORAGE_BUCKET=${FIREBASE_STORAGE_BUCKET:-not set}"
11
+ echo "=========================================="
12
+
13
  if [ -d "/data" ]; then
14
  : "${CURRICULUM_DIR:=/data/curriculum}"
15
  : "${VECTORSTORE_DIR:=/data/vectorstore}"
 
22
  export VECTORSTORE_DIR
23
  export CURRICULUM_VECTORSTORE_DIR="${VECTORSTORE_DIR}"
24
 
25
+ echo "Resolved VECTORSTORE_DIR=${VECTORSTORE_DIR}"
26
+ echo "Resolved CURRICULUM_VECTORSTORE_DIR=${CURRICULUM_VECTORSTORE_DIR}"
27
+
28
  mkdir -p "${CURRICULUM_DIR}" "${VECTORSTORE_DIR}"
29
 
30
  _vectorstore_cache_dir="${VECTORSTORE_DIR}/.chroma"
 
47
 
48
  _vectorstore_download_script="/app/scripts/download_vectorstore_from_firebase.py"
49
  if [ -f "${_vectorstore_download_script}" ]; then
50
+ echo "INFO: Vectorstore files present before download:"
51
+ ls -la "${VECTORSTORE_DIR}/"
52
+ echo "INFO: Vectorstore download script path: ${_vectorstore_download_script}"
53
+ echo "INFO: CURRICULUM_VECTORSTORE_DIR at download time: ${CURRICULUM_VECTORSTORE_DIR}"
54
  echo "INFO: Downloading vectorstore from Firebase Storage..."
55
  python "${_vectorstore_download_script}" || echo "WARNING: Vectorstore download failed, continuing anyway"
56
+ echo "INFO: Vectorstore files present after download:"
57
+ ls -la "${VECTORSTORE_DIR}/"
58
  _vectorstore_summary_file="${VECTORSTORE_DIR}/ingest_summary.json"
59
  if [ -f "${_vectorstore_summary_file}" ]; then
60
  echo "INFO: Vectorstore summary found at ${_vectorstore_summary_file}"