summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/server-setup.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/scripts/server-setup.sh b/scripts/server-setup.sh
new file mode 100755
index 0000000..f01d3fb
--- /dev/null
+++ b/scripts/server-setup.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+# Run this once on a fresh Hetzner VPS (as root)
+set -e
+
+APP_DIR=/app
+REPO_DIR=/var/git/tokyo-livehouse-events.git
+
+# Install Docker
+curl -fsSL https://get.docker.com | sh
+
+# Create app directory
+mkdir -p "$APP_DIR"
+
+# Create bare git repo
+mkdir -p "$REPO_DIR"
+git init --bare "$REPO_DIR"
+
+# Create post-receive hook
+cat > "$REPO_DIR/hooks/post-receive" << 'EOF'
+#!/bin/bash
+set -e
+APP_DIR=/app
+GIT_WORK_TREE=$APP_DIR git checkout -f
+cd $APP_DIR
+mkdir -p data
+docker compose up -d --build
+echo "Deploy complete"
+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 main"