diff options
| author | yyamashita <yyamashita@hetzner.yyamashita.com> | 2026-05-17 11:09:01 +0900 |
|---|---|---|
| committer | yyamashita <yyamashita@hetzner.yyamashita.com> | 2026-05-17 11:09:01 +0900 |
| commit | cc62d128021ed393f190560297ffaa4a2c259290 (patch) | |
| tree | bbfc4bab499db0770b0b37fdad39031dcd7ab75c /Deploy.md | |
| parent | b836174d5ad5e4ea36a5f456061a00862317375f (diff) | |
Manage all server-side git hooks in this repository
Add server-hooks/<repo>/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 <noreply@anthropic.com>
Diffstat (limited to 'Deploy.md')
| -rw-r--r-- | Deploy.md | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -52,13 +52,30 @@ ssh golive 'docker logs tokyo-app -f' ssh golive 'docker logs whois-app -f' ``` +## サーバーフック管理 + +各リポジトリの post-receive フック内容は `server-hooks/<repo>/post-receive` で管理する。 +git push では**自動展開しない**(セキュリティ上の理由)。フックを更新したい場合は push 後に手動でインストールスクリプトを実行する。 + +```bash +# フックを更新した場合: push → サーバーで手動インストール +git push origin master +ssh root@localhost 'bash /app/infra/scripts/install-hooks.sh' +``` + +| ファイル | 役割 | +|---|---| +| `server-hooks/<repo>/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/<name>.git` -5. `git push hetzner master` +4. `server-hooks/<new-repo>/post-receive` を作成して push +5. `ssh root@localhost 'bash /app/infra/scripts/install-hooks.sh'` +6. `git remote add hetzner golive:/var/git/<name>.git` → `git push hetzner master` ## Claude Code セッション管理 |
