y59 commited on
Commit
e1d546a
·
verified ·
1 Parent(s): 84fbefb

Update startup.sh

Browse files
Files changed (1) hide show
  1. startup.sh +34 -27
startup.sh CHANGED
@@ -14,23 +14,29 @@ echo "NPM version: $(npm -v)"
14
  echo "User: $(whoami)"
15
  echo "Current working directory: $(pwd)"
16
 
 
 
 
 
 
 
17
  # Find stremio-web-service-run.sh
 
18
  STREMIO_SCRIPT=$(find / -name stremio-web-service-run.sh 2>/dev/null | head -1)
 
19
  if [ -z "$STREMIO_SCRIPT" ]; then
20
- echo "ERROR: Could not find stremio-web-service-run.sh"
21
- echo "Listing potential directories:"
22
- find / -type d -name "stremio*" 2>/dev/null
23
  ls -la /
24
- echo "Proceeding with proxy only"
25
- else
26
- echo "Found Stremio script at: $STREMIO_SCRIPT"
 
 
 
27
  fi
28
 
29
- # Set environment variables
30
- export HOME=/tmp
31
- export STREMIO_USER_DATA_DIR=/tmp/.stremio-server
32
- export NO_CORS=1
33
- export CASTING_DISABLED=1
34
 
35
  # Start proxy first to ensure Hugging Face health checks work
36
  echo "Starting proxy server on port 7860..."
@@ -42,20 +48,21 @@ echo "Proxy started with PID: $PROXY_PID"
42
  sleep 2
43
 
44
  # Start Stremio server if script was found
45
- if [ -n "$STREMIO_SCRIPT" ]; then
46
- echo "Starting Stremio server on port 11470..."
47
- chmod +x "$STREMIO_SCRIPT"
48
- "$STREMIO_SCRIPT" &
49
- STREMIO_PID=$!
50
- echo "Stremio server started with PID: $STREMIO_PID"
51
- else
52
- echo "WARNING: Skipping Stremio server start due to missing script"
53
- # Try running stremio server directly as fallback
54
- echo "Attempting to start server directly..."
55
- cd /
56
- node server.js &
57
- fi
58
 
59
- # Keep container running
60
- echo "Services started, monitoring processes..."
61
- wait
 
 
 
 
 
 
 
 
 
 
 
14
  echo "User: $(whoami)"
15
  echo "Current working directory: $(pwd)"
16
 
17
+ # Set environment variables
18
+ export HOME=/tmp
19
+ export STREMIO_USER_DATA_DIR=/tmp/.stremio-server
20
+ export NO_CORS=1
21
+ export CASTING_DISABLED=1
22
+
23
  # Find stremio-web-service-run.sh
24
+ echo "Searching for Stremio server script..."
25
  STREMIO_SCRIPT=$(find / -name stremio-web-service-run.sh 2>/dev/null | head -1)
26
+
27
  if [ -z "$STREMIO_SCRIPT" ]; then
28
+ echo "WARNING: Could not find stremio-web-service-run.sh"
29
+ echo "Listing files in root directory:"
 
30
  ls -la /
31
+ echo "Looking for other stremio files:"
32
+ find / -name "*stremio*" 2>/dev/null | head -20
33
+
34
+ echo "FALLBACK: Using proxy-only mode"
35
+ node /app/proxy-only.js
36
+ exit 0
37
  fi
38
 
39
+ echo "Found Stremio script at: $STREMIO_SCRIPT"
 
 
 
 
40
 
41
  # Start proxy first to ensure Hugging Face health checks work
42
  echo "Starting proxy server on port 7860..."
 
48
  sleep 2
49
 
50
  # Start Stremio server if script was found
51
+ echo "Starting Stremio server on port 11470 using $STREMIO_SCRIPT..."
52
+ chmod +x "$STREMIO_SCRIPT"
53
+ "$STREMIO_SCRIPT" &
54
+ STREMIO_PID=$!
 
 
 
 
 
 
 
 
 
55
 
56
+ if [ $? -ne 0 ]; then
57
+ echo "ERROR: Failed to start Stremio server"
58
+ echo "Terminating proxy..."
59
+ kill $PROXY_PID
60
+
61
+ echo "FALLBACK: Using proxy-only mode"
62
+ exec node /app/proxy-only.js
63
+ else
64
+ echo "Stremio server started with PID: $STREMIO_PID"
65
+ # Keep container running
66
+ echo "Services started, monitoring processes..."
67
+ wait
68
+ fi