gMAS / web_ui /docker-entrypoint.sh
Артём Боярских
chore: initial commit
3193174
#!/bin/bash
set -e
# Create data directories
mkdir -p "$GMAS_DATA_DIR/agents" "$GMAS_DATA_DIR/graphs" "$GMAS_DATA_DIR/runs"
# Create nginx temp directories
mkdir -p /tmp/nginx/body /tmp/nginx/proxy /tmp/nginx/fastcgi /tmp/nginx/uwsgi /tmp/nginx/scgi
# Start uvicorn in the background
uvicorn backend.main:app \
--host 127.0.0.1 \
--port 8000 \
--workers "${GMAS_WORKERS:-1}" &
UVICORN_PID=$!
# Start nginx in the foreground (use full config, not sites-enabled)
nginx -c /etc/nginx/sites-available/default -g "daemon off;" &
NGINX_PID=$!
# Forward signals to both processes
trap 'kill $UVICORN_PID $NGINX_PID 2>/dev/null; wait' TERM INT
# Wait for either process to exit; if one dies, stop the other
wait -n $UVICORN_PID $NGINX_PID
kill $UVICORN_PID $NGINX_PID 2>/dev/null || true
wait