diff options
| author | yyamashita <yyamashita@hetzner.yyamashita.com> | 2026-05-17 11:18:12 +0900 |
|---|---|---|
| committer | yyamashita <yyamashita@hetzner.yyamashita.com> | 2026-05-17 11:18:12 +0900 |
| commit | b6efad84b51c6df5f595683d66b855c75bddabc4 (patch) | |
| tree | b12d164613032105a05e871f7b2e0871b51ea658 /Deploy.md | |
| parent | fa882598d3ee6bff4e32892a81b6b2712eb8c11d (diff) | |
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 <noreply@anthropic.com>
Diffstat (limited to 'Deploy.md')
| -rw-r--r-- | Deploy.md | 33 |
1 files changed, 17 insertions, 16 deletions
@@ -52,30 +52,31 @@ 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' -``` +ベアリポジトリ・ワークツリー・フックはすべてこのリポジトリで一元管理する。 +git push では**自動展開しない**(セキュリティ上の理由)。変更後は手動で `install.sh` を実行する。 | ファイル | 役割 | |---|---| +| `repos.txt` | 全リポジトリの定義(`name:work-tree` 形式) | | `server-hooks/<repo>/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/<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` +1. `repos.txt` に `<name>:<work-tree>` を追記 +2. `server-hooks/<name>/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/<name>.git` → `git push hetzner master` ## Claude Code セッション管理 |
