diff --git a/broker.sh b/broker.sh index f5a36c1..c464aa2 100755 --- a/broker.sh +++ b/broker.sh @@ -376,6 +376,10 @@ apt_update () { sudo apt update -y } +install_docker () { + curl -sSL https://get.docker.com/ | sh +} + install_prereqs () { if [[ ! -x /usr/bin/jq ]]; then sudo apt install jq @@ -643,6 +647,18 @@ git_list_dirs_under () { find $1 -type d -a -name '.git' } +###################################################################### +# Gitlab operations + +gitlab_download_backups () { + scp rancher@gitlab.adamo.network:~/* . +} + +gitlab_container_backup () { + docker exec -it gitlab gitlab-rake gitlab:backup:create + sudo tar cf gitlab-secrets.tar /opt/gitlab/config/ +} + gitlab_get_token () { cat ${program_root}/gitlab_read.pat } @@ -1295,14 +1311,23 @@ execute_on_nodes () { done } +# $1: host deal +# $2: command +# $3: docker deal +docker_exec_on_host () { + local host="$1"; shift + local cmd="$1"; shift + local dealkeypath="$*" + pr_vars host cmd dealkeypath + if construct_deal_info $dealkeypath; then + ssh_tty_to_host $host "docker exec -it $deal_name \"${cmd}\"" + fi +} + # $1: host deal # $2: docker deal docker_bash_on_host () { - local host=$1; shift - local dealkeypath="$*" - if construct_deal_info $dealkeypath; then - ssh_tty_to_host $host "docker exec -it $deal_name /bin/bash" - fi + docker_exec_on_host $1 "/bin/bash" "${@:2}" } docker_run_from_data_on_host () {