wip: baseline changes before channel-conversation-task boundary implementation

This commit is contained in:
2026-07-08 16:23:09 +08:00
parent 89c9e6a066
commit 1298a558e8
139 changed files with 11781 additions and 666 deletions

View File

@@ -1,9 +1,48 @@
#!/bin/bash
set -e
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR/.."
# Load local environment overrides when present.
[ -f .env ] && source .env
# Defaults (kept in sync with docker-compose.yml defaults).
MYSQL_PORT=${MYSQL_PORT:-3306}
REDIS_PORT=${REDIS_PORT:-6379}
RABBITMQ_AMQP_PORT=${RABBITMQ_AMQP_PORT:-5672}
RABBITMQ_MGMT_PORT=${RABBITMQ_MGMT_PORT:-15672}
SEAWEEDFS_MASTER_PORT=${SEAWEEDFS_MASTER_PORT:-9333}
MCI_SERVER_PORT=${MCI_SERVER_PORT:-8080}
ADMIN_WEB_PORT=${ADMIN_WEB_PORT:-80}
CHANNEL_SERVICE_PORT=${CHANNEL_SERVICE_PORT:-8000}
WITH_APPS=""
BUILD_FLAG=""
usage() {
cat <<EOF
Usage: $0 [OPTIONS]
Start local Docker infrastructure (and optionally application services).
Options:
--with-apps Also start mci-server, admin-web and channel-service
--build Force (re)build images before starting services
-h, --help Show this help message and exit
EOF
}
while [ $# -gt 0 ]; do
case "$1" in
--with-apps) WITH_APPS=1 ;;
--build) BUILD_FLAG="--build" ;;
-h|--help) usage; exit 0 ;;
*) echo "Unknown option: $1" >&2; usage; exit 1 ;;
esac
shift
done
wait_for_healthy() {
local service=$1
local max_retries=${2:-60}
@@ -12,7 +51,7 @@ wait_for_healthy() {
echo "Waiting for $service to become healthy..."
while [ "$retry_count" -lt "$max_retries" ]; do
container_name=$(docker compose --profile infra --profile app ps -q "$service" 2>/dev/null | head -n1)
container_name=$(docker compose --profile infra --profile app ps -q "$service" 2>/dev/null | head -n1 || true)
if [ -n "$container_name" ]; then
local status
@@ -33,28 +72,28 @@ wait_for_healthy() {
}
echo "Starting infrastructure services..."
docker compose --profile infra up -d
docker compose --profile infra up -d $BUILD_FLAG
wait_for_healthy mysql 60
wait_for_healthy redis 30
wait_for_healthy rabbitmq 60
echo "Infrastructure is ready."
echo "MySQL: jdbc:mysql://localhost:3306/sino_mci"
echo "Redis: localhost:6379"
echo "RabbitMQ: localhost:5672 / http://localhost:15672"
echo "SeaweedFS: http://localhost:9333"
echo "MySQL: jdbc:mysql://localhost:${MYSQL_PORT}/${MYSQL_DATABASE:-sino_mci}"
echo "Redis: localhost:${REDIS_PORT}"
echo "RabbitMQ: localhost:${RABBITMQ_AMQP_PORT} / http://localhost:${RABBITMQ_MGMT_PORT}"
echo "SeaweedFS: http://localhost:${SEAWEEDFS_MASTER_PORT}"
if [ "$1" == "--with-apps" ]; then
if [ -n "$WITH_APPS" ]; then
echo "Starting application services..."
# Include infra profile so that depends_on conditions can resolve.
docker compose --profile infra --profile app up -d --build
docker compose --profile infra --profile app up -d $BUILD_FLAG
wait_for_healthy mci-server 90
wait_for_healthy channel-service 60
echo "Application services are ready."
echo "Admin Web: http://localhost"
echo "Backend API: http://localhost:8080/msg-platform"
echo "Channel Service: http://localhost:8000"
echo "Admin Web: http://localhost:${ADMIN_WEB_PORT}"
echo "Backend API: http://localhost:${MCI_SERVER_PORT}/msg-platform"
echo "Channel Service: http://localhost:${CHANNEL_SERVICE_PORT}"
fi