From b6efad84b51c6df5f595683d66b855c75bddabc4 Mon Sep 17 00:00:00 2001 From: yyamashita Date: Sun, 17 May 2026 11:18:12 +0900 Subject: Centralize repo and hook management: add repos.txt and install.sh All bare repo creation is now driven by repos.txt in this repo. install.sh replaces install-hooks.sh and handles both repo creation and hook deployment. Other repos' server-setup.sh no longer manage bare repos or hooks. Co-Authored-By: Claude Sonnet 4.6 --- Deploy.md | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'Deploy.md') diff --git a/Deploy.md b/Deploy.md index a03b2a3..5faaf67 100644 --- a/Deploy.md +++ b/Deploy.md @@ -52,30 +52,31 @@ 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' -``` +ベアリポジトリ・ワークツリー・フックはすべてこのリポジトリで一元管理する。 +git push では**自動展開しない**(セキュリティ上の理由)。変更後は手動で `install.sh` を実行する。 | ファイル | 役割 | |---|---| +| `repos.txt` | 全リポジトリの定義(`name:work-tree` 形式) | | `server-hooks//post-receive` | 各リポジトリのフック内容 | -| `scripts/install-hooks.sh` | `server-hooks/` を `/var/git/*/hooks/` に展開 | +| `scripts/install.sh` | ベアリポジトリ作成 + フック展開(要 root) | +| `scripts/server-setup.sh` | 初回のみ: Docker + hetzner-infra ブートストラップ | + +```bash +# 変更を反映する場合 +git push origin master +ssh root@localhost 'bash /app/infra/scripts/install.sh' +``` ## 新アプリ追加手順 -1. `Caddyfile` にホスト追加 → `git push origin master` -2. 新アプリ側: `docker-compose.yml` で `external: true` の `web` network を使用、`container_name` を設定 -3. 新アプリの bare repo をサーバに作成(`scripts/server-setup.sh` 参照) -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` +1. `repos.txt` に `:` を追記 +2. `server-hooks//post-receive` を作成 +3. `Caddyfile` にホスト追加 +4. `git push origin master` → `ssh root@localhost 'bash /app/infra/scripts/install.sh'` +5. 新アプリ側: `git remote add hetzner root@localhost:/var/git/.git` → `git push hetzner master` ## Claude Code セッション管理 -- cgit v1.2.3