Spaces:
Sleeping
Sleeping
File size: 1,824 Bytes
52f4d1c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
#!/usr/bin/env bash
PORT="${PORT:-9099}"
HOST="${HOST:-0.0.0.0}"
# Default value for PIPELINES_DIR
PIPELINES_DIR=${PIPELINES_DIR:-./aworldspace/agents}
UVICORN_LOOP="${UVICORN_LOOP:-auto}"
# OSS mount configuration - read from environment variables
if [ -n "$OSS_BUCKET" ] && [ -n "$OSS_AK_ID" ] && [ -n "$OSS_AK_SECRET" ]; then
echo "Configuring OSS mount..."
# Create OSS credentials file
echo "${OSS_BUCKET}:${OSS_AK_ID}:${OSS_AK_SECRET}" >> /etc/passwd-ossfs
chmod 640 /etc/passwd-ossfs
# Create mount point directories if they don't exist
mkdir -p /app/logs
mkdir -p /app/trace_data
mkdir -p /app/aworldspace/datasets
# Mount OSS directories
echo "Mounting OSS directories..."
if [ -n "$OSS_REGION_URL" ] && [ -n "$OSS_BUCKET_URL" ]; then
# Use custom region and URL
ossfs ${OSS_BUCKET}:/aworld/logs /app/logs -odirect_read -ononempty -oregion=${OSS_REGION_URL} -ourl=${OSS_BUCKET_URL} &
ossfs ${OSS_BUCKET}:/aworld/trace_data /app/trace_data -odirect_read -ononempty -oregion=${OSS_REGION_URL} -ourl=${OSS_BUCKET_URL} &
ossfs ${OSS_BUCKET}:/aworld/datasets /app/aworldspace/datasets -odirect_read -ononempty -oregion=${OSS_REGION_URL} -ourl=${OSS_BUCKET_URL} &
else
# Use default configuration
ossfs ${OSS_BUCKET}:/aworld/logs /app/logs -odirect_read -ononempty &
ossfs ${OSS_BUCKET}:/aworld/trace_data /app/trace_data -odirect_read -ononempty &
ossfs ${OSS_BUCKET}:/aworld/datasets /app/aworldspace/datasets -odirect_read -ononempty &
fi
# Wait for mount to complete
sleep 2
echo "OSS mount configuration completed"
else
echo "OSS configuration incomplete, skipping OSS mount"
fi
uvicorn main:app --host "$HOST" --port "$PORT" --forwarded-allow-ips '*' --loop "$UVICORN_LOOP"
|