Files
2026-05-16 22:25:48 +08:00

168 lines
4.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Git 克隆与仓库说明
**远程仓库:** https://git.bz121.com/dekun/gate_scout_order.git
[dekun/gate_scout_order](https://git.bz121.com/dekun/gate_scout_order) · Gitea
**完整部署(含升级备份):** 见 [部署说明.md](部署说明.md)
`gate_scout_order` 目录采用 **monorepo**:一个 Git 仓库内包含两个子项目,无需分别克隆。
```text
gate_scout_order/ ← 仓库根目录(git clone 落点,目录名可自定)
├── onchain_scout_gate/ ← 扫描端
├── gate_order_executor/ ← 执行器
├── README.md
├── 部署说明.md
├── CLONE.md ← 本文件
└── .gitignore
```
---
## 一、从远程克隆(推荐)
### HTTPS
```bash
cd /opt
git clone https://git.bz121.com/dekun/gate_scout_order.git gate_scout_order
cd gate_scout_order
```
### SSH(已配置 git.bz121.com 公钥时)
```bash
cd /opt
git clone git@git.bz121.com:dekun/gate_scout_order.git gate_scout_order
cd gate_scout_order
```
### 指定分支
```bash
git clone -b main https://git.bz121.com/dekun/gate_scout_order.git gate_scout_order
cd gate_scout_order
```
---
## 二、克隆后首次配置
两个子项目 **各自** 需要虚拟环境与 `config.yaml`(不要共用 `.venv`)。
### 扫描端
```bash
cd onchain_scout_gate
python -m venv .venv
```
Windows PowerShell
```powershell
.\.venv\Scripts\Activate.ps1
pip install -U pip
pip install -r requirements.txt
copy config.example.yaml config.yaml
```
Linux / macOS
```bash
source .venv/bin/activate
pip install -U pip
pip install -r requirements.txt
cp config.example.yaml config.yaml
```
编辑 `config.yaml` 后运行:`python run.py`
### 执行器
```bash
cd ../gate_order_executor
python -m venv .venv
```
同样激活 venv、`pip install -r requirements.txt``cp config.example.yaml config.yaml`,编辑后 `python run.py`
---
## 三、本机尚无远程仓库时
若当前只有本地文件夹、尚未 `git init`,可在 **`onchain_scout` 根目录** 执行:
```bash
cd /path/to/onchain_scout
git init
git add .
git commit -m "Initial commit: onchain_scout_gate + gate_order_executor"
```
在 GitHub / Gitee 创建 **空仓库**(不要勾选自动 README),再:
```bash
git branch -M main
git remote add origin <REPO_URL>
git push -u origin main
```
之后他人即可按 **第一节** 克隆。
---
## 四、更新已克隆的仓库
```bash
cd onchain_scout
git pull
```
若子项目依赖有变,分别在两个目录重新安装:
```bash
cd onchain_scout_gate && pip install -r requirements.txt
cd ../gate_order_executor && pip install -r requirements.txt
```
修改 `config.yaml` 后重启对应进程(如 `pm2 restart onchain-scout` / `pm2 restart gate-order-executor`)。
---
## 五、不应提交的文件
根目录 `.gitignore` 已忽略常见敏感与运行时文件,例如:
- 各子项目下的 `config.yaml`(保留 `config.example.yaml`
- `.venv/``__pycache__/`
- `runtime/` 下日志、SQLite、`order_executors.json`
克隆后 **必须** 自行复制 example 配置并填写密钥,否则服务无法正常工作。
---
## 六、两个独立仓库(可选,非默认)
若你希望扫描端与执行器 **分开版本管理**,可拆成两个远程仓库;联动时仍通过 HTTP + 相同 `webhook_secret` 对接。
**当前推荐布局为 monorepo**,面板多执行器列表、归档文档均按此结构编写。
拆仓后克隆方式示例:
```bash
git clone <SCOUT_REPO_URL> onchain_scout_gate
git clone <EXECUTOR_REPO_URL> gate_order_executor
mkdir onchain_scout && mv onchain_scout_gate gate_order_executor onchain_scout/
```
需自行保证目录结构与本文一致,以便对照 [README.md](README.md) 部署。
---
## 七、相关文档
| 文档 | 说明 |
|------|------|
| [README.md](README.md) | 总览、端口、快速开始 |
| [onchain_scout_gate/交易系统部署说明.md](onchain_scout_gate/交易系统部署说明.md) | 扫描端 PM2 / 云部署 |
| [gate_order_executor/docs/部署说明.md](gate_order_executor/docs/部署说明.md) | 执行器 PM2 / 云部署 |