| #!/bin/bash |
| set -e |
|
|
| |
| echo "🐍 Starting AgentScope backend on :8000..." |
| cd /app/backend |
| uvicorn main:app --host 0.0.0.0 --port 8000 & |
| BACKEND_PID=$! |
|
|
| |
| sleep 3 |
|
|
| |
| echo "🔀 Starting nginx on :7860..." |
|
|
| mkdir -p /tmp/nginx_client_body /tmp/nginx_proxy /tmp/nginx_fastcgi \ |
| /tmp/nginx_uwsgi /tmp/nginx_scgi |
|
|
| cat > /tmp/nginx.conf << 'NGINXEOF' |
| worker_processes 1; |
| pid /tmp/nginx.pid; |
|
|
| events { |
| worker_connections 1024; |
| } |
|
|
| http { |
| include /etc/nginx/mime.types; |
| default_type application/octet-stream; |
|
|
| client_body_temp_path /tmp/nginx_client_body; |
| proxy_temp_path /tmp/nginx_proxy; |
| fastcgi_temp_path /tmp/nginx_fastcgi; |
| uwsgi_temp_path /tmp/nginx_uwsgi; |
| scgi_temp_path /tmp/nginx_scgi; |
|
|
| server { |
| listen 7860; |
|
|
| |
| root /app/frontend; |
| index index.html; |
|
|
| |
| proxy_buffering off; |
|
|
| |
| location / { |
| try_files $uri $uri/ /index.html; |
| } |
|
|
| |
| location /api/ { |
| proxy_pass http://localhost:8000/; |
| proxy_set_header Host $host; |
| proxy_set_header X-Real-IP $remote_addr; |
| proxy_read_timeout 300s; |
| } |
| } |
| } |
| NGINXEOF |
|
|
| nginx -c /tmp/nginx.conf & |
| NGINX_PID=$! |
|
|
| echo "✅ All services running:" |
| echo " Frontend → :7860 (custom UI)" |
| echo " Backend → :8000/api/" |
|
|
| wait $BACKEND_PID $NGINX_PID |
|
|