krz/gitbay
A CLI-first git forge.
clone: git clone https://gitbay.org/krz/gitbay.git
1#!/bin/sh
2# Push the gitbayd binary to a freshly cloud-inited host and start it.
3# Usage: deploy/install.sh <host-or-ip> [ssh-port]
4set -eu
5host=${1:?usage: install.sh <host-or-ip> [ssh-port]}
6port=${2:-2222}
7bin=dist/gitbayd-linux-amd64
8
9[ -f "$bin" ] || { echo "build first: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $bin ./cmd/gitbayd" >&2; exit 1; }
10
11scp -P "$port" "$bin" "root@$host:/usr/local/bin/gitbayd.new"
12ssh -p "$port" "root@$host" '
13 set -eu
14 chmod 755 /usr/local/bin/gitbayd.new
15 mv /usr/local/bin/gitbayd.new /usr/local/bin/gitbayd
16 /usr/local/bin/gitbayd --config /etc/gitbay/config.toml check-config --no-host-checks
17 systemctl restart gitbayd
18 sleep 1
19 systemctl --no-pager --lines=5 status gitbayd
20'