From 2c01dc70e4b18dcab1330f2eecb4e5b7e803ae14 Mon Sep 17 00:00:00 2001 From: gitee-bot Date: Mon, 22 Jun 2026 05:48:27 +0000 Subject: [PATCH] Add README.md --- README.en.md | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 238 insertions(+) create mode 100644 README.en.md create mode 100644 README.md diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..a6f3aeb --- /dev/null +++ b/README.en.md @@ -0,0 +1,119 @@ +# Cloud-Native Computing Course Project + +This is a cloud-native computing course project featuring a frontend-backend separated web application, with multiple deployment options including Docker, Docker Compose, Kubernetes, and Helm. + +## Project Structure + +``` +part2/ +├── backend/ # Flask backend service +│ ├── app.py # Main Flask application +│ ├── Dockerfile # Backend container image +│ └── requirements.txt # Python dependencies +├── frontend/ # Nginx frontend service +│ ├── Dockerfile # Frontend container image +│ ├── index.html # Frontend page +│ └── nginx.conf # Nginx configuration +├── docker-compose.yml # Docker Compose orchestration +├── douban_movies.csv # Movie data CSV +├── helm/ # Helm Charts +├── k8s/ # Kubernetes资源配置 +│ ├── configmap-secret.yaml +│ ├── deployment.yaml +│ ├── hpa.yaml +│ ├── pvc.yaml +│ └── service.yaml +└── task_book.txt # Task handbook + +part3/ +├── 13-sparkapplication.yaml # Spark application configuration +└── wordcount.py # WordCount example program +``` + +## Features + +### Backend API + +The backend provides the following RESTful API endpoints: + +- `GET /api/ping` - Health check +- `GET /api/counter` - Counter +- `GET /api/info` - Service information +- `GET /api/compute` - Computation endpoint (performs matrix operations using NumPy) + +### Technology Stack + +- **Backend**: Python 3.11 + Flask + NumPy + Gunicorn +- **Frontend**: Nginx (Alpine) +- **Containerization**: Docker + Docker Compose +- **Orchestration**: Kubernetes + Helm +- **Big Data**: Apache Spark + +## Quick Start + +### Deploy with Docker Compose + +```bash +cd part2 +docker-compose up -d +``` + +Access the application: +- Frontend: http://localhost:80 +- Backend API: http://localhost:5000 + +### Deploy with Kubernetes + +```bash +cd part2/k8s +kubectl apply -f deployment.yaml +kubectl apply -f service.yaml +kubectl apply -f configmap-secret.yaml +kubectl apply -f pvc.yaml +kubectl apply -f hpa.yaml +``` + +### Deploy with Helm + +```bash +cd part2/helm +helm install release-name . +``` + +## API Documentation + +### Health Check + +```bash +curl http://localhost:5000/api/ping +``` + +### Get Counter + +```bash +curl http://localhost:5000/api/counter +``` + +### Get Service Information + +```bash +curl http://localhost:5000/api/info +``` + +### Computation Endpoint + +```bash +curl http://localhost:5000/api/compute +``` + +## System Requirements + +- Python 3.11+ +- Docker 20.10+ +- Docker Compose 2.0+ +- Kubernetes 1.20+ (optional) +- Helm 3.0+ (optional) + +## License + +This project is intended solely for educational and collaborative purposes. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..9775f27 --- /dev/null +++ b/README.md @@ -0,0 +1,119 @@ +# 云原生计算课程项目 + +这是一个云原生计算课程项目,包含前后端分离的 Web 应用,并提供了 Docker、Docker Compose、Kubernetes 和 Helm 等多种部署方式。 + +## 项目结构 + +``` +part2/ +├── backend/ # Flask 后端服务 +│ ├── app.py # Flask 应用主程序 +│ ├── Dockerfile # 后端容器镜像 +│ └── requirements.txt # Python 依赖 +├── frontend/ # Nginx 前端服务 +│ ├── Dockerfile # 前端容器镜像 +│ ├── index.html # 前端页面 +│ └── nginx.conf # Nginx 配置 +├── docker-compose.yml # Docker Compose 编排 +├── douban_movies.csv # 电影数据 CSV +├── helm/ # Helm Charts +├── k8s/ # Kubernetes 资源配置 +│ ├── configmap-secret.yaml +│ ├── deployment.yaml +│ ├── hpa.yaml +│ ├── pvc.yaml +│ └── service.yaml +└── task_book.txt # 任务手册 + +part3/ +├── 13-sparkapplication.yaml # Spark 应用配置 +└── wordcount.py # WordCount 示例程序 +``` + +## 功能特性 + +### 后端 API + +后端提供以下 RESTful API 端点: + +- `GET /api/ping` - 健康检查 +- `GET /api/counter` - 计数器 +- `GET /api/info` - 服务信息 +- `GET /api/compute` - 计算接口(使用 NumPy 进行矩阵运算) + +### 技术栈 + +- **后端**:Python 3.11 + Flask + NumPy + Gunicorn +- **前端**:Nginx (Alpine) +- **容器化**:Docker + Docker Compose +- **编排**:Kubernetes + Helm +- **大数据**:Apache Spark + +## 快速开始 + +### 使用 Docker Compose 部署 + +```bash +cd part2 +docker-compose up -d +``` + +访问应用: +- 前端:http://localhost:80 +- 后端 API:http://localhost:5000 + +### 使用 Kubernetes 部署 + +```bash +cd part2/k8s +kubectl apply -f deployment.yaml +kubectl apply -f service.yaml +kubectl apply -f configmap-secret.yaml +kubectl apply -f pvc.yaml +kubectl apply -f hpa.yaml +``` + +### 使用 Helm 部署 + +```bash +cd part2/helm +helm install release-name . +``` + +## API 文档 + +### 健康检查 + +```bash +curl http://localhost:5000/api/ping +``` + +### 获取计数器 + +```bash +curl http://localhost:5000/api/counter +``` + +### 获取服务信息 + +```bash +curl http://localhost:5000/api/info +``` + +### 计算接口 + +```bash +curl http://localhost:5000/api/compute +``` + +## 环境要求 + +- Python 3.11+ +- Docker 20.10+ +- Docker Compose 2.0+ +- Kubernetes 1.20+ (可选) +- Helm 3.0+ (可选) + +## 许可证 + +本项目仅供学习交流使用。 \ No newline at end of file -- Gitee