summaryrefslogtreecommitdiff
path: root/deploy/buildbot/master/install.sh
blob: a94ab9621fee03dac3a0daf635fef100093127e9 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
# BuildBot master installer - RUN ON 192.168.3.110 as root.
# Budget: 512MB RAM / 3GB disk (lean: sqlite, no extras beyond base plugins).
set -euo pipefail

DEST=${DEST:-/opt/kukuri-buildbot}
PY=${PY:-python3}

"$PY" -m venv "$DEST/venv"
"$DEST/venv/bin/pip" install --upgrade pip >/dev/null
"$DEST/venv/bin/pip" install buildbot "buildbot-www" "buildbot-waterfall-view" "buildbot-console-view" "buildbot-grid-view"

mkdir -p "$DEST"
cp master.cfg "$DEST/master.cfg"

if [ ! -f /etc/kukuri-buildbot.env ]; then
  read -rp "git password for ketsuban: " GPASS
  WPASS=$(openssl rand -hex 12)
  # Write git credentials file so the URL doesn't embed a password
  HOME="$DEST" git config --global credential.helper store
  cat > "$DEST/.git-credentials" << EOF
http://ketsuban:$GPASS@192.168.3.110
EOF
  chmod 600 "$DEST/.git-credentials"
  cat > /etc/kukuri-buildbot.env << EOF
WORKER_PASS=$WPASS
EOF
  chmod 600 /etc/kukuri-buildbot.env
  echo ""
  echo "==============================================================="
  echo "Put this WORKER_PASS on the builder host:"
  echo "  mkdir -p /root/buildbot/secrets"
  echo "  echo -n '$WPASS' > /root/buildbot/secrets/worker_pass"
  echo "==============================================================="
fi

cp kukuri-buildbot.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable --now kukuri-buildbot
sleep 3
systemctl --no-pager status kukuri-buildbot | head -5 || true
echo "Web UI: http://192.168.3.110:8010/"