From cc62d128021ed393f190560297ffaa4a2c259290 Mon Sep 17 00:00:00 2001 From: yyamashita Date: Sun, 17 May 2026 11:09:01 +0900 Subject: Manage all server-side git hooks in this repository Add server-hooks//post-receive for all repos and scripts/install-hooks.sh to deploy them manually on the server. Hooks are not auto-installed on git push for security. Co-Authored-By: Claude Sonnet 4.6 --- Deploy.md | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'Deploy.md') diff --git a/Deploy.md b/Deploy.md index 3c6e89b..a03b2a3 100644 --- a/Deploy.md +++ b/Deploy.md @@ -52,13 +52,30 @@ ssh golive 'docker logs tokyo-app -f' ssh golive 'docker logs whois-app -f' ``` +## サーバーフック管理 + +各リポジトリの post-receive フック内容は `server-hooks//post-receive` で管理する。 +git push では**自動展開しない**(セキュリティ上の理由)。フックを更新したい場合は push 後に手動でインストールスクリプトを実行する。 + +```bash +# フックを更新した場合: push → サーバーで手動インストール +git push origin master +ssh root@localhost 'bash /app/infra/scripts/install-hooks.sh' +``` + +| ファイル | 役割 | +|---|---| +| `server-hooks//post-receive` | 各リポジトリのフック内容 | +| `scripts/install-hooks.sh` | `server-hooks/` を `/var/git/*/hooks/` に展開 | + ## 新アプリ追加手順 -1. `Caddyfile` にホスト追加 → `git push hetzner master` +1. `Caddyfile` にホスト追加 → `git push origin master` 2. 新アプリ側: `docker-compose.yml` で `external: true` の `web` network を使用、`container_name` を設定 3. 新アプリの bare repo をサーバに作成(`scripts/server-setup.sh` 参照) -4. `git remote add hetzner golive:/var/git/.git` -5. `git push hetzner master` +4. `server-hooks//post-receive` を作成して push +5. `ssh root@localhost 'bash /app/infra/scripts/install-hooks.sh'` +6. `git remote add hetzner golive:/var/git/.git` → `git push hetzner master` ## Claude Code セッション管理 -- cgit v1.2.3