Files
wehub-resource-sync 161ef94b4f
Check engine pin consistency / Dockerfile / CI pin consistency (push) Successful in 8s
Sirius CI/CD Pipeline / Detect Changes (push) Successful in 23s
Validate Docker Configuration / Validate Docker Compose Configuration (push) Successful in 47s
Sirius CI/CD Pipeline / Build API (${{ matrix.platform }}) (push) Has been cancelled
Sirius CI/CD Pipeline / Build UI (${{ matrix.platform }}) (push) Has been cancelled
Sirius CI/CD Pipeline / Merge Engine Manifest (push) Has been cancelled
Sirius CI/CD Pipeline / Merge API Manifest (push) Has been cancelled
Sirius CI/CD Pipeline / Merge UI Manifest (push) Has been cancelled
Sirius CI/CD Pipeline / Build Engine (${{ matrix.platform }}) (push) Has been cancelled
Sirius CI/CD Pipeline / Build Infra (${{ matrix.service }}, ${{ matrix.platform }}) (push) Has been cancelled
Sirius CI/CD Pipeline / Merge Infra Manifest (sirius-postgres) (push) Has been cancelled
Sirius CI/CD Pipeline / Merge Infra Manifest (sirius-rabbitmq) (push) Has been cancelled
Sirius CI/CD Pipeline / Merge Infra Manifest (sirius-valkey) (push) Has been cancelled
Sirius CI/CD Pipeline / Integration Test (push) Has been cancelled
Sirius CI/CD Pipeline / Public Stack Contract (push) Has been cancelled
Sirius CI/CD Pipeline / Dispatch Demo Deployment (sirius-demo branch) (push) Has been cancelled
Sirius CI/CD Pipeline / Dispatch Demo Canary (main branch) (push) Has been cancelled
Sirius CI/CD Pipeline / Guard Registry Namespace (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:32:25 +08:00

95 lines
3.1 KiB
Bash

#!/bin/sh
echo "🚀 Starting Sirius UI Development Server..."
# Same default as start-prod — keeps dev parity when SIRIUS_API_KEY_FILE is empty in env.
: "${SIRIUS_API_KEY_FILE:=/run/secrets/sirius_api_key}"
export SIRIUS_API_KEY_FILE
require_env() {
VAR_NAME="$1"
eval "VAR_VALUE=\${$VAR_NAME}"
if [ -z "$VAR_VALUE" ]; then
echo "❌ Missing required environment variable: $VAR_NAME"
exit 1
fi
}
require_readable_file() {
VAR_NAME="$1"
eval "FILE_PATH=\${$VAR_NAME}"
if [ -z "$FILE_PATH" ]; then
echo "❌ $VAR_NAME is not set. Run: docker compose -f docker-compose.installer.yaml run --rm sirius-installer"
exit 1
fi
if [ ! -r "$FILE_PATH" ]; then
echo "❌ Internal API key is not readable at: $FILE_PATH (check ./secrets/sirius_api_key.txt and compose secrets:)"
exit 1
fi
}
require_env "NEXTAUTH_SECRET"
require_env "INITIAL_ADMIN_PASSWORD"
require_readable_file "SIRIUS_API_KEY_FILE"
SIRIUS_API_KEY="$(tr -d '\r\n' < "$SIRIUS_API_KEY_FILE")"
if [ -z "$SIRIUS_API_KEY" ]; then
echo "❌ Internal API key file is empty: $SIRIUS_API_KEY_FILE"
exit 1
fi
export SIRIUS_API_KEY
# Keep container node_modules in sync with package manifests.
# Dev uses a persistent named volume for /app/node_modules, which can drift when deps change.
if [ -f "/app/package.json" ] && [ -f "/app/package-lock.json" ]; then
CURRENT_DEPS_HASH=$(cat /app/package.json /app/package-lock.json | sha256sum | awk '{print $1}')
STORED_DEPS_HASH=""
if [ -f "/app/node_modules/.deps-hash" ]; then
STORED_DEPS_HASH=$(cat /app/node_modules/.deps-hash)
fi
if [ "$CURRENT_DEPS_HASH" != "$STORED_DEPS_HASH" ]; then
echo "📦 Dependency manifest changed; running npm install..."
npm install || exit 1
mkdir -p /app/node_modules
echo "$CURRENT_DEPS_HASH" > /app/node_modules/.deps-hash
else
echo "✅ Dependencies are up to date"
fi
fi
# Start System Monitor if available
if [ -d "/system-monitor" ] && [ -f "/system-monitor/main.go" ]; then
echo "📊 Starting System Monitor..."
cd /system-monitor
CONTAINER_NAME=sirius-ui go run main.go >> /tmp/system-monitor.log 2>&1 &
SYSTEM_MONITOR_PID=$!
echo "✅ System Monitor started with PID: $SYSTEM_MONITOR_PID"
cd /app
else
echo "⚠️ System Monitor not found, skipping..."
fi
# Start App Administrator if available
if [ -d "/app-administrator" ] && [ -f "/app-administrator/main.go" ]; then
echo "🔧 Starting App Administrator..."
cd /app-administrator
CONTAINER_NAME=sirius-ui go run main.go >> /tmp/administrator.log 2>&1 &
ADMINISTRATOR_PID=$!
echo "✅ App Administrator started with PID: $ADMINISTRATOR_PID"
cd /app
else
echo "⚠️ App Administrator not found, skipping..."
fi
echo "🔍 Checking database connection..."
# Apply any pending migrations
echo "📁 Applying database migrations..."
(cd /app && npx prisma migrate deploy)
echo "🌱 Running database seed..."
(cd /app && npx prisma db seed) || echo "⚠️ Seed failed or already applied."
echo "🎯 Starting Next.js development server..."
exec npm run dev