habppyar commited on
Commit
7efdd11
·
verified ·
1 Parent(s): 2cfbcd2

Update start.sh

Browse files
Files changed (1) hide show
  1. start.sh +25 -2
start.sh CHANGED
@@ -39,8 +39,24 @@ if [[ ! -d "/data" || ! -w "/data" ]]; then
39
  fi
40
  mkdir -p "${WORKSPACE_ROOT}/chat" "${WORKSPACE_ROOT}/test" "${WORKSPACE_ROOT}/project"
41
 
42
- # Make it easy to find from "/" in the web file picker
43
- ln -sfn "${WORKSPACE_ROOT}" /workspace || true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
  # Seed/overwrite persisted config from repo bootstrap (simple + reproducible)
46
  log "Sync bootstrap => ${PERSIST_ROOT}"
@@ -58,6 +74,13 @@ opencode --version || true
58
  log "Workspace root: ${WORKSPACE_ROOT}"
59
  log "Starting OpenCode Web on 0.0.0.0:${APP_PORT}"
60
 
 
 
 
 
 
 
61
  # IMPORTANT: do NOT use "--cwd" (this opencode doesn't support it)
 
62
  cd "${WORKSPACE_ROOT}"
63
  exec opencode web --hostname 0.0.0.0 --port "${APP_PORT}"
 
39
  fi
40
  mkdir -p "${WORKSPACE_ROOT}/chat" "${WORKSPACE_ROOT}/test" "${WORKSPACE_ROOT}/project"
41
 
42
+ # --- KEY FIX FOR WEB UI ISSUE #12487: Also create directories at root level ----
43
+ # Some web UI implementations (especially in containerized environments)
44
+ # expect to see folders at predictable root-level paths rather than through symlinks
45
+ # or nested paths. Creating these at root level improves web UI compatibility.
46
+ mkdir -p /chat /project /other
47
+ log "Created root-level directories for web UI compatibility: /chat, /project, /other"
48
+
49
+ # --- ALSO: Ensure symlink is handled robustly ----
50
+ rm -f /workspace
51
+ ln -sfn "${WORKSPACE_ROOT}" /workspace
52
+ log "Created workspace symlink: /workspace -> ${WORKSPACE_ROOT}"
53
+
54
+ # --- ADDITIONAL ROOT-LEVEL SYMLINKS FOR WEB UI COMPATIBILITY ----
55
+ # Create direct symlinks to common directories that web UI might expect
56
+ ln -sfn "${WORKSPACE_ROOT}/chat" /chat || true
57
+ ln -sfn "${WORKSPACE_ROOT}/project" /project || true
58
+ ln -sfn "${WORKSPACE_ROOT}/other" /other || true
59
+ log "Created direct symlinks for web UI compatibility"
60
 
61
  # Seed/overwrite persisted config from repo bootstrap (simple + reproducible)
62
  log "Sync bootstrap => ${PERSIST_ROOT}"
 
74
  log "Workspace root: ${WORKSPACE_ROOT}"
75
  log "Starting OpenCode Web on 0.0.0.0:${APP_PORT}"
76
 
77
+ # --- IMPROVED STARTUP SEQUENCE FOR WEB UI RELIABILITY ----
78
+ # Add a small delay to ensure all filesystem operations are complete
79
+ # before the web UI starts initializing and attempting to read directory structures
80
+ sleep 2
81
+ log "Filesystem synchronization complete, starting web UI..."
82
+
83
  # IMPORTANT: do NOT use "--cwd" (this opencode doesn't support it)
84
+ # Start from the workspace root as originally intended
85
  cd "${WORKSPACE_ROOT}"
86
  exec opencode web --hostname 0.0.0.0 --port "${APP_PORT}"