Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cookbook/en/sandbox/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Comment thread
rayrayraykk marked this conversation as resolved.
Outdated
```

### Building Your Custom Image
Expand Down
2 changes: 1 addition & 1 deletion cookbook/zh/sandbox/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Comment thread
rayrayraykk marked this conversation as resolved.
Outdated
```

### 构建您的自定义镜像
Expand Down
2 changes: 1 addition & 1 deletion examples/sandbox/custom_sandbox/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
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"]
Comment thread
rayrayraykk marked this conversation as resolved.
Outdated
Comment thread
rayrayraykk marked this conversation as resolved.
Outdated
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
12 changes: 6 additions & 6 deletions examples/sandbox/custom_sandbox/box/config/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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; mkdir -p /tmp/.X11-unix; exec /usr/bin/Xvfb :1 -screen 0 1280x800x24"
autostart=true
autorestart=true
priority=10
Expand All @@ -37,7 +37,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
Expand All @@ -46,16 +46,16 @@ stdout_logfile=/var/log/xfce4.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'
Comment thread
rayrayraykk marked this conversation as resolved.
Comment thread
rayrayraykk marked this conversation as resolved.
directory=/usr/share/novnc
autostart=true
autorestart=true
Expand Down
2 changes: 1 addition & 1 deletion src/agentscope_runtime/sandbox/box/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Comment thread
rayrayraykk marked this conversation as resolved.
Outdated
Comment thread
rayrayraykk marked this conversation as resolved.
Outdated
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Comment thread
rayrayraykk marked this conversation as resolved.
Outdated

proxy_pass http://localhost:8000;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/agentscope_runtime/sandbox/box/browser/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Comment thread
rayrayraykk marked this conversation as resolved.
Outdated
Comment thread
rayrayraykk marked this conversation as resolved.
Outdated
2 changes: 1 addition & 1 deletion src/agentscope_runtime/sandbox/box/filesystem/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Comment thread
rayrayraykk marked this conversation as resolved.
Outdated
Comment thread
rayrayraykk marked this conversation as resolved.
Outdated
2 changes: 1 addition & 1 deletion src/agentscope_runtime/sandbox/box/gui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Comment thread
rayrayraykk marked this conversation as resolved.
Outdated
Comment thread
rayrayraykk marked this conversation as resolved.
Outdated
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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; mkdir -p /tmp/.X11-unix; exec /usr/bin/Xvfb :1 -screen 0 1280x800x24"
autostart=true
autorestart=true
priority=10
Expand All @@ -37,7 +37,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
Expand All @@ -46,16 +46,16 @@ stdout_logfile=/var/log/xfce4.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'
Comment thread
rayrayraykk marked this conversation as resolved.
Comment thread
rayrayraykk marked this conversation as resolved.
directory=/usr/share/novnc
autostart=true
autorestart=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions src/agentscope_runtime/sandbox/manager/sandbox_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,7 @@ def create(
volumes=volume_bindings,
environment={
"SECRET_TOKEN": runtime_token,
"NGINX_TIMEOUT": TIMEOUT,
**environment,
},
runtime_config=config.runtime_config,
Expand Down
Loading