diff options
| -rw-r--r-- | CLAUDE.md | 9 | ||||
| -rw-r--r-- | Deploy.md | 2 | ||||
| -rw-r--r-- | cgit/Dockerfile | 5 | ||||
| -rw-r--r-- | cgit/deploy.sh | 2 | ||||
| -rw-r--r-- | cgit/docker-compose.yml | 2 | ||||
| -rw-r--r-- | cgit/lighttpd.conf | 15 |
6 files changed, 31 insertions, 4 deletions
@@ -6,6 +6,7 @@ Hetzner VPS 上で動くサービス群のインフラ管理リポジトリ。 ``` caddy/ リバースプロキシ(Caddyfile, docker-compose.yml, deploy.sh) +cgit/ cgit Web UI(Dockerfile, lighttpd.conf, cgitrc, deploy.sh) git/ ベアリポジトリ・フック管理(repos.txt, hooks/, install.sh) claude/ Claude Code セッション管理(sessions.txt, systemd unit, sync.sh) server/ サーバー共通設定(authorized_keys, requirements.md) @@ -13,7 +14,9 @@ server/ サーバー共通設定(authorized_keys, requirements.md) ## デプロイの仕組み -- `git push origin master` → post-receive フック → `caddy/deploy.sh` だけ実行 +- `git push origin master` → post-receive フック → `caddy/deploy.sh` と `cgit/deploy.sh` を実行 +- cgit の `lighttpd.conf` / `Dockerfile` 変更はイメージ再ビルドが必要(`deploy.sh` で `--build` するため push だけで反映される) +- cgit の `cgitrc` はボリュームマウントのため push だけで反映される - フック・リポジトリの変更は push 後に `bash /app/infra/git/install.sh` を手動実行 - Claude セッションの変更は push 後に `bash /app/infra/claude/sync.sh` を手動実行 @@ -33,6 +36,10 @@ server/ サーバー共通設定(authorized_keys, requirements.md) # Caddy 設定変更 vi caddy/Caddyfile && git push origin master +# cgit 設定変更(lighttpd.conf / cgitrc) +vi cgit/lighttpd.conf # または cgit/cgitrc +git push origin master # --build 付きで自動再デプロイ + # フック・リポジトリ定義変更 vi git/hooks/.../post-receive # または git/repos.txt git push origin master @@ -17,7 +17,7 @@ ssh root@<server-ip> 'bash /app/infra/git/install.sh' ## 通常デプロイ ```bash -git push origin master # Caddy 設定・コンテナ更新 +git push origin master # Caddy 設定・cgit コンテナ更新(自動再ビルド含む) ``` ## フック / リポジトリ定義を変更した場合 diff --git a/cgit/Dockerfile b/cgit/Dockerfile new file mode 100644 index 0000000..dabdfd7 --- /dev/null +++ b/cgit/Dockerfile @@ -0,0 +1,5 @@ +FROM alpine:3.19 +RUN apk add --no-cache cgit lighttpd highlight +COPY lighttpd.conf /etc/lighttpd/lighttpd.conf +EXPOSE 80 +CMD ["lighttpd", "-D", "-f", "/etc/lighttpd/lighttpd.conf"] diff --git a/cgit/deploy.sh b/cgit/deploy.sh index f8b3f40..276b188 100644 --- a/cgit/deploy.sh +++ b/cgit/deploy.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash set -euo pipefail cd "$(dirname "$0")" -docker compose up -d +docker compose up -d --build diff --git a/cgit/docker-compose.yml b/cgit/docker-compose.yml index 5e59177..a93aa22 100644 --- a/cgit/docker-compose.yml +++ b/cgit/docker-compose.yml @@ -1,6 +1,6 @@ services: cgit: - image: klakegg/cgit:alpine + build: . container_name: cgit volumes: - ./cgitrc:/etc/cgitrc:ro diff --git a/cgit/lighttpd.conf b/cgit/lighttpd.conf new file mode 100644 index 0000000..1ce38cc --- /dev/null +++ b/cgit/lighttpd.conf @@ -0,0 +1,15 @@ +server.document-root = "/usr/share/webapps/cgit" +server.port = 80 + +server.modules = ( + "mod_cgi", + "mod_rewrite", +) + +index-file.names = ("cgit.cgi") +cgi.assign = (".cgi" => "") + +url.rewrite-once = ( + "^/(cgit\.css|cgit\.js|cgit\.png|cgit-favicon\.png)$" => "/$1", + "^(/[^?]*)(?:\?(.*))?$" => "/cgit.cgi?url=$1&$2" +) |
