diff --git a/CLAUDE.md b/CLAUDE.md index 05838c0..87903be 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -2,6 +2,12 @@ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. +## Development Principles +**IMPORTANT**: +1. 모든 개발은 Docker 환경에서만 진행 +2. Docker 빌드는 백그라운드로 실행하고 완료까지 대기 +3. 로컬 환경 설정 금지 (venv, npm install 등) + ## File Naming Convention **IMPORTANT**: 모든 문서 파일은 대문자.md 형식으로 생성 - 예: README.md, CHANGELOG.md, TODO.md, ARCHITECTURE.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..4dcaa96 --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# Site11 - Microservices Architecture + +## Overview +Microservices platform with Console as API Gateway orchestrating multiple domain services. + +## Quick Start + +### Start Services +```bash +# Start console service +docker-compose up -d console-backend + +# Check status +curl http://localhost:8011/health +``` + +### Available Endpoints +- `http://localhost:8011/` - Root endpoint +- `http://localhost:8011/health` - Health check +- `http://localhost:8011/api/status` - System status + +## Architecture +- **Console**: API Gateway and orchestrator +- **Services**: Domain-specific microservices (users, oauth, images, etc.) +- **Database**: MongoDB for persistence +- **Cache**: Redis for caching and pub/sub + +## Development +See `docs/PLAN.md` for implementation roadmap and `docs/PROGRESS.md` for current status. \ No newline at end of file diff --git a/console/backend/Dockerfile b/console/backend/Dockerfile new file mode 100644 index 0000000..2515968 --- /dev/null +++ b/console/backend/Dockerfile @@ -0,0 +1,21 @@ +FROM python:3.11-slim + +WORKDIR /app + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + gcc \ + && rm -rf /var/lib/apt/lists/* + +# Copy requirements first for better caching +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +# Copy application code +COPY . . + +# Expose port +EXPOSE 8000 + +# Run the application +CMD ["python", "main.py"] \ No newline at end of file diff --git a/console/backend/main.py b/console/backend/main.py new file mode 100644 index 0000000..f832901 --- /dev/null +++ b/console/backend/main.py @@ -0,0 +1,58 @@ +from fastapi import FastAPI +from fastapi.middleware.cors import CORSMiddleware +import uvicorn +from datetime import datetime + +app = FastAPI( + title="Console API Gateway", + description="Central orchestrator for microservices", + version="0.1.0" +) + +# CORS middleware +app.add_middleware( + CORSMiddleware, + allow_origins=["*"], + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], +) + +@app.get("/") +async def root(): + return { + "message": "Console API Gateway", + "status": "running", + "timestamp": datetime.now().isoformat() + } + +@app.get("/health") +async def health_check(): + return { + "status": "healthy", + "service": "console", + "timestamp": datetime.now().isoformat() + } + +@app.get("/api/status") +async def system_status(): + return { + "console": "online", + "services": { + "users": "pending", + "oauth": "pending", + "images": "pending", + "applications": "pending", + "data": "pending", + "statistics": "pending" + }, + "timestamp": datetime.now().isoformat() + } + +if __name__ == "__main__": + uvicorn.run( + "main:app", + host="0.0.0.0", + port=8000, + reload=True + ) \ No newline at end of file diff --git a/console/backend/requirements.txt b/console/backend/requirements.txt new file mode 100644 index 0000000..098afdc --- /dev/null +++ b/console/backend/requirements.txt @@ -0,0 +1,5 @@ +fastapi==0.109.0 +uvicorn[standard]==0.27.0 +python-dotenv==1.0.0 +pydantic==2.5.3 +httpx==0.26.0 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b1e4bf5 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,23 @@ +version: '3.8' + +services: + console-backend: + build: + context: ./console/backend + dockerfile: Dockerfile + container_name: site11_console_backend + ports: + - "8011:8000" + environment: + - ENV=development + - PORT=8000 + volumes: + - ./console/backend:/app + networks: + - site11_network + restart: unless-stopped + +networks: + site11_network: + driver: bridge + name: site11_network \ No newline at end of file diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md index 098ed56..3d35873 100644 --- a/docs/PROGRESS.md +++ b/docs/PROGRESS.md @@ -5,13 +5,17 @@ ## Current Status - **Date Started**: 2025-09-09 -- **Current Phase**: Planning Complete -- **Next Action**: Step 1 - Minimal Foundation 구현 +- **Current Phase**: Step 1 Complete ✅ +- **Next Action**: Step 2 - Add First Service (Users) ## Completed Checkpoints ✅ Project structure planning (CLAUDE.md) ✅ Implementation plan created (docs/PLAN.md) ✅ Progressive approach defined +✅ Step 1: Minimal Foundation - Docker + Console Hello World + - docker-compose.yml created + - console/backend with FastAPI + - Running on port 8011 ## Active Working Files ```