repositories / bugabinga.net
bugabinga.net
personal infrastructure for bugabinga!
owned by admin
scripts/local/deploy.sh
Raw#!/usr/bin/env bash
set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
usage() {
echo "usage: deploy.sh luci-image [HOST [PORT]] | quest-log-image [HOST [PORT [CONTEXT]]]" >&2
exit 2
}
target="${1:-}"
[[ -n "${target}" ]] || usage
shift
case "${target}" in
luci-image)
[[ "$#" -le 2 ]] || usage
exec "${repo_root}/scripts/local/load-luci-image.sh" "${1:-klops}" "${2:-22}"
;;
quest-log-image)
[[ "$#" -le 3 ]] || usage
host="${1:-klops}"
port="${2:-22}"
context="${3:-${repo_root}/../quest-log/trunk}"
user="${KLOPS_USER:-oli}"
image="${QUEST_LOG_IMAGE:-ghcr.io/bugabinga/quest-log:0.0.0}"
"${repo_root}/scripts/local/build-remote-image.sh" "${host}" "${port}" "${user}" "${image}" "${context}"
exec "${repo_root}/scripts/local/klops.sh" run-remote "${host}" "${port}" "${user}" "${repo_root}/scripts/remote/restart-quest-log.sh"
;;
*)
echo "unknown deployment target: ${target}" >&2
usage
;;
esac