Spaces:
Runtime error
Runtime error
| set -e | |
| echo "Starting Redis server..." | |
| redis-server --daemonize yes --port 6379 --save "" || redis-server --port 6379 --save "" & | |
| echo "Starting Prometheus..." | |
| mkdir -p /tmp/prometheus_data | |
| /app/prometheus/prometheus \ | |
| --config.file=/app/prometheus.yml \ | |
| --web.external-url=/prometheus/ \ | |
| --web.listen-address=127.0.0.1:9090 \ | |
| --storage.tsdb.path=/tmp/prometheus_data \ | |
| > /tmp/prometheus.log 2>&1 & | |
| echo "Starting Grafana..." | |
| mkdir -p /tmp/grafana_data /tmp/grafana_logs /tmp/grafana_plugins | |
| # Start grafana-server with overrides | |
| GF_SECURITY_ADMIN_PASSWORD=admin \ | |
| GF_USERS_ALLOW_SIGN_UP=false \ | |
| GF_SERVER_ROOT_URL='%(protocol)s://%(domain)s:%(http_port)s/grafana/' \ | |
| GF_SERVER_SERVE_FROM_SUB_PATH=true \ | |
| GF_SECURITY_ALLOW_EMBEDDING=true \ | |
| GF_PATHS_DATA=/tmp/grafana_data \ | |
| GF_PATHS_LOGS=/tmp/grafana_logs \ | |
| GF_PATHS_PLUGINS=/tmp/grafana_plugins \ | |
| GF_PATHS_PROVISIONING=/etc/grafana/provisioning \ | |
| grafana-server \ | |
| --homepath /usr/share/grafana \ | |
| --config /etc/grafana/grafana.ini \ | |
| > /tmp/grafana.log 2>&1 & | |
| echo "Starting FastAPI Services..." | |
| cd /app/services | |
| PORT=8001 SERVICE_NAME=service-a DOWNSTREAM_URL=http://127.0.0.1:8002 REDIS_URL=redis://127.0.0.1:6379/0 python -m uvicorn service:app --host 127.0.0.1 --port 8001 > /tmp/service-a.log 2>&1 & | |
| PORT=8002 SERVICE_NAME=service-b DOWNSTREAM_URL=http://127.0.0.1:8003 REDIS_URL=redis://127.0.0.1:6379/0 python -m uvicorn service:app --host 127.0.0.1 --port 8002 > /tmp/service-b.log 2>&1 & | |
| PORT=8003 SERVICE_NAME=service-c DOWNSTREAM_URL= REDIS_URL=redis://127.0.0.1:6379/0 python -m uvicorn service:app --host 127.0.0.1 --port 8003 > /tmp/service-c.log 2>&1 & | |
| echo "Starting Control Plane..." | |
| cd /app/control_plane | |
| PORT=8000 DATABASE_URL=sqlite+aiosqlite:///tmp/pulseguard.db REDIS_URL=redis://127.0.0.1:6379/0 python -m uvicorn main:app --host 127.0.0.1 --port 8000 > /tmp/control-plane.log 2>&1 & | |
| echo "Starting Load Generator..." | |
| cd /app/load_generator | |
| TARGET_URL=http://127.0.0.1:8001/request REDIS_URL=redis://127.0.0.1:6379/0 python generator.py > /tmp/load-generator.log 2>&1 & | |
| echo "Starting Nginx in foreground..." | |
| nginx -g "daemon off;" | |