将 note 笔记库同步到 note_sync,AI_compiler 作为 submodule
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
# Gitea 部署指南
|
||||
|
||||
> 2026-08-13 记录。自托管轻量 Git 服务,个人代码仓库,Web 用 Caddy 反代套 HTTPS。域名域名 `git.hyonglin.top`。
|
||||
|
||||
---
|
||||
|
||||
## 选型
|
||||
|
||||
| 方案 | 是否选用 | 原因 |
|
||||
|---|---|---|
|
||||
| **Gitea** | ✅ | Go 单二进制,轻量(~50–100MB),功能全(仓库/Issue/PR/Actions/Package),社区活跃、安全更新及时 |
|
||||
| Gogs | ❌ | Gitea 的 fork 前身,开发停滞,新项目不推荐 |
|
||||
| 裸仓库+SSH | ❌ | 无 Web 界面 |
|
||||
|
||||
> Gitea 是 Gogs 的 fork(社区驱动),新项目无脑选 Gitea;若更在意「纯社区治理」可选 Forgejo。
|
||||
|
||||
---
|
||||
|
||||
## docker-compose 服务
|
||||
|
||||
`silverbullet/docker-compose.yml`:
|
||||
|
||||
```yaml
|
||||
gitea:
|
||||
image: gitea/gitea:latest
|
||||
container_name: gitea
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- USER_UID=1000
|
||||
- USER_GID=1000
|
||||
- GITEA__server__ROOT_URL=https://git.hyonglin.top/
|
||||
- GITEA__server__DOMAIN=git.hyonglin.top
|
||||
- GITEA__server__SSH_DOMAIN=git.hyonglin.top
|
||||
- GITEA__server__SSH_PORT=2222
|
||||
ports:
|
||||
- "2222:22" # SSH clone 用(服务器 22 已被 SSH 占用,故映射 2222)
|
||||
volumes:
|
||||
- ./gitea:/data
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
```
|
||||
|
||||
- Web(3000)不映射端口,由 Caddy 反代 `gitea:3000`
|
||||
- SSH 需映射 `2222:22`,因为宿主机 22 被 OpenSSH 占用
|
||||
|
||||
## Caddy 反代
|
||||
|
||||
`silverbullet/Caddyfile` 加一段:
|
||||
|
||||
```caddyfile
|
||||
# Git 服务
|
||||
git.hyonglin.top {
|
||||
tls {
|
||||
dns cloudflare {env.CF_API_TOKEN}
|
||||
}
|
||||
reverse_proxy gitea:3000
|
||||
}
|
||||
```
|
||||
|
||||
## compose 部署
|
||||
|
||||
```bash
|
||||
docker compose up -d gitea
|
||||
docker compose up -d --force-recreate caddy # 让 caddy 加载新站点
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 首次安装(web 向导)
|
||||
|
||||
打开 `https://git.hyonglin.top` 走安装向导:
|
||||
|
||||
- **数据库**:默认 `SQLite3`(个人用足够)
|
||||
- **域名/URL**:环境变量已预设(`git.hyonglin.top`),保持默认
|
||||
- **SSH 端口**:`2222`
|
||||
- **管理员账号**:设置用户名/邮箱/密码
|
||||
- 点「安装 Gitea」
|
||||
|
||||
验证安装完成:
|
||||
|
||||
```bash
|
||||
# app.ini 应已锁定安装
|
||||
grep INSTALL_LOCK /home/ubuntu/silverbullet/gitea/gitea/conf/app.ini # → true
|
||||
|
||||
# 确认管理员存在
|
||||
docker compose exec -T gitea su git -c "gitea admin user list"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 使用
|
||||
|
||||
- **Web**:登录 `https://git.hyonglin.top` 建仓库
|
||||
- **HTTPS clone**:`git clone https://git.hyonglin.top/用户名/仓库.git`
|
||||
- **SSH clone**:`git clone git@git.hyonglin.top:2222/用户名/仓库.git`(需安全组放行 TCP 2222)
|
||||
- **备份**:备份 `silverbullet/gitea` 目录(含数据库和所有仓库)
|
||||
|
||||
---
|
||||
|
||||
## 相关链接
|
||||
|
||||
- [[主页与Caddy反向代理]] — git.hyonglin.top 的 HTTPS 入口
|
||||
- [[frp内网穿透部署指南]] — 本服务器其他自建服务
|
||||
- [Gitea 官方文档](https://docs.gitea.com/zh-cn/)
|
||||
Reference in New Issue
Block a user