foxygit / foxygit Log in
A tiny read-only git web frontend — browse bare repos with just PHP and git, no database, no framework.
commits tags

/install.sh · 1.46 KB

raw
#!/usr/bin/env bash
# Full install, from zero: git hosting over SSH + foxygit as the web viewer.
#
# Run as root:
#   sudo bash /home/mrfox/foxygit/install.sh
#
# Runs, in order:
#   1. server/setup-server.sh -- creates the `git` user, bare-repo storage
#      at /var/git/repos, and the self-serve `create` command over SSH.
#   2. deploy.sh -- php-fpm pool (running as `git`, so it can read the bare
#      repos) + the git.kristoffersson.info Caddy block + reload.
#
# Both scripts are idempotent, so this is also safe to re-run (e.g. after
# editing index.php -- though for that alone, just re-copying index.php to
# /var/www/foxygit/ is enough, no reload needed).

set -euo pipefail

if [ "$(id -u)" -ne 0 ]; then
    echo "run as root: sudo bash $0" >&2
    exit 1
fi

ROOT="$(cd "$(dirname "$0")" && pwd)"

echo "############################################"
echo "# 1/2  git hosting (SSH server)"
echo "############################################"
bash "$ROOT/server/setup-server.sh"

echo
echo "############################################"
echo "# 2/2  foxygit (web viewer)"
echo "############################################"
bash "$ROOT/deploy.sh"

cat <<'EOF'

############################################
All done.

  - Add SSH keys for people who push:  sudo bash server/add-key.sh
  - Create a repo (as a keyholder):    ssh git@<host> create <reponame>
  - Browse:                            https://git.kristoffersson.info/
############################################
EOF