Files
pos-system/scripts/dev/start-all.sh
Ho Ngoc Hai 5ff8035013 Remove local development README and enhance scripts for cross-platform compatibility
- Deleted `README.md` for local development setup as it was deemed unnecessary.
- Updated `setup-neon.sh`, `start-all.sh`, and `create-service.sh` scripts to source an OS helper for improved cross-platform command execution.
- Modified commands in `init-project.sh` to reflect the new script structure for starting services.
2025-12-27 10:26:04 +07:00

56 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# EN: Script to start all services in development environment
# VI: Script để khởi động tất cả services trong môi trường development
set -e
# Source OS helper for cross-platform commands
source "$(dirname "$0")/../utils/os-helper.sh"
echo "🚀 Starting all services... / Khởi động tất cả services..."
# EN: Verify Docker daemon is running
# VI: Xác minh Docker daemon đang chạy
if ! docker info &> /dev/null; then
echo "❌ Docker is not running. Please start Docker first. / Docker không chạy. Vui lòng khởi động Docker trước."
exit 1
fi
# EN: Load environment variables from shared config
# VI: Load biến môi trường từ shared config
if [ -f "deployments/local/.env.local" ]; then
export $(grep -v '^#' deployments/local/.env.local | xargs)
fi
# EN: Check if DATABASE_URL is configured (required for services)
# VI: Kiểm tra DATABASE_URL có được cấu hình không (bắt buộc cho services)
if [ -z "$DATABASE_URL" ]; then
echo "⚠️ WARNING: DATABASE_URL not set! / CẢNH BÁO: DATABASE_URL chưa được thiết lập!"
echo " Please setup Neon database: ./scripts/db/setup-neon.sh"
echo " Or set DATABASE_URL in deployments/local/.env.local"
echo " / Vui lòng thiết lập Neon database: ./scripts/db/setup-neon.sh"
echo " Hoặc đặt DATABASE_URL trong deployments/local/.env.local"
echo ""
read -p "Continue anyway? (y/n): / Tiếp tục? (y/n): " continue
if [ "$continue" != "y" ]; then
exit 1
fi
fi
# EN: Start infrastructure services (Redis for caching, Traefik for routing)
# VI: Khởi động infrastructure services (Redis cho caching, Traefik cho routing)
echo "📦 Starting infrastructure (Redis, Traefik)... / Khởi động infrastructure (Redis, Traefik)..."
cd deployments/local
run_compose up -d
cd ../..
# EN: Give Redis time to fully start before starting services
# VI: Cho Redis thời gian để khởi động đầy đủ trước khi khởi động services
echo "⏳ Waiting for Redis to be ready... / Đang chờ Redis sẵn sàng..."
sleep 3
# EN: Start all microservices using pnpm dev
# VI: Khởi động tất cả microservices sử dụng pnpm dev
echo "🚀 Starting services... / Khởi động services..."
pnpm dev