From ef6dbdd2ac273dc4a01c70437ee7984cea9f2a3c Mon Sep 17 00:00:00 2001 From: yyamashita Date: Sun, 17 May 2026 11:29:27 +0900 Subject: Reorganize repo into caddy/, git/, claude/ directories - caddy/: Caddyfile, docker-compose.yml, deploy.sh (hook runs this only) - git/: repos.txt, hooks/*/post-receive, install.sh, server-setup.sh - claude/: sessions.txt, systemd/claude-code@.service, sync.sh Post-receive hook is now: checkout + bash caddy/deploy.sh Co-Authored-By: Claude Sonnet 4.6 --- git/server-setup.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 git/server-setup.sh (limited to 'git/server-setup.sh') diff --git a/git/server-setup.sh b/git/server-setup.sh new file mode 100755 index 0000000..a575628 --- /dev/null +++ b/git/server-setup.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# Run once on a fresh Hetzner VPS (as root). +# hetzner-infra のみブートストラップとして作成する。 +# 他のリポジトリは最初の push 後に git/install.sh が作成する。 +set -e + +REPO_DIR=/var/git/hetzner-infra.git +APP_DIR=/app/infra + +curl -fsSL https://get.docker.com | sh +docker network create web || true + +mkdir -p "$REPO_DIR" "$APP_DIR" +git init --bare "$REPO_DIR" + +# 最初の push を受け取るための最小限のフック(git/install.sh 実行後に上書きされる) +cat > "$REPO_DIR/hooks/post-receive" << 'HOOK' +#!/bin/bash +set -e +GIT_WORK_TREE=/app/infra git checkout -f +bash /app/infra/caddy/deploy.sh +echo "Deploy complete: hetzner-infra" +HOOK +chmod +x "$REPO_DIR/hooks/post-receive" + +echo "" +echo "Next steps:" +echo " 1. git remote add origin root@:$REPO_DIR" +echo " 2. git push origin master" +echo " 3. ssh root@ 'bash $APP_DIR/git/install.sh'" -- cgit v1.2.3