Spaces:
Paused
Paused
fix: move ALL app scripts to /scripts/ (outside PERSIST_DIRS)
Browse filesDataset restore overwrites files in /opt/ and /etc/ with stale
versions from the dataset. Move all Docker image scripts to
/scripts/ which is NOT in PERSIST_DIRS, so they survive restore.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Dockerfile +8 -9
- scripts/entrypoint.sh +2 -2
- ubuntu-server/start-server.sh +2 -2
Dockerfile
CHANGED
|
@@ -43,20 +43,19 @@ RUN useradd -m -u 1000 -s /bin/bash -p "$(openssl passwd -6 huggingrun)" user 2>
|
|
| 43 |
RUN usermod -p "$(openssl passwd -6 huggingrun)" root
|
| 44 |
RUN mkdir -p /data
|
| 45 |
|
| 46 |
-
#
|
| 47 |
-
|
| 48 |
-
COPY ubuntu-server/ws-ssh-bridge.py /opt/ws-ssh-bridge.py
|
| 49 |
-
COPY ubuntu-server/git_sync_daemon.py /opt/git_sync_daemon.py
|
| 50 |
-
COPY ubuntu-server/log_streamer.py /opt/log_streamer.py
|
| 51 |
-
COPY ubuntu-server/start-server.sh /opt/start-server.sh
|
| 52 |
COPY scripts /scripts
|
| 53 |
-
# nginx.conf AFTER scripts copy (COPY scripts replaces the dir)
|
| 54 |
COPY ubuntu-server/nginx.conf /scripts/nginx.conf
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
ENV PERSIST_PATH=/data
|
| 58 |
ENV PYTHONUNBUFFERED=1
|
| 59 |
-
ENV RUN_CMD="/
|
| 60 |
ENV SSH_PORT=2222
|
| 61 |
|
| 62 |
# Run as root (needed for: apt install persistence, bind mounts, sshd)
|
|
|
|
| 43 |
RUN usermod -p "$(openssl passwd -6 huggingrun)" root
|
| 44 |
RUN mkdir -p /data
|
| 45 |
|
| 46 |
+
# All app scripts go to /scripts/ β OUTSIDE persist dirs (/opt, /etc get
|
| 47 |
+
# restored from dataset, which would overwrite Docker image files with stale versions)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
COPY scripts /scripts
|
|
|
|
| 49 |
COPY ubuntu-server/nginx.conf /scripts/nginx.conf
|
| 50 |
+
COPY ubuntu-server/ws-ssh-bridge.py /scripts/ws-ssh-bridge.py
|
| 51 |
+
COPY ubuntu-server/git_sync_daemon.py /scripts/git_sync_daemon.py
|
| 52 |
+
COPY ubuntu-server/log_streamer.py /scripts/log_streamer.py
|
| 53 |
+
COPY ubuntu-server/start-server.sh /scripts/start-server.sh
|
| 54 |
+
RUN chmod +x /scripts/entrypoint.sh /scripts/start-server.sh
|
| 55 |
|
| 56 |
ENV PERSIST_PATH=/data
|
| 57 |
ENV PYTHONUNBUFFERED=1
|
| 58 |
+
ENV RUN_CMD="/scripts/start-server.sh"
|
| 59 |
ENV SSH_PORT=2222
|
| 60 |
|
| 61 |
# Run as root (needed for: apt install persistence, bind mounts, sshd)
|
scripts/entrypoint.sh
CHANGED
|
@@ -74,12 +74,12 @@ log "[entrypoint] Wrote /etc/huggingrun.env"
|
|
| 74 |
|
| 75 |
# Step 1: Init β download dataset + restore filesystem (foreground so logs are visible)
|
| 76 |
log "[entrypoint] ββ Step 1: Init (download + restore) ββ"
|
| 77 |
-
python3 -u /
|
| 78 |
log "[entrypoint] ββ Init done ββ"
|
| 79 |
|
| 80 |
# Step 2: Start background sync-loop daemon
|
| 81 |
log "[entrypoint] ββ Step 2: Starting sync-loop daemon ββ"
|
| 82 |
-
python3 -u /
|
| 83 |
SYNC_PID=$!
|
| 84 |
log "[entrypoint] Sync daemon PID=${SYNC_PID}"
|
| 85 |
|
|
|
|
| 74 |
|
| 75 |
# Step 1: Init β download dataset + restore filesystem (foreground so logs are visible)
|
| 76 |
log "[entrypoint] ββ Step 1: Init (download + restore) ββ"
|
| 77 |
+
python3 -u /scripts/git_sync_daemon.py init
|
| 78 |
log "[entrypoint] ββ Init done ββ"
|
| 79 |
|
| 80 |
# Step 2: Start background sync-loop daemon
|
| 81 |
log "[entrypoint] ββ Step 2: Starting sync-loop daemon ββ"
|
| 82 |
+
python3 -u /scripts/git_sync_daemon.py sync-loop &
|
| 83 |
SYNC_PID=$!
|
| 84 |
log "[entrypoint] Sync daemon PID=${SYNC_PID}"
|
| 85 |
|
ubuntu-server/start-server.sh
CHANGED
|
@@ -57,7 +57,7 @@ fi
|
|
| 57 |
|
| 58 |
# ββ SSE log streamer ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 59 |
log "[ubuntu] Starting SSE log streamer on 127.0.0.1:7863 ..."
|
| 60 |
-
python3 /
|
| 61 |
STREAMER_PID=$!
|
| 62 |
sleep 1
|
| 63 |
if kill -0 $STREAMER_PID 2>/dev/null; then
|
|
@@ -68,7 +68,7 @@ fi
|
|
| 68 |
|
| 69 |
# ββ WebSocket-to-SSH bridge βββββββββββββββββββββββββββββββββββββββ
|
| 70 |
log "[ubuntu] Starting WS-SSH bridge on 127.0.0.1:7862 ..."
|
| 71 |
-
python3 /
|
| 72 |
BRIDGE_PID=$!
|
| 73 |
sleep 1
|
| 74 |
if kill -0 $BRIDGE_PID 2>/dev/null; then
|
|
|
|
| 57 |
|
| 58 |
# ββ SSE log streamer ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 59 |
log "[ubuntu] Starting SSE log streamer on 127.0.0.1:7863 ..."
|
| 60 |
+
python3 /scripts/log_streamer.py &
|
| 61 |
STREAMER_PID=$!
|
| 62 |
sleep 1
|
| 63 |
if kill -0 $STREAMER_PID 2>/dev/null; then
|
|
|
|
| 68 |
|
| 69 |
# ββ WebSocket-to-SSH bridge βββββββββββββββββββββββββββββββββββββββ
|
| 70 |
log "[ubuntu] Starting WS-SSH bridge on 127.0.0.1:7862 ..."
|
| 71 |
+
python3 /scripts/ws-ssh-bridge.py &
|
| 72 |
BRIDGE_PID=$!
|
| 73 |
sleep 1
|
| 74 |
if kill -0 $BRIDGE_PID 2>/dev/null; then
|