diff options
| author | yyamashita <yyamashita@mosquit.one> | 2026-05-08 23:46:46 +0900 |
|---|---|---|
| committer | yyamashita <yyamashita@mosquit.one> | 2026-05-08 23:46:46 +0900 |
| commit | 859e6d8ed530daac1180c7b03182d9389be084dc (patch) | |
| tree | 98c6596fefade6a7b06088e7b32ce8bb5e83f2f7 /scripts | |
| parent | 7682cdb089d606b6ef2c091a545878007e8fe2d6 (diff) | |
Add Dockerfile and server-setup.sh for git push auto-deploy
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/server-setup.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/server-setup.sh b/scripts/server-setup.sh new file mode 100644 index 0000000..f510fab --- /dev/null +++ b/scripts/server-setup.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# Run once on the Hetzner VPS (as root) after hetzner-infra setup +set -e + +APP_DIR=/app/whois-band +REPO_DIR=/var/git/whois-band.git + +mkdir -p "$APP_DIR" + +mkdir -p "$REPO_DIR" +git init --bare "$REPO_DIR" + +cat > "$REPO_DIR/hooks/post-receive" << 'EOF' +#!/bin/bash +set -e +APP_DIR=/app/whois-band +GIT_WORK_TREE=$APP_DIR git checkout -f +cd $APP_DIR +mkdir -p data +docker compose up -d --build +echo "Deploy complete: whois-band" +EOF + +chmod +x "$REPO_DIR/hooks/post-receive" + +echo "" +echo "Setup complete. On your local machine, run:" +echo " git remote add hetzner root@<server-ip>:$REPO_DIR" +echo " git push hetzner master" |
