47 lines
1004 B
Bash
Executable File
47 lines
1004 B
Bash
Executable File
#!/bin/bash
|
|
# Helper script to run initialization tasks in production
|
|
# Usage: ./init-production.sh [mode]
|
|
# Modes: infra, demo-school, demo-users, gais-data, full
|
|
|
|
set -e
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m' # No Color
|
|
|
|
print_status() {
|
|
echo -e "${BLUE}[INFO]${NC} $1"
|
|
}
|
|
|
|
print_success() {
|
|
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
|
}
|
|
|
|
print_error() {
|
|
echo -e "${RED}[ERROR]${NC} $1"
|
|
}
|
|
|
|
MODE=${1:-infra}
|
|
|
|
print_status "Running production initialization: $MODE"
|
|
|
|
# Check if running in Docker
|
|
if [ -f /.dockerenv ] || [ -n "$DOCKER_CONTAINER" ]; then
|
|
print_status "Running inside Docker container"
|
|
python3 main.py --mode "$MODE"
|
|
else
|
|
print_status "Running on host - using Docker Compose"
|
|
|
|
# Run init using docker compose
|
|
docker compose run --rm \
|
|
-e RUN_INIT=true \
|
|
-e INIT_MODE="$MODE" \
|
|
backend python3 main.py --mode "$MODE"
|
|
fi
|
|
|
|
print_success "Initialization completed: $MODE"
|
|
|