Spaces:
Paused
Paused
fix: store nginx.conf outside PERSIST_DIRS, restore before nginx start
Browse filesDataset restore overwrites /etc/nginx/nginx.conf with stale version.
Fix: keep canonical config at /scripts/nginx.conf (not in PERSIST_DIRS),
copy it to /etc/nginx/ before starting nginx.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Dockerfile +2 -0
- ubuntu-server/start-server.sh +2 -0
Dockerfile
CHANGED
|
@@ -44,7 +44,9 @@ RUN usermod -p "$(openssl passwd -6 huggingrun)" root
|
|
| 44 |
RUN mkdir -p /data
|
| 45 |
|
| 46 |
# nginx + bridge + startup scripts
|
|
|
|
| 47 |
COPY ubuntu-server/nginx.conf /etc/nginx/nginx.conf
|
|
|
|
| 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
|
|
|
|
| 44 |
RUN mkdir -p /data
|
| 45 |
|
| 46 |
# nginx + bridge + startup scripts
|
| 47 |
+
# nginx.conf goes to /scripts/ (outside PERSIST_DIRS) to survive restore
|
| 48 |
COPY ubuntu-server/nginx.conf /etc/nginx/nginx.conf
|
| 49 |
+
COPY ubuntu-server/nginx.conf /scripts/nginx.conf
|
| 50 |
COPY ubuntu-server/ws-ssh-bridge.py /opt/ws-ssh-bridge.py
|
| 51 |
COPY ubuntu-server/git_sync_daemon.py /opt/git_sync_daemon.py
|
| 52 |
COPY ubuntu-server/log_streamer.py /opt/log_streamer.py
|
ubuntu-server/start-server.sh
CHANGED
|
@@ -113,6 +113,8 @@ log "[ubuntu] Stream SSE: curl -N https://<space>.hf.space/runlog/stream"
|
|
| 113 |
done) &
|
| 114 |
|
| 115 |
# ββ Start nginx LAST β opens port 7860 β HF transitions to RUNNING ββ
|
|
|
|
|
|
|
| 116 |
log "[ubuntu] Starting nginx on 0.0.0.0:7860 (HF will mark RUNNING) ..."
|
| 117 |
nginx -g 'daemon off;' &
|
| 118 |
NGINX_PID=$!
|
|
|
|
| 113 |
done) &
|
| 114 |
|
| 115 |
# ββ Start nginx LAST β opens port 7860 β HF transitions to RUNNING ββ
|
| 116 |
+
# Restore Docker image's nginx config (dataset restore may overwrite /etc/nginx)
|
| 117 |
+
cp /scripts/nginx.conf /etc/nginx/nginx.conf 2>/dev/null || true
|
| 118 |
log "[ubuntu] Starting nginx on 0.0.0.0:7860 (HF will mark RUNNING) ..."
|
| 119 |
nginx -g 'daemon off;' &
|
| 120 |
NGINX_PID=$!
|