Skip to content

Commit 31dd9bf

Browse files
Decade-qiuclaude
andcommitted
✨ docs: update README with screenshots and simplified content
- Add welcome and code screenshots to documentation - Simplify README by removing duplicate content from docs/0.build.md - Add image gallery section with screenshots - Streamline overview and quick start sections Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f1e1ce2 commit 31dd9bf

File tree

3 files changed

+8
-286
lines changed

3 files changed

+8
-286
lines changed

README.md

Lines changed: 8 additions & 286 deletions
Original file line numberDiff line numberDiff line change
@@ -2,111 +2,19 @@
22

33
[![Java](https://img.shields.io/badge/java-17-blue)](https://www.oracle.com/java/technologies/javase-jdk17-downloads.html) [![Spring Boot](https://img.shields.io/badge/spring--boot-2.7.12-green)](https://spring.io/projects/spring-boot) [![Spring Cloud](https://img.shields.io/badge/Spring%20Cloud-2021.0.3-green)](https://spring.io/projects/spring-cloud) [![Spring Cloud Gateway](https://img.shields.io/badge/Spring%20Cloud%20Gateway-3.1.5-green)](https://spring.io/projects/spring-cloud-gateway) [![OpenFeign](https://img.shields.io/badge/OpenFeign-3.1.5-green)](https://github.com/OpenFeign/feign) [![Alibaba Nacos](https://img.shields.io/badge/Alibaba%20Nacos-2.5.1-green)](https://nacos.io/) [![Redis](https://img.shields.io/badge/Redis-7.0-red)](https://redis.io/) [![RabbitMQ](https://img.shields.io/badge/RabbitMQ-3--management-orange)](https://www.rabbitmq.com/) [![Elasticsearch](https://img.shields.io/badge/Elasticsearch-7.17.6-yellow)](https://www.elastic.co/) [![Sentinel](https://img.shields.io/badge/Sentinel-1.8.6-green)](https://github.com/alibaba/Sentinel) [![MySQL](https://img.shields.io/badge/MySQL-8.0-blue)](https://www.mysql.com/) [![MyBatis-Plus](https://img.shields.io/badge/MyBatis--Plus-3.5.2-green)](https://baomidou.com/) [![Vue.js](https://img.shields.io/badge/vue.js-3.3%2B-green)](https://vuejs.org/) [![TypeScript](https://img.shields.io/badge/TypeScript-5.0%2B-blue)](https://www.typescriptlang.org/) [![Element Plus](https://img.shields.io/badge/Element%20Plus-2.5%2B-green)](https://element-plus.org/) [![Docker](https://img.shields.io/badge/docker-20.10%2B-blue)](https://www.docker.com/) [![SkyWalking](https://img.shields.io/badge/SkyWalking-8.0%2B-purple)](https://skywalking.apache.org/) [![Prometheus](https://img.shields.io/badge/Prometheus-2.40%2B-blue)](https://prometheus.io/) [![License](https://img.shields.io/badge/license-Apache-blue.svg)](LICENSE)
44

5+
<div align="center">
6+
<p align="center">
7+
<img src="./docs/welcome.jpg" width="48%">
8+
<img src="./docs/code.jpg" width="48%"/>
9+
</p>
10+
</div>
11+
512
## 📖 Overview
613

714
**D-OnlineJudge** is a full-stack online coding and competitive programming platform built with **Java Spring Cloud microservices architecture** and **Vue 3 frontend framework**.
815

916
It provides a secure, scalable, and feature-rich environment for programming competitions, code submissions, and real-time verdict feedback.
1017

11-
```mermaid
12-
graph TB
13-
subgraph User["👤 用户层"]
14-
U["用户 / 管理员"]
15-
style U fill:#FF6B6B,stroke:#C92A2A,stroke-width:2px,color:#fff
16-
end
17-
18-
subgraph Frontend["🎨 前端层"]
19-
FE["Vue 3<br/>DOJ-FE"]
20-
style FE fill:#4ECDC4,stroke:#1A9B8E,stroke-width:2px,color:#fff
21-
end
22-
23-
subgraph Gateway["🚪 网关层"]
24-
GW["API Gateway<br/>服务网关"]
25-
style GW fill:#45B7D1,stroke:#0A6B8C,stroke-width:2px,color:#fff
26-
end
27-
28-
subgraph Services["⚙️ 核心业务服务"]
29-
US["👥 User-Service<br/>用户服务"]
30-
PS["📚 Problem-Service<br/>题目服务"]
31-
SS["📤 Submission-Service<br/>提交服务"]
32-
SB["🔒 Sandbox-Service<br/>沙箱服务"]
33-
34-
style US fill:#95E1D3,stroke:#38B6A8,stroke-width:2px,color:#333
35-
style PS fill:#95E1D3,stroke:#38B6A8,stroke-width:2px,color:#333
36-
style SS fill:#95E1D3,stroke:#38B6A8,stroke-width:2px,color:#333
37-
style SB fill:#F38181,stroke:#C92A2A,stroke-width:2px,color:#fff
38-
end
39-
40-
subgraph Middleware["🔧 中间件与数据层"]
41-
Nacos["🧭 Nacos<br/>服务注册发现"]
42-
Sentinel["🛡️ Sentinel<br/>流量防护"]
43-
MySQL["🗄️ MySQL<br/>关系数据库"]
44-
Redis["⚡ Redis<br/>缓存队列"]
45-
RabbitMQ["📬 RabbitMQ<br/>消息队列"]
46-
ES["🔍 Elasticsearch<br/>搜索引擎"]
47-
48-
style Nacos fill:#FFE66D,stroke:#F0AD4E,stroke-width:2px,color:#333
49-
style Sentinel fill:#FFE66D,stroke:#F0AD4E,stroke-width:2px,color:#333
50-
style MySQL fill:#A8D8EA,stroke:#2B7BB4,stroke-width:2px,color:#fff
51-
style Redis fill:#AA96DA,stroke:#6B5B95,stroke-width:2px,color:#fff
52-
style RabbitMQ fill:#FCBAD3,stroke:#EB5757,stroke-width:2px,color:#fff
53-
style ES fill:#F38181,stroke:#C92A2A,stroke-width:2px,color:#fff
54-
end
55-
56-
subgraph Observability["📊 可观测性栈"]
57-
Prom["📈 Prometheus<br/>+<br/>Grafana"]
58-
Trace["🌐 SkyWalking<br/>链路追踪"]
59-
Log["📄 Loki<br/>日志聚合"]
60-
61-
style Prom fill:#A0D468,stroke:#76A844,stroke-width:2px,color:#fff
62-
style Trace fill:#A0D468,stroke:#76A844,stroke-width:2px,color:#fff
63-
style Log fill:#A0D468,stroke:#76A844,stroke-width:2px,color:#fff
64-
end
65-
66-
subgraph DevOps["🚀 DevOps"]
67-
CICD["⚙️ GitHub Actions<br/>CI/CD"]
68-
Docker["🐳 Docker Compose<br/>容器编排"]
69-
70-
style CICD fill:#B19CD9,stroke:#8E7CC3,stroke-width:2px,color:#fff
71-
style Docker fill:#B19CD9,stroke:#8E7CC3,stroke-width:2px,color:#fff
72-
end
73-
74-
U -->|访问| FE
75-
FE -->|请求| GW
76-
77-
GW -->|路由| US
78-
GW -->|路由| PS
79-
GW -->|路由| SS
80-
81-
PS -->|读写| ES
82-
83-
SS -->|发送任务| RabbitMQ
84-
RabbitMQ -->|消费任务| SB
85-
SB -->|返回结果| RabbitMQ
86-
RabbitMQ -->|消费结果| SS
87-
88-
US -->|读写| MySQL
89-
PS -->|读写| MySQL
90-
SS -->|读写| MySQL
91-
US -->|缓存| Redis
92-
93-
GW -.->|服务发现| Nacos
94-
US -.->|服务发现| Nacos
95-
PS -.->|服务发现| Nacos
96-
SS -.->|服务发现| Nacos
97-
SB -.->|服务发现| Nacos
98-
99-
GW -.->|流量防护| Sentinel
100-
101-
Prom -.->|监控| GW
102-
Trace -.->|追踪| GW
103-
Log -.->|日志| GW
104-
105-
CICD -->|构建部署| Docker
106-
Docker -->|运行| GW
107-
Docker -->|运行| FE
108-
```
109-
11018
### ✨ Key Features
11119

11220
- **🏗️ Microservices Architecture**: Spring Cloud-based modular design with independent deployable services, high cohesion, and loose coupling
@@ -122,48 +30,6 @@ graph TB
12230

12331
---
12432

125-
## 📁 Project Structure
126-
127-
```
128-
D-OnlineJudge/
129-
├── DOJ-BE/ # Backend Microservices
130-
│ ├── common/ # Common module (utilities, Feign clients, global configs)
131-
│ ├── gateway-service/ # API Gateway (routing, authentication, traffic control)
132-
│ ├── user-service/ # User Service (registration, login, permissions)
133-
│ ├── problem-service/ # Problem Service (CRUD, full-text search)
134-
│ ├── submission-service/ # Submission Service (code submission, verdict orchestration)
135-
│ ├── sandbox-service/ # Sandbox Service (code execution, resource isolation)
136-
│ └── pom.xml # Maven parent POM configuration
137-
138-
├── DOJ-FE/ # Frontend Application (Vue 3 + TypeScript)
139-
│ ├── src/
140-
│ │ ├── components/ # Reusable UI components
141-
│ │ ├── views/ # Business pages
142-
│ │ ├── services/ # API calls, WebSocket communication
143-
│ │ ├── store/ # Pinia state management
144-
│ │ └── App.vue # Root component
145-
│ ├── nginx.conf # Nginx reverse proxy configuration
146-
│ ├── Dockerfile # Frontend container configuration
147-
│ ├── run-docker.sh # One-click deployment script
148-
│ └── package.json
149-
150-
├── docs/ # Project Documentation
151-
│ ├── 0.build.md # Detailed build and deployment guide
152-
│ ├── 0.technology.md # Architecture and design decisions
153-
│ ├── 0.re.md # Requirements specification and roadmap
154-
│ ├── SQL/ # Database initialization scripts
155-
│ └── Dockerfile.cpp/.java/.python # Multi-language sandbox configurations
156-
157-
├── docker-compose-service.yml # Microservices orchestration
158-
├── docker-compose-skywalking.yml # SkyWalking observability stack
159-
├── docker-compose-monitoring.yml # Prometheus + Grafana + Loki monitoring
160-
├── .github/workflows/ci-cd.yml # GitHub Actions CI/CD pipeline
161-
├── README.md # Project documentation (this file)
162-
└── LICENSE # MIT License
163-
```
164-
165-
---
166-
16733
## 🚀 Quick Start
16834

16935
This guide will help you set up and run D-OnlineJudge locally. Follow the steps below.
@@ -203,8 +69,6 @@ docker network create doj
20369
# For detailed commands, see docs/0.build.md section "2. Deploying Core Dependency Services"
20470
```
20571

206-
> 📌 **Complete dependency deployment steps** are available in `docs/0.build.md`. This document includes detailed commands for MySQL, Redis, RabbitMQ, Nacos, Elasticsearch, Kibana, and Sentinel.
207-
20872
#### 2.2 Configure Nacos
20973

21074
1. Access Nacos console: `http://localhost:8848/nacos` (default: `nacos`/`nacos`)
@@ -315,137 +179,7 @@ Once all services are running successfully, access them via:
315179

316180
---
317181

318-
## 📚 Comprehensive Documentation
319-
320-
This project provides detailed documentation to help you understand the architecture, deployment, and development:
321-
322-
| Document | Content |
323-
| :--- | :--- |
324-
| **`docs/0.build.md`** | Detailed compilation, configuration, and deployment guide. Includes all middleware startup commands. |
325-
| **`docs/0.technology.md`** | Core architecture, system design highlights, and best practices. In-depth analysis of microservices, caching, and observability. |
326-
| **`docs/0.re.md`** | Requirements specification, feature list, project planning, and evolution roadmap. |
327-
| **`docs/SQL/`** | Database initialization scripts (users, problems, submissions, and core tables). |
328-
329-
---
330-
331-
## 🏗️ System Architecture
332-
333-
### Microservice Topology
334-
335-
```
336-
┌─────────────────────────────────────────────────────────────┐
337-
│ Client / Browser │
338-
└────────────────────────┬────────────────────────────────────┘
339-
340-
Frontend (Vue 3)
341-
342-
┌────────────────────────▼────────────────────────────────────┐
343-
│ API Gateway (Spring Cloud Gateway) │
344-
│ ├─ Routing ├─ JWT Auth ├─ Traffic │
345-
│ └─ CORS Handling └─ Sentinel Control└─ Fallback │
346-
└────────────────────────┬────────────────────────────────────┘
347-
┌──────────────┼──────────────┬──────────────┐
348-
│ │ │ │
349-
┌────▼───────┐ ┌───▼────────┐ ┌──▼──────────┐ ┌─▼──────────┐
350-
│ User Svc │ │ Problem │ │ Submission │ │ Sandbox │
351-
│ │ │ Svc │ │ Svc │ │ Svc │
352-
└────┬───────┘ └───┬────────┘ └──┬─────────┘ └─┬──────────┘
353-
│ │ │ │
354-
┌────▼──────────────▼─────────────▼────────────▼─────────┐
355-
│ Data and Middleware Layer │
356-
│ ├─ MySQL (user/problem/submission data) │
357-
│ ├─ Redis (caching and token storage) │
358-
│ ├─ Elasticsearch (full-text search) │
359-
│ ├─ RabbitMQ (event messaging) │
360-
│ ├─ Nacos (service registry and config) │
361-
│ └─ Docker (sandbox execution) │
362-
└──────────────────────────────────────────────────────┘
363-
364-
┌────▼──────────────────────────────────────────────────┐
365-
│ Observability Stack │
366-
│ ├─ SkyWalking (distributed tracing) │
367-
│ ├─ Prometheus + Grafana (monitoring) │
368-
│ └─ Loki (log aggregation) │
369-
└───────────────────────────────────────────────────────┘
370-
```
371-
372-
---
373-
374-
## 🔧 Configuration and Development
375-
376-
### Environment Variables
377-
378-
Key environment variables (used during Docker deployment):
379-
380-
```bash
381-
# Database
382-
DOJ_DB_HOST=mysql
383-
DOJ_DB_NAME=doj_submission
384-
DOJ_DB_USER=root
385-
DOJ_DB_PWD=123
386-
387-
# Caching and Message Queue
388-
DOJ_REDIS_HOST=redis
389-
DOJ_MQ_HOST=rabbitmq
390-
391-
# Service Governance
392-
NACOS_SERVER_ADDR=nacos:8848
393-
SENTINEL_DASHBOARD_ADDR=sentinel:8080
394-
395-
# JVM Parameters
396-
JAVA_OPTS=-Xms128m -Xmx256m
397-
```
398-
399-
### IDE Configuration (IntelliJ IDEA)
400-
401-
To enable SkyWalking tracing for microservices:
402-
403-
1. **Open Run Configurations**: Run → Edit Configurations
404-
2. **Add VM Options**:
405-
```
406-
-javaagent:/path/to/skywalking-agent/skywalking-agent.jar
407-
-Dskywalking.agent.service_name=user-service
408-
```
409-
3. Configure `service_name` individually for each service
410-
411-
For detailed instructions, see `docs/0.build.md` section "4.4 Attaching SkyWalking Agent".
412-
413-
---
414-
415-
## 🚀 Automated CI/CD Pipeline
416-
417-
The project includes a complete **GitHub Actions** automated CI/CD workflow.
418-
419-
### Deployment Flow
420-
421-
When code is pushed to the `main` branch, the following process is automatically triggered:
422-
423-
```
424-
Code push (git push main)
425-
426-
[GitHub Actions] Build all microservices in parallel
427-
428-
[GitHub Actions] Build Docker images for each service
429-
430-
[GitHub Actions] Push images to Docker Hub
431-
432-
[GitHub Actions] SSH to production server
433-
434-
[Production Server] Pull latest images and restart services with docker-compose
435-
436-
✅ Deployment complete
437-
```
438-
439-
### Core Configuration Files
440-
441-
- **`.github/workflows/ci-cd.yml`**: Defines complete build, test, package, and deploy workflow
442-
- **`docker-compose-service.yml`**: Container orchestration configuration (production environment)
443-
444-
For details, see `docs/0.build.md` section "5. Automated Deployment (CI/CD)".
445-
446-
---
447-
448-
## 📊 Observability (The Three Pillars)
182+
## 📊 Observability
449183

450184
### Comprehensive Monitoring System
451185

@@ -497,18 +231,6 @@ docker build -t code-runner-python -f docs/Dockerfile.python .
497231

498232
---
499233

500-
## 📈 Performance Optimization Highlights
501-
502-
| Optimization | Impact |
503-
| :--- | :--- |
504-
| **Three-Tier Cache** | Database queries ↓ 99%, response time ↓ 100x |
505-
| **Asynchronous Judging** | Reduced network latency, enhanced user experience |
506-
| **Sentinel Rate Limiting** | Prevents cascading failures, system resilience ↑ 10x |
507-
| **Elasticsearch Search** | Search response from seconds to milliseconds |
508-
| **Docker Sandbox Isolation** | Complete prevention of malicious code execution |
509-
510-
---
511-
512234
## 🤝 Contributing
513235

514236
We welcome all forms of contributions!

docs/code.jpg

219 KB
Loading

docs/welcome.jpg

324 KB
Loading

0 commit comments

Comments
 (0)