summaryrefslogtreecommitdiff
path: root/scripts/server-setup.sh
blob: bfcab5962329201e4a28bb30b7a7b14e68350df3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# Run once on the Hetzner VPS (as root) after hetzner-infra setup
set -e

APP_DIR=/app/tokyo-livehouse-events
REPO_DIR=/var/git/tokyo-livehouse-events.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/tokyo-livehouse-events
GIT_WORK_TREE=$APP_DIR git checkout -f
cd $APP_DIR
mkdir -p data
docker compose up -d --build
echo "Deploy complete: tokyo-livehouse-events"
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"