From bc03a0ca737d5d094e9bebd8fa3fb2599a060f23 Mon Sep 17 00:00:00 2001 From: raykkk Date: Wed, 21 Jan 2026 18:57:14 +0800 Subject: [PATCH 1/8] clean tmp --- examples/sandbox/custom_sandbox/box/config/supervisord.conf | 4 ++-- .../sandbox/box/gui/box/config/supervisord.conf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/sandbox/custom_sandbox/box/config/supervisord.conf b/examples/sandbox/custom_sandbox/box/config/supervisord.conf index 7d0b343f6..3898f5b10 100644 --- a/examples/sandbox/custom_sandbox/box/config/supervisord.conf +++ b/examples/sandbox/custom_sandbox/box/config/supervisord.conf @@ -5,7 +5,7 @@ pidfile=/var/log/supervisord.pid nodaemon=true [program:dbus] -command=/usr/bin/dbus-daemon --system --nofork +command=/bin/sh -c "rm -f /run/dbus/pid; mkdir -p /run/dbus; exec /usr/bin/dbus-daemon --system --nofork" autostart=true autorestart=true stderr_logfile=/var/log/dbus.err.log @@ -28,7 +28,7 @@ stderr_logfile=/var/log/nginx.err.log stdout_logfile=/var/log/nginx.out.log [program:xvfb] -command=/usr/bin/Xvfb :1 -screen 0 1280x800x24 +command=/bin/sh -c "rm -f /tmp/.X1-lock /tmp/.X11-unix/X1; exec /usr/bin/Xvfb :1 -screen 0 1280x800x24" autostart=true autorestart=true priority=10 diff --git a/src/agentscope_runtime/sandbox/box/gui/box/config/supervisord.conf b/src/agentscope_runtime/sandbox/box/gui/box/config/supervisord.conf index 7d0b343f6..3898f5b10 100644 --- a/src/agentscope_runtime/sandbox/box/gui/box/config/supervisord.conf +++ b/src/agentscope_runtime/sandbox/box/gui/box/config/supervisord.conf @@ -5,7 +5,7 @@ pidfile=/var/log/supervisord.pid nodaemon=true [program:dbus] -command=/usr/bin/dbus-daemon --system --nofork +command=/bin/sh -c "rm -f /run/dbus/pid; mkdir -p /run/dbus; exec /usr/bin/dbus-daemon --system --nofork" autostart=true autorestart=true stderr_logfile=/var/log/dbus.err.log @@ -28,7 +28,7 @@ stderr_logfile=/var/log/nginx.err.log stdout_logfile=/var/log/nginx.out.log [program:xvfb] -command=/usr/bin/Xvfb :1 -screen 0 1280x800x24 +command=/bin/sh -c "rm -f /tmp/.X1-lock /tmp/.X11-unix/X1; exec /usr/bin/Xvfb :1 -screen 0 1280x800x24" autostart=true autorestart=true priority=10 From a9e9d747d39fc5254af12b4d646a8591682d854a Mon Sep 17 00:00:00 2001 From: raykkk Date: Wed, 21 Jan 2026 19:05:31 +0800 Subject: [PATCH 2/8] add launch order --- .../box/config/supervisord.conf | 42 +++++++++---------- .../box/gui/box/config/supervisord.conf | 42 +++++++++---------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/examples/sandbox/custom_sandbox/box/config/supervisord.conf b/examples/sandbox/custom_sandbox/box/config/supervisord.conf index 3898f5b10..31f5fc07f 100644 --- a/examples/sandbox/custom_sandbox/box/config/supervisord.conf +++ b/examples/sandbox/custom_sandbox/box/config/supervisord.conf @@ -11,24 +11,8 @@ autorestart=true stderr_logfile=/var/log/dbus.err.log stdout_logfile=/var/log/dbus.out.log -[program:agentscope_runtime] -command=/agentscope_runtime/scripts/start.sh -autostart=true -autorestart=true -priority=30 -stderr_logfile=/var/log/agentscope_runtime.err.log -stdout_logfile=/var/log/agentscope_runtime.out.log -environment=DISPLAY=":1" - -[program:nginx] -command=/usr/sbin/nginx -g 'daemon off;' -autostart=true -autorestart=true -stderr_logfile=/var/log/nginx.err.log -stdout_logfile=/var/log/nginx.out.log - [program:xvfb] -command=/bin/sh -c "rm -f /tmp/.X1-lock /tmp/.X11-unix/X1; exec /usr/bin/Xvfb :1 -screen 0 1280x800x24" +command=/bin/sh -c "rm -f /tmp/.X1-lock /tmp/.X11-unix/X1; mkdir -p /tmp/.X11-unix; exec /usr/bin/Xvfb :1 -screen 0 1280x800x24" autostart=true autorestart=true priority=10 @@ -37,7 +21,7 @@ stdout_logfile=/var/log/xvfb.out.log environment=DISPLAY=":1" [program:xfce4] -command=/bin/sh -c "export DISPLAY=:1 && sleep 2 && export $(dbus-launch) && dbus-run-session startxfce4" +command=/bin/sh -c 'export DISPLAY=:1; for i in $(seq 1 200); do [ -S /tmp/.X11-unix/X1 ] && break; sleep 0.1; done; exec dbus-run-session startxfce4' autostart=true autorestart=true priority=20 @@ -45,20 +29,36 @@ stderr_logfile=/var/log/xfce4.err.log stdout_logfile=/var/log/xfce4.out.log environment=DISPLAY=":1" +[program:agentscope_runtime] +command=/bin/sh -c 'export DISPLAY=:1; for i in $(seq 1 200); do [ -S /tmp/.X11-unix/X1 ] && break; sleep 0.1; done; exec /agentscope_runtime/scripts/start.sh' +autostart=true +autorestart=true +priority=30 +stderr_logfile=/var/log/agentscope_runtime.err.log +stdout_logfile=/var/log/agentscope_runtime.out.log +environment=DISPLAY=":1" + [program:x11vnc] -command=/bin/sh -c "export DISPLAY=:1 && sleep 3 && x11vnc -display :1 -forever -shared -passwd $SECRET_TOKEN -rfbport 5901" +command=/bin/sh -c 'export DISPLAY=:1; for i in $(seq 1 200); do [ -S /tmp/.X11-unix/X1 ] && break; sleep 0.1; done; exec x11vnc -display :1 -forever -shared -passwd "%(ENV_SECRET_TOKEN)s" -rfbport 5901' autostart=true autorestart=true priority=30 stderr_logfile=/var/log/x11vnc.err.log stdout_logfile=/var/log/x11vnc.out.log -environment=DISPLAY=":1" +environment=DISPLAY=":1",SECRET_TOKEN="%(ENV_SECRET_TOKEN)s" [program:novnc] -command=/bin/bash -c "websockify --web=/usr/share/novnc/ 9000 localhost:5901" +command=/bin/bash -lc 'for i in {1..200}; do (echo > /dev/tcp/127.0.0.1/5901) >/dev/null 2>&1 && break; sleep 0.1; done; exec websockify --web=/usr/share/novnc/ 9000 localhost:5901' directory=/usr/share/novnc autostart=true autorestart=true priority=40 stderr_logfile=/var/log/novnc.err.log stdout_logfile=/var/log/novnc.out.log + +[program:nginx] +command=/usr/sbin/nginx -g "daemon off;" +autostart=true +autorestart=true +stderr_logfile=/var/log/nginx.err.log +stdout_logfile=/var/log/nginx.out.log diff --git a/src/agentscope_runtime/sandbox/box/gui/box/config/supervisord.conf b/src/agentscope_runtime/sandbox/box/gui/box/config/supervisord.conf index 3898f5b10..31f5fc07f 100644 --- a/src/agentscope_runtime/sandbox/box/gui/box/config/supervisord.conf +++ b/src/agentscope_runtime/sandbox/box/gui/box/config/supervisord.conf @@ -11,24 +11,8 @@ autorestart=true stderr_logfile=/var/log/dbus.err.log stdout_logfile=/var/log/dbus.out.log -[program:agentscope_runtime] -command=/agentscope_runtime/scripts/start.sh -autostart=true -autorestart=true -priority=30 -stderr_logfile=/var/log/agentscope_runtime.err.log -stdout_logfile=/var/log/agentscope_runtime.out.log -environment=DISPLAY=":1" - -[program:nginx] -command=/usr/sbin/nginx -g 'daemon off;' -autostart=true -autorestart=true -stderr_logfile=/var/log/nginx.err.log -stdout_logfile=/var/log/nginx.out.log - [program:xvfb] -command=/bin/sh -c "rm -f /tmp/.X1-lock /tmp/.X11-unix/X1; exec /usr/bin/Xvfb :1 -screen 0 1280x800x24" +command=/bin/sh -c "rm -f /tmp/.X1-lock /tmp/.X11-unix/X1; mkdir -p /tmp/.X11-unix; exec /usr/bin/Xvfb :1 -screen 0 1280x800x24" autostart=true autorestart=true priority=10 @@ -37,7 +21,7 @@ stdout_logfile=/var/log/xvfb.out.log environment=DISPLAY=":1" [program:xfce4] -command=/bin/sh -c "export DISPLAY=:1 && sleep 2 && export $(dbus-launch) && dbus-run-session startxfce4" +command=/bin/sh -c 'export DISPLAY=:1; for i in $(seq 1 200); do [ -S /tmp/.X11-unix/X1 ] && break; sleep 0.1; done; exec dbus-run-session startxfce4' autostart=true autorestart=true priority=20 @@ -45,20 +29,36 @@ stderr_logfile=/var/log/xfce4.err.log stdout_logfile=/var/log/xfce4.out.log environment=DISPLAY=":1" +[program:agentscope_runtime] +command=/bin/sh -c 'export DISPLAY=:1; for i in $(seq 1 200); do [ -S /tmp/.X11-unix/X1 ] && break; sleep 0.1; done; exec /agentscope_runtime/scripts/start.sh' +autostart=true +autorestart=true +priority=30 +stderr_logfile=/var/log/agentscope_runtime.err.log +stdout_logfile=/var/log/agentscope_runtime.out.log +environment=DISPLAY=":1" + [program:x11vnc] -command=/bin/sh -c "export DISPLAY=:1 && sleep 3 && x11vnc -display :1 -forever -shared -passwd $SECRET_TOKEN -rfbport 5901" +command=/bin/sh -c 'export DISPLAY=:1; for i in $(seq 1 200); do [ -S /tmp/.X11-unix/X1 ] && break; sleep 0.1; done; exec x11vnc -display :1 -forever -shared -passwd "%(ENV_SECRET_TOKEN)s" -rfbport 5901' autostart=true autorestart=true priority=30 stderr_logfile=/var/log/x11vnc.err.log stdout_logfile=/var/log/x11vnc.out.log -environment=DISPLAY=":1" +environment=DISPLAY=":1",SECRET_TOKEN="%(ENV_SECRET_TOKEN)s" [program:novnc] -command=/bin/bash -c "websockify --web=/usr/share/novnc/ 9000 localhost:5901" +command=/bin/bash -lc 'for i in {1..200}; do (echo > /dev/tcp/127.0.0.1/5901) >/dev/null 2>&1 && break; sleep 0.1; done; exec websockify --web=/usr/share/novnc/ 9000 localhost:5901' directory=/usr/share/novnc autostart=true autorestart=true priority=40 stderr_logfile=/var/log/novnc.err.log stdout_logfile=/var/log/novnc.out.log + +[program:nginx] +command=/usr/sbin/nginx -g "daemon off;" +autostart=true +autorestart=true +stderr_logfile=/var/log/nginx.err.log +stdout_logfile=/var/log/nginx.out.log From 9fe0ee293838dfb2af1c8f86debb8c66b459fa2e Mon Sep 17 00:00:00 2001 From: raykkk Date: Wed, 21 Jan 2026 19:25:23 +0800 Subject: [PATCH 3/8] update NGINX_TIMEOUT --- cookbook/en/sandbox/advanced.md | 2 +- cookbook/zh/sandbox/advanced.md | 2 +- examples/sandbox/custom_sandbox/Dockerfile | 2 +- .../sandbox/custom_sandbox/box/config/nginx.conf.template | 4 ++++ src/agentscope_runtime/sandbox/box/base/Dockerfile | 2 +- .../sandbox/box/base/box/config/nginx.conf.template | 4 ++++ src/agentscope_runtime/sandbox/box/browser/Dockerfile | 2 +- src/agentscope_runtime/sandbox/box/filesystem/Dockerfile | 2 +- src/agentscope_runtime/sandbox/box/gui/Dockerfile | 2 +- .../sandbox/box/gui/box/config/nginx.conf.template | 4 ++++ .../sandbox/box/mobile/box/config/nginx.conf | 4 ++++ src/agentscope_runtime/sandbox/manager/sandbox_manager.py | 1 + 12 files changed, 24 insertions(+), 7 deletions(-) diff --git a/cookbook/en/sandbox/advanced.md b/cookbook/en/sandbox/advanced.md index 4c459b28b..a967d260c 100644 --- a/cookbook/en/sandbox/advanced.md +++ b/cookbook/en/sandbox/advanced.md @@ -449,7 +449,7 @@ RUN pip cache purge \ && npm cache clean --force \ && rm -rf ~/.npm/_cacache -CMD ["/bin/sh", "-c", "envsubst '$SECRET_TOKEN' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] +CMD ["/bin/sh", "-c", "export SECRET_TOKEN=${SECRET_TOKEN:-secret_token_123} NGINX_TIMEOUT=${NGINX_TIMEOUT:-60}; envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] ``` ### Building Your Custom Image diff --git a/cookbook/zh/sandbox/advanced.md b/cookbook/zh/sandbox/advanced.md index e39029d31..197543872 100644 --- a/cookbook/zh/sandbox/advanced.md +++ b/cookbook/zh/sandbox/advanced.md @@ -447,7 +447,7 @@ RUN pip cache purge \ && npm cache clean --force \ && rm -rf ~/.npm/_cacache -CMD ["/bin/sh", "-c", "envsubst '$SECRET_TOKEN' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] +CMD ["/bin/sh", "-c", "export SECRET_TOKEN=${SECRET_TOKEN:-secret_token_123} NGINX_TIMEOUT=${NGINX_TIMEOUT:-60}; envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] ``` ### 构建您的自定义镜像 diff --git a/examples/sandbox/custom_sandbox/Dockerfile b/examples/sandbox/custom_sandbox/Dockerfile index 8cc3aa4ec..d79c21ac7 100644 --- a/examples/sandbox/custom_sandbox/Dockerfile +++ b/examples/sandbox/custom_sandbox/Dockerfile @@ -81,4 +81,4 @@ RUN pip cache purge \ && npm cache clean --force \ && rm -rf ~/.npm/_cacache -CMD ["/bin/sh", "-c", "envsubst '$SECRET_TOKEN' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] \ No newline at end of file +CMD ["/bin/sh", "-c", "export SECRET_TOKEN=${SECRET_TOKEN:-secret_token_123} NGINX_TIMEOUT=${NGINX_TIMEOUT:-60}; envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] \ No newline at end of file diff --git a/examples/sandbox/custom_sandbox/box/config/nginx.conf.template b/examples/sandbox/custom_sandbox/box/config/nginx.conf.template index 00d1110ae..2443bdc64 100644 --- a/examples/sandbox/custom_sandbox/box/config/nginx.conf.template +++ b/examples/sandbox/custom_sandbox/box/config/nginx.conf.template @@ -3,6 +3,10 @@ worker_processes 1; events { worker_connections 1024; } http { + proxy_connect_timeout ${NGINX_TIMEOUT}s; + proxy_send_timeout ${NGINX_TIMEOUT}s; + proxy_read_timeout ${NGINX_TIMEOUT}s; + include /etc/nginx/mime.types; default_type application/octet-stream; diff --git a/src/agentscope_runtime/sandbox/box/base/Dockerfile b/src/agentscope_runtime/sandbox/box/base/Dockerfile index 648c22c99..bae1122ad 100644 --- a/src/agentscope_runtime/sandbox/box/base/Dockerfile +++ b/src/agentscope_runtime/sandbox/box/base/Dockerfile @@ -47,4 +47,4 @@ RUN pip cache purge \ && npm cache clean --force \ && rm -rf ~/.npm/_cacache -CMD ["/bin/sh", "-c", "envsubst '$SECRET_TOKEN' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] +CMD ["/bin/sh", "-c", "export SECRET_TOKEN=${SECRET_TOKEN:-secret_token_123} NGINX_TIMEOUT=${NGINX_TIMEOUT:-60}; envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] diff --git a/src/agentscope_runtime/sandbox/box/base/box/config/nginx.conf.template b/src/agentscope_runtime/sandbox/box/base/box/config/nginx.conf.template index 0b22632ad..848ebe85c 100644 --- a/src/agentscope_runtime/sandbox/box/base/box/config/nginx.conf.template +++ b/src/agentscope_runtime/sandbox/box/base/box/config/nginx.conf.template @@ -9,6 +9,10 @@ http { location /fastapi { rewrite ^/fastapi(.*)$ $1 break; + proxy_connect_timeout ${NGINX_TIMEOUT}s; + proxy_send_timeout ${NGINX_TIMEOUT}s; + proxy_read_timeout ${NGINX_TIMEOUT}s; + proxy_pass http://localhost:8000; } } diff --git a/src/agentscope_runtime/sandbox/box/browser/Dockerfile b/src/agentscope_runtime/sandbox/box/browser/Dockerfile index 19bb535b0..076b33750 100644 --- a/src/agentscope_runtime/sandbox/box/browser/Dockerfile +++ b/src/agentscope_runtime/sandbox/box/browser/Dockerfile @@ -78,4 +78,4 @@ RUN pip cache purge \ && npm cache clean --force \ && rm -rf ~/.npm/_cacache -CMD ["/bin/sh", "-c", "envsubst '$SECRET_TOKEN' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] +CMD ["/bin/sh", "-c", "export SECRET_TOKEN=${SECRET_TOKEN:-secret_token_123} NGINX_TIMEOUT=${NGINX_TIMEOUT:-60}; envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] diff --git a/src/agentscope_runtime/sandbox/box/filesystem/Dockerfile b/src/agentscope_runtime/sandbox/box/filesystem/Dockerfile index 81e7e5e7f..1b4e97c7b 100644 --- a/src/agentscope_runtime/sandbox/box/filesystem/Dockerfile +++ b/src/agentscope_runtime/sandbox/box/filesystem/Dockerfile @@ -78,4 +78,4 @@ RUN pip cache purge \ && npm cache clean --force \ && rm -rf ~/.npm/_cacache -CMD ["/bin/sh", "-c", "envsubst '$SECRET_TOKEN' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] +CMD ["/bin/sh", "-c", "export SECRET_TOKEN=${SECRET_TOKEN:-secret_token_123} NGINX_TIMEOUT=${NGINX_TIMEOUT:-60}; envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] diff --git a/src/agentscope_runtime/sandbox/box/gui/Dockerfile b/src/agentscope_runtime/sandbox/box/gui/Dockerfile index fa72db94a..5fc3e7da5 100644 --- a/src/agentscope_runtime/sandbox/box/gui/Dockerfile +++ b/src/agentscope_runtime/sandbox/box/gui/Dockerfile @@ -77,4 +77,4 @@ RUN pip cache purge \ && npm cache clean --force \ && rm -rf ~/.npm/_cacache -CMD ["/bin/sh", "-c", "envsubst '$SECRET_TOKEN' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] +CMD ["/bin/sh", "-c", "export SECRET_TOKEN=${SECRET_TOKEN:-secret_token_123} NGINX_TIMEOUT=${NGINX_TIMEOUT:-60}; envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] diff --git a/src/agentscope_runtime/sandbox/box/gui/box/config/nginx.conf.template b/src/agentscope_runtime/sandbox/box/gui/box/config/nginx.conf.template index 00d1110ae..2443bdc64 100644 --- a/src/agentscope_runtime/sandbox/box/gui/box/config/nginx.conf.template +++ b/src/agentscope_runtime/sandbox/box/gui/box/config/nginx.conf.template @@ -3,6 +3,10 @@ worker_processes 1; events { worker_connections 1024; } http { + proxy_connect_timeout ${NGINX_TIMEOUT}s; + proxy_send_timeout ${NGINX_TIMEOUT}s; + proxy_read_timeout ${NGINX_TIMEOUT}s; + include /etc/nginx/mime.types; default_type application/octet-stream; diff --git a/src/agentscope_runtime/sandbox/box/mobile/box/config/nginx.conf b/src/agentscope_runtime/sandbox/box/mobile/box/config/nginx.conf index 3b7abbdf6..9010a2d86 100644 --- a/src/agentscope_runtime/sandbox/box/mobile/box/config/nginx.conf +++ b/src/agentscope_runtime/sandbox/box/mobile/box/config/nginx.conf @@ -12,6 +12,10 @@ events { } http { + proxy_connect_timeout ${NGINX_TIMEOUT}s; + proxy_send_timeout ${NGINX_TIMEOUT}s; + proxy_read_timeout ${NGINX_TIMEOUT}s; + include /etc/nginx/mime.types; default_type application/octet-stream; diff --git a/src/agentscope_runtime/sandbox/manager/sandbox_manager.py b/src/agentscope_runtime/sandbox/manager/sandbox_manager.py index a73c6c958..3dad5b967 100644 --- a/src/agentscope_runtime/sandbox/manager/sandbox_manager.py +++ b/src/agentscope_runtime/sandbox/manager/sandbox_manager.py @@ -850,6 +850,7 @@ def create( volumes=volume_bindings, environment={ "SECRET_TOKEN": runtime_token, + "NGINX_TIMEOUT": TIMEOUT, **environment, }, runtime_config=config.runtime_config, From d2ee6d3eb5824cf0b51fec9aaff23bef919b8da4 Mon Sep 17 00:00:00 2001 From: raykkk Date: Wed, 21 Jan 2026 20:33:51 +0800 Subject: [PATCH 4/8] minor fix --- .../box/config/supervisord.conf | 32 +++++++++---------- .../box/gui/box/config/supervisord.conf | 32 +++++++++---------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/examples/sandbox/custom_sandbox/box/config/supervisord.conf b/examples/sandbox/custom_sandbox/box/config/supervisord.conf index 31f5fc07f..a42fe6aeb 100644 --- a/examples/sandbox/custom_sandbox/box/config/supervisord.conf +++ b/examples/sandbox/custom_sandbox/box/config/supervisord.conf @@ -11,6 +11,22 @@ autorestart=true stderr_logfile=/var/log/dbus.err.log stdout_logfile=/var/log/dbus.out.log +[program:agentscope_runtime] +command=/agentscope_runtime/scripts/start.sh +autostart=true +autorestart=true +priority=30 +stderr_logfile=/var/log/agentscope_runtime.err.log +stdout_logfile=/var/log/agentscope_runtime.out.log +environment=DISPLAY=":1" + +[program:nginx] +command=/usr/sbin/nginx -g 'daemon off;' +autostart=true +autorestart=true +stderr_logfile=/var/log/nginx.err.log +stdout_logfile=/var/log/nginx.out.log + [program:xvfb] command=/bin/sh -c "rm -f /tmp/.X1-lock /tmp/.X11-unix/X1; mkdir -p /tmp/.X11-unix; exec /usr/bin/Xvfb :1 -screen 0 1280x800x24" autostart=true @@ -29,15 +45,6 @@ stderr_logfile=/var/log/xfce4.err.log stdout_logfile=/var/log/xfce4.out.log environment=DISPLAY=":1" -[program:agentscope_runtime] -command=/bin/sh -c 'export DISPLAY=:1; for i in $(seq 1 200); do [ -S /tmp/.X11-unix/X1 ] && break; sleep 0.1; done; exec /agentscope_runtime/scripts/start.sh' -autostart=true -autorestart=true -priority=30 -stderr_logfile=/var/log/agentscope_runtime.err.log -stdout_logfile=/var/log/agentscope_runtime.out.log -environment=DISPLAY=":1" - [program:x11vnc] command=/bin/sh -c 'export DISPLAY=:1; for i in $(seq 1 200); do [ -S /tmp/.X11-unix/X1 ] && break; sleep 0.1; done; exec x11vnc -display :1 -forever -shared -passwd "%(ENV_SECRET_TOKEN)s" -rfbport 5901' autostart=true @@ -55,10 +62,3 @@ autorestart=true priority=40 stderr_logfile=/var/log/novnc.err.log stdout_logfile=/var/log/novnc.out.log - -[program:nginx] -command=/usr/sbin/nginx -g "daemon off;" -autostart=true -autorestart=true -stderr_logfile=/var/log/nginx.err.log -stdout_logfile=/var/log/nginx.out.log diff --git a/src/agentscope_runtime/sandbox/box/gui/box/config/supervisord.conf b/src/agentscope_runtime/sandbox/box/gui/box/config/supervisord.conf index 31f5fc07f..a42fe6aeb 100644 --- a/src/agentscope_runtime/sandbox/box/gui/box/config/supervisord.conf +++ b/src/agentscope_runtime/sandbox/box/gui/box/config/supervisord.conf @@ -11,6 +11,22 @@ autorestart=true stderr_logfile=/var/log/dbus.err.log stdout_logfile=/var/log/dbus.out.log +[program:agentscope_runtime] +command=/agentscope_runtime/scripts/start.sh +autostart=true +autorestart=true +priority=30 +stderr_logfile=/var/log/agentscope_runtime.err.log +stdout_logfile=/var/log/agentscope_runtime.out.log +environment=DISPLAY=":1" + +[program:nginx] +command=/usr/sbin/nginx -g 'daemon off;' +autostart=true +autorestart=true +stderr_logfile=/var/log/nginx.err.log +stdout_logfile=/var/log/nginx.out.log + [program:xvfb] command=/bin/sh -c "rm -f /tmp/.X1-lock /tmp/.X11-unix/X1; mkdir -p /tmp/.X11-unix; exec /usr/bin/Xvfb :1 -screen 0 1280x800x24" autostart=true @@ -29,15 +45,6 @@ stderr_logfile=/var/log/xfce4.err.log stdout_logfile=/var/log/xfce4.out.log environment=DISPLAY=":1" -[program:agentscope_runtime] -command=/bin/sh -c 'export DISPLAY=:1; for i in $(seq 1 200); do [ -S /tmp/.X11-unix/X1 ] && break; sleep 0.1; done; exec /agentscope_runtime/scripts/start.sh' -autostart=true -autorestart=true -priority=30 -stderr_logfile=/var/log/agentscope_runtime.err.log -stdout_logfile=/var/log/agentscope_runtime.out.log -environment=DISPLAY=":1" - [program:x11vnc] command=/bin/sh -c 'export DISPLAY=:1; for i in $(seq 1 200); do [ -S /tmp/.X11-unix/X1 ] && break; sleep 0.1; done; exec x11vnc -display :1 -forever -shared -passwd "%(ENV_SECRET_TOKEN)s" -rfbport 5901' autostart=true @@ -55,10 +62,3 @@ autorestart=true priority=40 stderr_logfile=/var/log/novnc.err.log stdout_logfile=/var/log/novnc.out.log - -[program:nginx] -command=/usr/sbin/nginx -g "daemon off;" -autostart=true -autorestart=true -stderr_logfile=/var/log/nginx.err.log -stdout_logfile=/var/log/nginx.out.log From 520ec710abdd4427b23708ab2016181211bbadb1 Mon Sep 17 00:00:00 2001 From: raykkk Date: Thu, 22 Jan 2026 10:39:41 +0800 Subject: [PATCH 5/8] minor fix --- .../sandbox/box/base/box/config/nginx.conf.template | 8 ++++---- src/agentscope_runtime/sandbox/box/mobile/Dockerfile | 1 + .../mobile/box/config/{nginx.conf => nginx.conf.template} | 0 3 files changed, 5 insertions(+), 4 deletions(-) rename src/agentscope_runtime/sandbox/box/mobile/box/config/{nginx.conf => nginx.conf.template} (100%) diff --git a/src/agentscope_runtime/sandbox/box/base/box/config/nginx.conf.template b/src/agentscope_runtime/sandbox/box/base/box/config/nginx.conf.template index 848ebe85c..b022bcdf5 100644 --- a/src/agentscope_runtime/sandbox/box/base/box/config/nginx.conf.template +++ b/src/agentscope_runtime/sandbox/box/base/box/config/nginx.conf.template @@ -3,16 +3,16 @@ worker_processes 1; events { worker_connections 1024; } http { + proxy_connect_timeout ${NGINX_TIMEOUT}s; + proxy_send_timeout ${NGINX_TIMEOUT}s; + proxy_read_timeout ${NGINX_TIMEOUT}s; + server { listen 80; location /fastapi { rewrite ^/fastapi(.*)$ $1 break; - proxy_connect_timeout ${NGINX_TIMEOUT}s; - proxy_send_timeout ${NGINX_TIMEOUT}s; - proxy_read_timeout ${NGINX_TIMEOUT}s; - proxy_pass http://localhost:8000; } } diff --git a/src/agentscope_runtime/sandbox/box/mobile/Dockerfile b/src/agentscope_runtime/sandbox/box/mobile/Dockerfile index 083ffb04e..2cdf350b0 100644 --- a/src/agentscope_runtime/sandbox/box/mobile/Dockerfile +++ b/src/agentscope_runtime/sandbox/box/mobile/Dockerfile @@ -166,6 +166,7 @@ COPY src/agentscope_runtime/sandbox/box/mobile/box/config/nginx.conf /etc/nginx/ COPY src/agentscope_runtime/sandbox/box/mobile/box/mcp_server_configs.json /app/python_app/mcp_server_configs.json COPY src/agentscope_runtime/sandbox/box/mobile/box/scripts/start.sh /start.sh RUN chmod +x /start.sh +RUN ["/bin/sh", "-c", "export SECRET_TOKEN=\"${SECRET_TOKEN:-secret_token_123}\" NGINX_TIMEOUT=\"${NGINX_TIMEOUT:-60}\" && envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf"] # 6. Copy the offline redroid image from the fetcher stage COPY --from=redroid-fetcher /redroid.tar /redroid.tar diff --git a/src/agentscope_runtime/sandbox/box/mobile/box/config/nginx.conf b/src/agentscope_runtime/sandbox/box/mobile/box/config/nginx.conf.template similarity index 100% rename from src/agentscope_runtime/sandbox/box/mobile/box/config/nginx.conf rename to src/agentscope_runtime/sandbox/box/mobile/box/config/nginx.conf.template From e1005a204d9a161c59ece9b04b4190cea6b74cda Mon Sep 17 00:00:00 2001 From: raykkk Date: Thu, 22 Jan 2026 10:43:44 +0800 Subject: [PATCH 6/8] minor fix --- src/agentscope_runtime/sandbox/box/mobile/Dockerfile | 3 +-- .../sandbox/box/mobile/box/scripts/start.sh | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/agentscope_runtime/sandbox/box/mobile/Dockerfile b/src/agentscope_runtime/sandbox/box/mobile/Dockerfile index 2cdf350b0..6b3b3ada4 100644 --- a/src/agentscope_runtime/sandbox/box/mobile/Dockerfile +++ b/src/agentscope_runtime/sandbox/box/mobile/Dockerfile @@ -162,11 +162,10 @@ COPY --from=ws-scrcpy-builder /prod_bundle/ ./ # 5. Copy configuration and startup scripts WORKDIR / COPY src/agentscope_runtime/sandbox/box/mobile/box/config/supervisord.conf.template /etc/supervisor/supervisord.conf.template -COPY src/agentscope_runtime/sandbox/box/mobile/box/config/nginx.conf /etc/nginx/nginx.conf +COPY src/agentscope_runtime/sandbox/box/mobile/box/config/nginx.conf.template /etc/nginx/nginx.conf.template COPY src/agentscope_runtime/sandbox/box/mobile/box/mcp_server_configs.json /app/python_app/mcp_server_configs.json COPY src/agentscope_runtime/sandbox/box/mobile/box/scripts/start.sh /start.sh RUN chmod +x /start.sh -RUN ["/bin/sh", "-c", "export SECRET_TOKEN=\"${SECRET_TOKEN:-secret_token_123}\" NGINX_TIMEOUT=\"${NGINX_TIMEOUT:-60}\" && envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf"] # 6. Copy the offline redroid image from the fetcher stage COPY --from=redroid-fetcher /redroid.tar /redroid.tar diff --git a/src/agentscope_runtime/sandbox/box/mobile/box/scripts/start.sh b/src/agentscope_runtime/sandbox/box/mobile/box/scripts/start.sh index e13701d3e..f9a76a103 100644 --- a/src/agentscope_runtime/sandbox/box/mobile/box/scripts/start.sh +++ b/src/agentscope_runtime/sandbox/box/mobile/box/scripts/start.sh @@ -92,6 +92,11 @@ echo "--- Phase 3: Starting Application Services ---" mkdir -p /etc/supervisor/conf.d/ export SECRET_TOKEN="${SECRET_TOKEN:-secret_token123}" envsubst '${SECRET_TOKEN}' < /etc/supervisor/supervisord.conf.template > /etc/supervisor/conf.d/supervisord.conf +if [ -f /etc/nginx/nginx.conf.template ]; then + envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' \ + < /etc/nginx/nginx.conf.template \ + > /etc/nginx/nginx.conf +fi /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf sleep 5 From 2beba51e0225503fe17801c76a6507d6957e8d93 Mon Sep 17 00:00:00 2001 From: raykkk Date: Thu, 22 Jan 2026 11:31:09 +0800 Subject: [PATCH 7/8] minor fixc --- src/agentscope_runtime/sandbox/box/mobile/box/scripts/start.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/src/agentscope_runtime/sandbox/box/mobile/box/scripts/start.sh b/src/agentscope_runtime/sandbox/box/mobile/box/scripts/start.sh index f9a76a103..eaa66c57c 100644 --- a/src/agentscope_runtime/sandbox/box/mobile/box/scripts/start.sh +++ b/src/agentscope_runtime/sandbox/box/mobile/box/scripts/start.sh @@ -93,6 +93,7 @@ mkdir -p /etc/supervisor/conf.d/ export SECRET_TOKEN="${SECRET_TOKEN:-secret_token123}" envsubst '${SECRET_TOKEN}' < /etc/supervisor/supervisord.conf.template > /etc/supervisor/conf.d/supervisord.conf if [ -f /etc/nginx/nginx.conf.template ]; then + export NGINX_TIMEOUT=${NGINX_TIMEOUT:-60} envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' \ < /etc/nginx/nginx.conf.template \ > /etc/nginx/nginx.conf From 0986377e4e0737666f20f814bdccba3ad9a09f36 Mon Sep 17 00:00:00 2001 From: raykkk Date: Thu, 22 Jan 2026 11:46:12 +0800 Subject: [PATCH 8/8] minor fixc --- cookbook/en/sandbox/advanced.md | 2 +- cookbook/zh/sandbox/advanced.md | 2 +- examples/sandbox/custom_sandbox/Dockerfile | 2 +- src/agentscope_runtime/sandbox/box/base/Dockerfile | 2 +- src/agentscope_runtime/sandbox/box/browser/Dockerfile | 2 +- src/agentscope_runtime/sandbox/box/filesystem/Dockerfile | 2 +- src/agentscope_runtime/sandbox/box/gui/Dockerfile | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cookbook/en/sandbox/advanced.md b/cookbook/en/sandbox/advanced.md index a967d260c..a5482161e 100644 --- a/cookbook/en/sandbox/advanced.md +++ b/cookbook/en/sandbox/advanced.md @@ -449,7 +449,7 @@ RUN pip cache purge \ && npm cache clean --force \ && rm -rf ~/.npm/_cacache -CMD ["/bin/sh", "-c", "export SECRET_TOKEN=${SECRET_TOKEN:-secret_token_123} NGINX_TIMEOUT=${NGINX_TIMEOUT:-60}; envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] +CMD ["/bin/sh", "-c", "export SECRET_TOKEN=${SECRET_TOKEN:-secret_token123} NGINX_TIMEOUT=${NGINX_TIMEOUT:-60}; envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] ``` ### Building Your Custom Image diff --git a/cookbook/zh/sandbox/advanced.md b/cookbook/zh/sandbox/advanced.md index 197543872..d09dfc7d9 100644 --- a/cookbook/zh/sandbox/advanced.md +++ b/cookbook/zh/sandbox/advanced.md @@ -447,7 +447,7 @@ RUN pip cache purge \ && npm cache clean --force \ && rm -rf ~/.npm/_cacache -CMD ["/bin/sh", "-c", "export SECRET_TOKEN=${SECRET_TOKEN:-secret_token_123} NGINX_TIMEOUT=${NGINX_TIMEOUT:-60}; envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] +CMD ["/bin/sh", "-c", "export SECRET_TOKEN=${SECRET_TOKEN:-secret_token123} NGINX_TIMEOUT=${NGINX_TIMEOUT:-60}; envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] ``` ### 构建您的自定义镜像 diff --git a/examples/sandbox/custom_sandbox/Dockerfile b/examples/sandbox/custom_sandbox/Dockerfile index d79c21ac7..e46d23fa2 100644 --- a/examples/sandbox/custom_sandbox/Dockerfile +++ b/examples/sandbox/custom_sandbox/Dockerfile @@ -81,4 +81,4 @@ RUN pip cache purge \ && npm cache clean --force \ && rm -rf ~/.npm/_cacache -CMD ["/bin/sh", "-c", "export SECRET_TOKEN=${SECRET_TOKEN:-secret_token_123} NGINX_TIMEOUT=${NGINX_TIMEOUT:-60}; envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] \ No newline at end of file +CMD ["/bin/sh", "-c", "export SECRET_TOKEN=${SECRET_TOKEN:-secret_token123} NGINX_TIMEOUT=${NGINX_TIMEOUT:-60}; envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] \ No newline at end of file diff --git a/src/agentscope_runtime/sandbox/box/base/Dockerfile b/src/agentscope_runtime/sandbox/box/base/Dockerfile index bae1122ad..557ee2232 100644 --- a/src/agentscope_runtime/sandbox/box/base/Dockerfile +++ b/src/agentscope_runtime/sandbox/box/base/Dockerfile @@ -47,4 +47,4 @@ RUN pip cache purge \ && npm cache clean --force \ && rm -rf ~/.npm/_cacache -CMD ["/bin/sh", "-c", "export SECRET_TOKEN=${SECRET_TOKEN:-secret_token_123} NGINX_TIMEOUT=${NGINX_TIMEOUT:-60}; envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] +CMD ["/bin/sh", "-c", "export SECRET_TOKEN=${SECRET_TOKEN:-secret_token123} NGINX_TIMEOUT=${NGINX_TIMEOUT:-60}; envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] diff --git a/src/agentscope_runtime/sandbox/box/browser/Dockerfile b/src/agentscope_runtime/sandbox/box/browser/Dockerfile index 076b33750..174c69d8b 100644 --- a/src/agentscope_runtime/sandbox/box/browser/Dockerfile +++ b/src/agentscope_runtime/sandbox/box/browser/Dockerfile @@ -78,4 +78,4 @@ RUN pip cache purge \ && npm cache clean --force \ && rm -rf ~/.npm/_cacache -CMD ["/bin/sh", "-c", "export SECRET_TOKEN=${SECRET_TOKEN:-secret_token_123} NGINX_TIMEOUT=${NGINX_TIMEOUT:-60}; envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] +CMD ["/bin/sh", "-c", "export SECRET_TOKEN=${SECRET_TOKEN:-secret_token123} NGINX_TIMEOUT=${NGINX_TIMEOUT:-60}; envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] diff --git a/src/agentscope_runtime/sandbox/box/filesystem/Dockerfile b/src/agentscope_runtime/sandbox/box/filesystem/Dockerfile index 1b4e97c7b..57a205327 100644 --- a/src/agentscope_runtime/sandbox/box/filesystem/Dockerfile +++ b/src/agentscope_runtime/sandbox/box/filesystem/Dockerfile @@ -78,4 +78,4 @@ RUN pip cache purge \ && npm cache clean --force \ && rm -rf ~/.npm/_cacache -CMD ["/bin/sh", "-c", "export SECRET_TOKEN=${SECRET_TOKEN:-secret_token_123} NGINX_TIMEOUT=${NGINX_TIMEOUT:-60}; envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] +CMD ["/bin/sh", "-c", "export SECRET_TOKEN=${SECRET_TOKEN:-secret_token123} NGINX_TIMEOUT=${NGINX_TIMEOUT:-60}; envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] diff --git a/src/agentscope_runtime/sandbox/box/gui/Dockerfile b/src/agentscope_runtime/sandbox/box/gui/Dockerfile index 5fc3e7da5..26bf84db7 100644 --- a/src/agentscope_runtime/sandbox/box/gui/Dockerfile +++ b/src/agentscope_runtime/sandbox/box/gui/Dockerfile @@ -77,4 +77,4 @@ RUN pip cache purge \ && npm cache clean --force \ && rm -rf ~/.npm/_cacache -CMD ["/bin/sh", "-c", "export SECRET_TOKEN=${SECRET_TOKEN:-secret_token_123} NGINX_TIMEOUT=${NGINX_TIMEOUT:-60}; envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] +CMD ["/bin/sh", "-c", "export SECRET_TOKEN=${SECRET_TOKEN:-secret_token123} NGINX_TIMEOUT=${NGINX_TIMEOUT:-60}; envsubst '$SECRET_TOKEN $NGINX_TIMEOUT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"]