新增 CT124 Gitea 操作手冊
操作/clone/資料位置;備份改用 gitea dump(含 DB),並註記開放註冊。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
65
CT124_Gitea操作手冊_20260622.md
Normal file
65
CT124_Gitea操作手冊_20260622.md
Normal file
@@ -0,0 +1,65 @@
|
||||
# CT124 Gitea(自架 Git 服務)— 操作手冊
|
||||
|
||||
> 主機:CT124(192.168.42.124,Ubuntu 24.04 LXC) | 位置:`/opt/gitea`
|
||||
> 用途:自架 Git 託管(本 `42_124` repo 即放在此:`http://192.168.42.124:31337/timmy/42_124`)
|
||||
|
||||
---
|
||||
|
||||
## 一、基本資訊
|
||||
|
||||
- 版本:**Gitea 1.25.4** + **PostgreSQL 14**(`gitea/gitea:latest`、`postgres:14`)
|
||||
- 容器:`gitea`、`gitea-db-1`(皆 `restart: always`,共用內網 `gitea`)
|
||||
- 埠:`31337 → 3000`(Web)、`31338 → 22`(Git over SSH)
|
||||
- 對外:**僅 LAN**(`git/gitea.lotimmy.com` 皆不解析,`ROOT_URL=http://192.168.42.124:31337/`)
|
||||
- 註冊:`DISABLE_REGISTRATION = false` → **開放註冊**(見注意事項)
|
||||
|
||||
## 二、操作
|
||||
|
||||
```bash
|
||||
cd /opt/gitea
|
||||
./start.sh # = docker-compose up -d
|
||||
./stop.sh # = docker-compose down
|
||||
docker compose logs -f
|
||||
docker compose restart
|
||||
```
|
||||
|
||||
## 三、存取與 clone
|
||||
|
||||
```bash
|
||||
# Web
|
||||
http://192.168.42.124:31337
|
||||
|
||||
# HTTP clone
|
||||
git clone http://192.168.42.124:31337/<user>/<repo>.git
|
||||
|
||||
# SSH clone(注意走 31338,非 22)
|
||||
git clone ssh://git@192.168.42.124:31338/<user>/<repo>.git
|
||||
```
|
||||
|
||||
## 四、資料與設定
|
||||
|
||||
| 項目 | 位置 / 值 |
|
||||
|---|---|
|
||||
| Gitea 應用資料(repos/config/上傳) | `./data`(→ 容器 `/data`) |
|
||||
| 設定檔 | `./data/gitea/conf/app.ini` |
|
||||
| PostgreSQL 資料 | `./postgres` |
|
||||
| DB 連線 | `db:5432`,gitea/gitea(內網,環境變數帶入) |
|
||||
|
||||
## 五、備份
|
||||
|
||||
> ⚠️ **舊 README 只 `tar data/` 不夠** —— 現在中繼資料在 PostgreSQL,光打包 `data/` 會缺 DB,
|
||||
> 且對運行中的 `postgres/` 直接 tar 不保證一致。正確做法用 Gitea 內建 dump:
|
||||
|
||||
```bash
|
||||
# 產出含 repos + DB + 設定的單一壓縮檔(寫到容器 /data,即 host ./data)
|
||||
docker exec -u git gitea gitea dump -c /data/gitea/conf/app.ini
|
||||
# 取出
|
||||
mv /opt/gitea/data/gitea-dump-*.zip /opt/gitea/
|
||||
```
|
||||
(`gitea-backup-20260309.tar.gz` 是早期的 `tar data/` 手動備份,僅供參考。)
|
||||
|
||||
## 六、注意事項
|
||||
|
||||
- **開放註冊**:`DISABLE_REGISTRATION = false`,任何能連到 `:31337` 的人都能註冊帳號。雖僅 LAN,要鎖就在 `app.ini` 設 `DISABLE_REGISTRATION = true` 後 `docker compose restart`。
|
||||
- SSH clone 必須用 **31338**;app.ini 的 `SSH_PORT = 22` 是容器內埠,Gitea 介面產生的 clone URL 可能顯示 22,手動改成 31338。
|
||||
- `/opt/gitea` 自身是個 git repo(有自己的 `push.sh`/`CLAUDE.md`),其 remote 與 post-receive hook 是該部署目錄的設定,與使用者 repo 無關。
|
||||
@@ -14,3 +14,4 @@ Claude Code 工作規範見 [`CLAUDE.md`](CLAUDE.md)。
|
||||
| [CT124_Jellyfin播放-11850_20260622.md](CT124_Jellyfin播放-11850_20260622.md) | CT124 | iOS 原生 AVPlayer 播 AC3-in-fMP4 報 `-11850`,關「原生播放器」即解;伺服器無誤 |
|
||||
| [CT124_Registry操作手冊_20260622.md](CT124_Registry操作手冊_20260622.md) | CT124 | 私有 Docker Registry(`registry.lotimmy.com` / UI)推拉、刪除回收、維運說明 |
|
||||
| [CT124_Browserless操作手冊_20260622.md](CT124_Browserless操作手冊_20260622.md) | CT124 | 自架 headless Chromium(`:13000`,僅 LAN)截圖/PDF/抓取/Puppeteer 端點與維運 |
|
||||
| [CT124_Gitea操作手冊_20260622.md](CT124_Gitea操作手冊_20260622.md) | CT124 | 自架 Gitea(`:31337` Web / `:31338` SSH,本 repo 的家)操作、clone、備份、設定 |
|
||||
|
||||
Reference in New Issue
Block a user