edit logical architecture
This commit is contained in:
parent
92b4a6c824
commit
17a5fdb0c4
107
claude/check-mermaid.sh
Executable file
107
claude/check-mermaid.sh
Executable file
@ -0,0 +1,107 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Mermaid Syntax Checker using Docker Container
|
||||||
|
# Similar to PlantUML checker - keeps container running for better performance
|
||||||
|
|
||||||
|
# Colors for output
|
||||||
|
RED='\033[0;31m'
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
YELLOW='\033[0;33m'
|
||||||
|
CYAN='\033[0;36m'
|
||||||
|
GRAY='\033[0;90m'
|
||||||
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
|
# Check if file path is provided
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo -e "${RED}Error: No file path provided${NC}"
|
||||||
|
echo "Usage: $0 <mermaid-file>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
FILE_PATH="$1"
|
||||||
|
|
||||||
|
# Check if file exists
|
||||||
|
if [ ! -f "$FILE_PATH" ]; then
|
||||||
|
echo -e "${RED}Error: File not found: $FILE_PATH${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get absolute path
|
||||||
|
ABSOLUTE_PATH=$(realpath "$FILE_PATH")
|
||||||
|
FILE_NAME=$(basename "$ABSOLUTE_PATH")
|
||||||
|
|
||||||
|
echo -e "\n${CYAN}Checking Mermaid syntax for: $FILE_NAME${NC}"
|
||||||
|
echo -e "${GRAY}$(printf '=%.0s' {1..60})${NC}"
|
||||||
|
|
||||||
|
# Check if mermaid container is running
|
||||||
|
CONTAINER_RUNNING=$(docker ps --filter "name=mermaid-cli" --format "{{.Names}}" 2>/dev/null)
|
||||||
|
|
||||||
|
if [ -z "$CONTAINER_RUNNING" ]; then
|
||||||
|
echo -e "${RED}Error: Mermaid CLI container is not running.${NC}"
|
||||||
|
echo -e "${YELLOW}Please follow the setup instructions in the Mermaid guide to start the container.${NC}"
|
||||||
|
echo -e "\n${CYAN}Quick setup commands:${NC}"
|
||||||
|
echo ""
|
||||||
|
echo -e "${GREEN}# 1. Start container with root privileges (port 48080)${NC}"
|
||||||
|
echo -e "${NC}docker run -d --rm --name mermaid-cli -u root -p 48080:8080 --entrypoint sh minlag/mermaid-cli:latest -c \"while true;do sleep 3600; done\"${NC}"
|
||||||
|
echo ""
|
||||||
|
echo -e "${GREEN}# 2. Install Chromium and dependencies${NC}"
|
||||||
|
echo -e "${NC}docker exec mermaid-cli sh -c \"apk add --no-cache chromium chromium-chromedriver nss freetype harfbuzz ca-certificates ttf-freefont\"${NC}"
|
||||||
|
echo ""
|
||||||
|
echo -e "${GREEN}# 3. Create Puppeteer configuration${NC}"
|
||||||
|
echo -e "${NC}docker exec mermaid-cli sh -c \"echo '{\\\"executablePath\\\": \\\"/usr/bin/chromium-browser\\\", \\\"args\\\": [\\\"--no-sandbox\\\", \\\"--disable-setuid-sandbox\\\", \\\"--disable-dev-shm-usage\\\"]}' > /tmp/puppeteer-config.json\"${NC}"
|
||||||
|
echo ""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set Puppeteer configuration file path
|
||||||
|
PUPPETEER_CONFIG_FILE="/tmp/puppeteer-config.json"
|
||||||
|
|
||||||
|
# Generate unique temp filename
|
||||||
|
TIMESTAMP=$(date +"%Y%m%d%H%M%S")
|
||||||
|
PID=$$
|
||||||
|
TEMP_FILE="/tmp/mermaid_${TIMESTAMP}_${PID}.mmd"
|
||||||
|
OUTPUT_FILE="/tmp/mermaid_${TIMESTAMP}_${PID}.svg"
|
||||||
|
|
||||||
|
# Copy file to container
|
||||||
|
echo -e "${GRAY}Copying file to container...${NC}"
|
||||||
|
docker cp "$ABSOLUTE_PATH" "mermaid-cli:$TEMP_FILE" >/dev/null 2>&1
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo -e "${RED}Error: Failed to copy file to container${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run syntax check with Puppeteer configuration
|
||||||
|
echo -e "${GRAY}Running syntax check...${NC}"
|
||||||
|
OUTPUT=$(docker exec mermaid-cli sh -c "cd /home/mermaidcli && node_modules/.bin/mmdc -i '$TEMP_FILE' -o '$OUTPUT_FILE' -p '$PUPPETEER_CONFIG_FILE' -q" 2>&1)
|
||||||
|
EXIT_CODE=$?
|
||||||
|
|
||||||
|
if [ $EXIT_CODE -eq 0 ]; then
|
||||||
|
echo -e "\n${GREEN}Success: Mermaid syntax is valid!${NC}"
|
||||||
|
else
|
||||||
|
echo -e "\n${RED}Error: Mermaid syntax validation failed!${NC}"
|
||||||
|
echo -e "\n${RED}Error details:${NC}"
|
||||||
|
|
||||||
|
# Parse and display error messages
|
||||||
|
while IFS= read -r line; do
|
||||||
|
if [[ $line == *"Error:"* ]] || [[ $line == *"Parse error"* ]] || [[ $line == *"Expecting"* ]] || [[ $line == *"Syntax error"* ]]; then
|
||||||
|
echo -e " ${RED}$line${NC}"
|
||||||
|
elif [[ $line == *"line"* ]] && [[ $line =~ [0-9]+ ]]; then
|
||||||
|
echo -e " ${YELLOW}$line${NC}"
|
||||||
|
elif [[ ! -z "$line" ]]; then
|
||||||
|
echo -e " ${RED}$line${NC}"
|
||||||
|
fi
|
||||||
|
done <<< "$OUTPUT"
|
||||||
|
|
||||||
|
# Clean up and exit with error
|
||||||
|
docker exec mermaid-cli rm -f "$TEMP_FILE" "$OUTPUT_FILE" >/dev/null 2>&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clean up temp files
|
||||||
|
echo -e "\n${GRAY}Cleaning up...${NC}"
|
||||||
|
docker exec mermaid-cli rm -f "$TEMP_FILE" "$OUTPUT_FILE" >/dev/null 2>&1
|
||||||
|
|
||||||
|
echo -e "\n${CYAN}Validation complete!${NC}"
|
||||||
|
|
||||||
|
# Note: Container is kept running for subsequent checks
|
||||||
|
# To stop: docker stop mermaid-cli && docker rm mermaid-cli
|
||||||
@ -1,15 +1,5 @@
|
|||||||
graph TB
|
graph TB
|
||||||
%% KT AI 기반 소상공인 이벤트 자동 생성 서비스 - 논리 아키텍처 (Context Map)
|
%% KT AI 기반 소상공인 이벤트 자동 생성 서비스 - 논리 아키텍처 (간소화 버전)
|
||||||
|
|
||||||
%% Client Layer
|
|
||||||
subgraph "Client Layer"
|
|
||||||
Mobile["Web/Mobile Client<br/>• React PWA<br/>• Mobile First<br/>• 반응형 디자인"]
|
|
||||||
end
|
|
||||||
|
|
||||||
%% Gateway Layer
|
|
||||||
subgraph "Gateway Layer"
|
|
||||||
Gateway["API Gateway<br/>• JWT 인증/인가<br/>• 라우팅<br/>• Rate Limiting<br/>• 중앙 로깅"]
|
|
||||||
end
|
|
||||||
|
|
||||||
%% Service Layer
|
%% Service Layer
|
||||||
subgraph "Service Layer"
|
subgraph "Service Layer"
|
||||||
@ -22,107 +12,37 @@ graph TB
|
|||||||
AnalSvc["Analytics Service<br/>• 실시간 대시보드<br/>• 채널별 성과<br/>• ROI 분석"]
|
AnalSvc["Analytics Service<br/>• 실시간 대시보드<br/>• 채널별 성과<br/>• ROI 분석"]
|
||||||
end
|
end
|
||||||
|
|
||||||
%% Data Layer
|
%% Message Queue
|
||||||
subgraph "Data Layer"
|
|
||||||
Cache["Redis Cache<br/>• 세션 정보<br/>• AI 추천 결과 (24h)<br/>• 이미지 URL (7d)<br/>• 대시보드 데이터 (5m)"]
|
|
||||||
Queue["Message Queue<br/>• AI 작업 큐<br/>• 이미지 생성 큐<br/>• 배포 작업 큐"]
|
Queue["Message Queue<br/>• AI 작업 큐<br/>• 이미지 생성 큐<br/>• 배포 작업 큐"]
|
||||||
UserDB["User DB<br/>• users<br/>• stores"]
|
|
||||||
EventDB["Event DB<br/>• events<br/>• distribution_logs"]
|
|
||||||
PartDB["Participation DB<br/>• participants<br/>• winners"]
|
|
||||||
AnalDB["Analytics DB<br/>• event_stats<br/>• channel_stats"]
|
|
||||||
end
|
|
||||||
|
|
||||||
%% External APIs
|
%% External System
|
||||||
subgraph "External APIs"
|
External["외부시스템<br/>• 국세청 API<br/>• AI API<br/>• 이미지 생성 API<br/>• 배포 채널 APIs"]
|
||||||
TaxAPI["국세청 API<br/>사업자번호 검증"]
|
|
||||||
ClaudeAPI["Claude/GPT-4 API<br/>AI 트렌드 분석<br/>이벤트 추천"]
|
|
||||||
SDAPI["Stable Diffusion<br/>DALL-E API<br/>이미지 생성"]
|
|
||||||
UriAPI["우리동네TV API<br/>영상 배포"]
|
|
||||||
RingoAPI["링고비즈 API<br/>연결음 업데이트"]
|
|
||||||
GenieAPI["지니TV API<br/>TV 광고"]
|
|
||||||
SNSAPI["SNS APIs<br/>Instagram<br/>Naver<br/>Kakao"]
|
|
||||||
end
|
|
||||||
|
|
||||||
%% Client to Gateway (단일 연결)
|
%% Service to Queue
|
||||||
Mobile -->|HTTPS| Gateway
|
EventSvc -.->|AI 추천 요청| Queue
|
||||||
|
EventSvc -.->|이미지 생성 요청| Queue
|
||||||
%% Gateway to Services (동기)
|
|
||||||
Gateway -->|인증/프로필| UserSvc
|
|
||||||
Gateway -->|이벤트 관리| EventSvc
|
|
||||||
Gateway -->|참여자 관리| PartSvc
|
|
||||||
Gateway -->|성과 분석| AnalSvc
|
|
||||||
|
|
||||||
%% Event Service Dependencies
|
|
||||||
EventSvc -.->|"[Event]AI 추천 요청<br/>(Job 생성)"| Queue
|
|
||||||
Queue -.->|비동기 작업 처리| AISvc
|
Queue -.->|비동기 작업 처리| AISvc
|
||||||
|
|
||||||
EventSvc -.->|"[Event]이미지 생성 요청<br/>(Job 생성)"| Queue
|
|
||||||
Queue -.->|비동기 작업 처리| ContentSvc
|
Queue -.->|비동기 작업 처리| ContentSvc
|
||||||
|
|
||||||
|
%% Service to Service
|
||||||
EventSvc -->|배포 시작| DistSvc
|
EventSvc -->|배포 시작| DistSvc
|
||||||
|
|
||||||
%% AI Service Dependencies
|
|
||||||
AISvc -.->|"AI 추천 캐싱<br/>(Cache-Aside, 24h)"| Cache
|
|
||||||
AISvc -->|"트렌드 분석<br/>이벤트 추천<br/>(Circuit Breaker)"| ClaudeAPI
|
|
||||||
|
|
||||||
%% Content Service Dependencies
|
|
||||||
ContentSvc -.->|"이미지 URL 캐싱<br/>(Cache-Aside, 7d)"| Cache
|
|
||||||
ContentSvc -->|"이미지 생성<br/>(Circuit Breaker)"| SDAPI
|
|
||||||
|
|
||||||
%% Distribution Service Dependencies
|
|
||||||
DistSvc -->|"영상 배포<br/>(Circuit Breaker)"| UriAPI
|
|
||||||
DistSvc -->|"연결음 업데이트<br/>(Circuit Breaker)"| RingoAPI
|
|
||||||
DistSvc -->|"TV 광고<br/>(Circuit Breaker)"| GenieAPI
|
|
||||||
DistSvc -->|"SNS 자동 포스팅<br/>(Circuit Breaker)"| SNSAPI
|
|
||||||
|
|
||||||
%% User Service Dependencies
|
|
||||||
UserSvc -.->|세션 관리| Cache
|
|
||||||
UserSvc -.->|"사업자번호 캐싱<br/>(Cache-Aside, 7d)"| Cache
|
|
||||||
UserSvc -->|"사업자번호 검증<br/>(Circuit Breaker)"| TaxAPI
|
|
||||||
UserSvc -.->|사용자 정보| UserDB
|
|
||||||
|
|
||||||
%% Event Service Database
|
|
||||||
EventSvc -.->|이벤트 정보| EventDB
|
|
||||||
|
|
||||||
%% Participation Service Dependencies
|
|
||||||
PartSvc -.->|참여자 데이터| PartDB
|
|
||||||
PartSvc -->|이벤트 정보 조회| EventSvc
|
PartSvc -->|이벤트 정보 조회| EventSvc
|
||||||
|
|
||||||
%% Analytics Service Dependencies
|
|
||||||
AnalSvc -.->|"대시보드 캐싱<br/>(Cache-Aside, 5m)"| Cache
|
|
||||||
AnalSvc -.->|통계 데이터| AnalDB
|
|
||||||
AnalSvc -->|이벤트 정보| EventSvc
|
AnalSvc -->|이벤트 정보| EventSvc
|
||||||
AnalSvc -->|참여자 데이터| PartSvc
|
AnalSvc -->|참여자 데이터| PartSvc
|
||||||
AnalSvc -->|배포 통계| DistSvc
|
AnalSvc -->|배포 통계| DistSvc
|
||||||
AnalSvc -->|"채널별 노출 수<br/>(Circuit Breaker)"| UriAPI
|
|
||||||
AnalSvc -->|"채널별 노출 수<br/>(Circuit Breaker)"| GenieAPI
|
%% Service to External
|
||||||
AnalSvc -->|"SNS 통계<br/>(Circuit Breaker)"| SNSAPI
|
UserSvc -->|사업자번호 검증| External
|
||||||
|
AISvc -->|트렌드 분석/추천| External
|
||||||
|
ContentSvc -->|이미지 생성| External
|
||||||
|
DistSvc -->|다중 채널 배포| External
|
||||||
|
AnalSvc -->|채널별 통계| External
|
||||||
|
|
||||||
%% Styling
|
%% Styling
|
||||||
classDef client fill:#BFDBFE,stroke:#3B82F6,stroke-width:2px
|
classDef service fill:#4ECDC4,stroke:#14B8A6,stroke-width:2px
|
||||||
classDef gateway fill:#2E86AB,stroke:#1E3A8A,stroke-width:2px,color:#fff
|
|
||||||
classDef user fill:#4ECDC4,stroke:#14B8A6,stroke-width:2px
|
|
||||||
classDef event fill:#F18F01,stroke:#F97316,stroke-width:2px
|
|
||||||
classDef ai fill:#10B981,stroke:#059669,stroke-width:2px
|
|
||||||
classDef content fill:#8B5CF6,stroke:#7C3AED,stroke-width:2px,color:#fff
|
|
||||||
classDef dist fill:#EC4899,stroke:#DB2777,stroke-width:2px,color:#fff
|
|
||||||
classDef part fill:#F59E0B,stroke:#F97316,stroke-width:2px
|
|
||||||
classDef anal fill:#06B6D4,stroke:#0891B2,stroke-width:2px
|
|
||||||
classDef cache fill:#FCD34D,stroke:#F59E0B,stroke-width:2px
|
|
||||||
classDef queue fill:#FB923C,stroke:#EA580C,stroke-width:2px
|
classDef queue fill:#FB923C,stroke:#EA580C,stroke-width:2px
|
||||||
classDef db fill:#A78BFA,stroke:#8B5CF6,stroke-width:2px,color:#fff
|
|
||||||
classDef external fill:#E5E7EB,stroke:#9CA3AF,stroke-width:2px
|
classDef external fill:#E5E7EB,stroke:#9CA3AF,stroke-width:2px
|
||||||
|
|
||||||
class Mobile client
|
class UserSvc,EventSvc,AISvc,ContentSvc,DistSvc,PartSvc,AnalSvc service
|
||||||
class Gateway gateway
|
|
||||||
class UserSvc user
|
|
||||||
class EventSvc event
|
|
||||||
class AISvc ai
|
|
||||||
class ContentSvc content
|
|
||||||
class DistSvc dist
|
|
||||||
class PartSvc part
|
|
||||||
class AnalSvc anal
|
|
||||||
class Cache cache
|
|
||||||
class Queue queue
|
class Queue queue
|
||||||
class UserDB,EventDB,PartDB,AnalDB db
|
class External external
|
||||||
class TaxAPI,ClaudeAPI,SDAPI,UriAPI,RingoAPI,GenieAPI,SNSAPI external
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user