feat: no-nginx frontend, host nginx config, configurable ports
- Frontend: remove nginx, use serve for static files - Frontend: add Projects/Milestones/Notifications pages - Frontend: fix auth endpoint to match backend (/auth/token) - docker-compose: configurable ports via env vars, reduce frontend resources - Add nginx-host.conf.example for host-level reverse proxy - Add .env.example - Update README with deployment architecture
This commit is contained in:
15
.env.example
Normal file
15
.env.example
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# MySQL
|
||||||
|
MYSQL_ROOT_PASSWORD=harborforge_root
|
||||||
|
MYSQL_DATABASE=harborforge
|
||||||
|
MYSQL_USER=harborforge
|
||||||
|
MYSQL_PASSWORD=harborforge_pass
|
||||||
|
MYSQL_PORT=3306
|
||||||
|
|
||||||
|
# Backend
|
||||||
|
SECRET_KEY=change_me_in_production
|
||||||
|
LOG_LEVEL=INFO
|
||||||
|
BACKEND_PORT=8000
|
||||||
|
|
||||||
|
# Frontend
|
||||||
|
FRONTEND_PORT=3000
|
||||||
|
VITE_API_BASE=/api
|
||||||
Submodule HarborForge.Frontend updated: 853594f447...54d4c4379a
47
README.md
47
README.md
@@ -7,9 +7,10 @@ Agent/人类协同任务管理平台
|
|||||||
```
|
```
|
||||||
HarborForge/
|
HarborForge/
|
||||||
├── HarborForge.Backend/ # 后端 (FastAPI + MySQL)
|
├── HarborForge.Backend/ # 后端 (FastAPI + MySQL)
|
||||||
├── HarborForge.Frontend/ # 前端 (React) - 规划中
|
├── HarborForge.Frontend/ # 前端 (React + Vite)
|
||||||
├── HarborForge.Cli/ # CLI 工具 - 规划中
|
├── docker-compose.yml # Docker 部署配置
|
||||||
└── docker-compose.yml # 部署配置
|
├── nginx-host.conf.example # 宿主机 nginx 配置示例
|
||||||
|
└── .env.example # 环境变量模板
|
||||||
```
|
```
|
||||||
|
|
||||||
## 快速开始
|
## 快速开始
|
||||||
@@ -20,13 +21,45 @@ git clone https://git.hangman-lab.top/zhi/HarborForge.git
|
|||||||
cd HarborForge
|
cd HarborForge
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
|
|
||||||
# 启动服务
|
# 配置环境变量
|
||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
|
|
||||||
|
# 启动服务
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 部署架构
|
||||||
|
|
||||||
|
```
|
||||||
|
宿主机 nginx (80/443)
|
||||||
|
├── / → frontend (Docker, port 3000)
|
||||||
|
└── /api/ → backend (Docker, port 8000)
|
||||||
|
```
|
||||||
|
|
||||||
|
前端 Docker 容器不包含 nginx,使用轻量的 `serve` 提供静态文件。
|
||||||
|
API 代理由宿主机 nginx 统一处理。
|
||||||
|
|
||||||
|
### 宿主机 nginx 配置
|
||||||
|
|
||||||
|
参考 `nginx-host.conf.example`,复制到 `/etc/nginx/sites-available/` 并修改域名。
|
||||||
|
|
||||||
## 子模块
|
## 子模块
|
||||||
|
|
||||||
- [HarborForge.Backend](https://git.hangman-lab.top/zhi/HarborForge.Backend) - 后端 API
|
- [HarborForge.Backend](https://git.hangman-lab.top/zhi/HarborForge.Backend) - FastAPI 后端 API
|
||||||
- [HarborForge.Frontend](https://git.hangman-lab.top/zhi/HarborForge.Frontend) - 前端 (规划中)
|
- [HarborForge.Frontend](https://git.hangman-lab.top/zhi/HarborForge.Frontend) - React 前端
|
||||||
- [HarborForge.Cli](https://git.hangman-lab.top/zhi/HarborForge.Cli) - CLI 工具 (规划中)
|
|
||||||
|
## 端口
|
||||||
|
|
||||||
|
| 服务 | 默认端口 | 环境变量 |
|
||||||
|
|------|----------|----------|
|
||||||
|
| Frontend | 3000 | `FRONTEND_PORT` |
|
||||||
|
| Backend | 8000 | `BACKEND_PORT` |
|
||||||
|
| MySQL | 3306 | `MYSQL_PORT` |
|
||||||
|
|
||||||
|
## 前端页面
|
||||||
|
|
||||||
|
- 📊 仪表盘 — 统计概览
|
||||||
|
- 📋 Issues — 创建、列表、详情、状态变更、评论
|
||||||
|
- 📁 项目 — 项目管理、成员、关联 issue
|
||||||
|
- 🏁 里程碑 — 进度追踪、完成百分比
|
||||||
|
- 🔔 通知 — 实时通知中心、未读计数
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
version: '3.8'
|
version: '3.8'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
mysql:
|
mysql:
|
||||||
image: mysql:8.0
|
image: mysql:8.0
|
||||||
@@ -10,16 +11,11 @@ services:
|
|||||||
MYSQL_USER: ${MYSQL_USER:-harborforge}
|
MYSQL_USER: ${MYSQL_USER:-harborforge}
|
||||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-harborforge_pass}
|
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-harborforge_pass}
|
||||||
volumes:
|
volumes:
|
||||||
- mysql_data:/var/lib/mysql
|
- mysql_data:/var/lib/mysql
|
||||||
ports:
|
ports:
|
||||||
- 3306:3306
|
- "${MYSQL_PORT:-3306}:3306"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test:
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
||||||
- CMD
|
|
||||||
- mysqladmin
|
|
||||||
- ping
|
|
||||||
- -h
|
|
||||||
- localhost
|
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
@@ -28,6 +24,7 @@ services:
|
|||||||
limits:
|
limits:
|
||||||
cpus: '0.5'
|
cpus: '0.5'
|
||||||
memory: 512M
|
memory: 512M
|
||||||
|
|
||||||
backend:
|
backend:
|
||||||
build:
|
build:
|
||||||
context: ./HarborForge.Backend
|
context: ./HarborForge.Backend
|
||||||
@@ -39,53 +36,46 @@ services:
|
|||||||
SECRET_KEY: ${SECRET_KEY:-change_me_in_production}
|
SECRET_KEY: ${SECRET_KEY:-change_me_in_production}
|
||||||
LOG_LEVEL: ${LOG_LEVEL:-INFO}
|
LOG_LEVEL: ${LOG_LEVEL:-INFO}
|
||||||
ports:
|
ports:
|
||||||
- 8000:8000
|
- "${BACKEND_PORT:-8000}:8000"
|
||||||
depends_on:
|
depends_on:
|
||||||
mysql:
|
mysql:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
volumes:
|
|
||||||
- ./HarborForge.Backend:/app
|
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: '0.5'
|
cpus: '0.5'
|
||||||
memory: 512M
|
memory: 512M
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test:
|
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
||||||
- CMD
|
|
||||||
- curl
|
|
||||||
- -f
|
|
||||||
- http://localhost:8000/health
|
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 3
|
retries: 3
|
||||||
start_period: 10s
|
start_period: 10s
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
build:
|
build:
|
||||||
context: ./HarborForge.Frontend
|
context: ./HarborForge.Frontend
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
VITE_API_BASE: ${VITE_API_BASE:-/api}
|
||||||
container_name: harborforge-frontend
|
container_name: harborforge-frontend
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- "${FRONTEND_PORT:-3000}:3000"
|
||||||
depends_on:
|
depends_on:
|
||||||
backend:
|
backend:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: '0.5'
|
cpus: '0.25'
|
||||||
memory: 256M
|
memory: 128M
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test:
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000"]
|
||||||
- CMD
|
|
||||||
- wget
|
|
||||||
- -q
|
|
||||||
- --spider
|
|
||||||
- http://localhost:3000
|
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 3
|
retries: 3
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
mysql_data:
|
mysql_data:
|
||||||
driver: local
|
driver: local
|
||||||
|
|||||||
26
nginx-host.conf.example
Normal file
26
nginx-host.conf.example
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# 宿主机 nginx 配置示例
|
||||||
|
# 复制到 /etc/nginx/sites-available/ 并 symlink 到 sites-enabled/
|
||||||
|
# 修改 server_name 为实际域名
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name harborforge.example.com;
|
||||||
|
|
||||||
|
# 前端
|
||||||
|
location / {
|
||||||
|
proxy_pass http://127.0.0.1:3000;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
# API 代理
|
||||||
|
location /api/ {
|
||||||
|
proxy_pass http://127.0.0.1:8000/;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user