Shubhambhandari commited on
Commit
60232d3
·
verified ·
1 Parent(s): 3835cb8

Upload setup_oracle.sh

Browse files
Files changed (1) hide show
  1. setup_oracle.sh +12 -1
setup_oracle.sh CHANGED
@@ -7,6 +7,17 @@ PASSCODE="${1:-pathify123}"
7
  APP=/opt/pathify
8
  HF=https://huggingface.co/spaces/Shubhambhandari/Pathify
9
 
 
 
 
 
 
 
 
 
 
 
 
10
  echo "[pathify] 1/5 installing system packages..."
11
  export DEBIAN_FRONTEND=noninteractive
12
  apt-get update -y
@@ -40,7 +51,7 @@ Environment=PATHQA_MODEL=$APP/model.pt
40
  Environment=PATHQA_FEEDBACK_DIR=$APP/data/feedback
41
  Environment=PATHQA_AUDIT_LOG=$APP/data/audit.log
42
  Environment=PATHQA_PASSWORD=$PASSCODE
43
- ExecStart=$APP/venv/bin/python $APP/backend/server.py --host 0.0.0.0 --port 80 --cases 24 --slides 3 --demo-train-steps 0
44
  Restart=always
45
  RestartSec=3
46
 
 
7
  APP=/opt/pathify
8
  HF=https://huggingface.co/spaces/Shubhambhandari/Pathify
9
 
10
+ echo "[pathify] 0/5 checking memory, adding swap on small boxes..."
11
+ MEM_MB=$(free -m | awk '/^Mem:/{print $2}')
12
+ if [ "${MEM_MB:-0}" -lt 4000 ] && [ ! -f /swapfile ]; then
13
+ echo "[pathify] low RAM (${MEM_MB}MB) -> creating 4G swap"
14
+ fallocate -l 4G /swapfile || dd if=/dev/zero of=/swapfile bs=1M count=4096
15
+ chmod 600 /swapfile && mkswap /swapfile && swapon /swapfile
16
+ grep -q '/swapfile' /etc/fstab || echo '/swapfile none swap sw 0 0' >> /etc/fstab
17
+ fi
18
+ # On a small box, skip the demo cohort so boot is light.
19
+ if [ "${MEM_MB:-0}" -lt 4000 ]; then CASES=0; SLIDES=0; else CASES=24; SLIDES=3; fi
20
+
21
  echo "[pathify] 1/5 installing system packages..."
22
  export DEBIAN_FRONTEND=noninteractive
23
  apt-get update -y
 
51
  Environment=PATHQA_FEEDBACK_DIR=$APP/data/feedback
52
  Environment=PATHQA_AUDIT_LOG=$APP/data/audit.log
53
  Environment=PATHQA_PASSWORD=$PASSCODE
54
+ ExecStart=$APP/venv/bin/python $APP/backend/server.py --host 0.0.0.0 --port 80 --cases $CASES --slides $SLIDES --demo-train-steps 0
55
  Restart=always
56
  RestartSec=3
57