Additions for bootstrapping gitlab.

This commit is contained in:
caes 2020-05-26 02:38:39 -04:00
parent 34ae3d2fb0
commit 925ec8d349
2 changed files with 172 additions and 53 deletions

View File

@ -86,6 +86,7 @@ done
program_root="$(\
cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd\
)"
self=${program_root}/broker.sh
stage_root="${program_root}/staging"
target_root=${ADAMOCOMP_HOME:-"/"}
config_dir=${ADAMOCOMP_CONFDIR:-"${program_root}"}
@ -228,6 +229,14 @@ get_remote_ssh_port () {
fi
}
get_remote_user () {
local user=$(get_data $* remote user)
if [[ -z $user ]]; then
user=$dealer
fi
echo $user
}
######################################################################
# Formatted printing and debug.
@ -325,6 +334,7 @@ install_environment_vars () {
}
set_npm_proxy () {
# Not relying on this at the moment.
:
#npm config set proxy http://some.proxy:83
#npm config set https-proxy http://some.proxy:83
@ -1004,9 +1014,10 @@ ssh_tty_to_host () {
if host_exists $host; then
local fqdn=$(get_remote_host $host)
local port=$(get_remote_ssh_port $host)
local user=$(get_remote_user $host)
local cmd="$*"
pr_vars fqdn port cmd
ssh -tt -o port=${port} ${dealer}@${fqdn} "$*"
pr_vars fqdn port user cmd
ssh -tt -o port=${port} ${user}@${fqdn} "$*"
fi
}
@ -1017,12 +1028,13 @@ scp_contents_to_host () {
if host_exists $1; then
local fqdn=$(get_remote_host $host)
local port=$(get_remote_ssh_port $host)
local user=$(get_remote_user $host)
pr_vars host fqdn port source_dir target_dir
if [[ $TESTING_MODE == "TRUE" ]]; then
:
else
scp -r -o port=${port} $source_dir/* \
"${dealer}@${fqdn}:${target_dir}/"
"${user}@${fqdn}:${target_dir}/"
fi
fi
}
@ -1034,12 +1046,13 @@ scp_to_host () {
if host_exists $1; then
local fqdn=$(get_remote_host $host)
local port=$(get_remote_ssh_port $host)
local user=$(get_remote_user $host)
pr_vars host fqdn port source_file target_dir
if [[ $TESTING_MODE == "TRUE" ]]; then
:
else
scp -o port=${port} $source_file\
"${dealer}@${fqdn}:${target_dir}/"
"${user}@${fqdn}:${target_dir}/"
fi
fi
@ -1062,7 +1075,7 @@ download_file () {
if [[ "$TESTING_MODE" == "TRUE" ]]; then
pr_vars ${fqdn_list[0]} filename
else
user=${dealer}
local user=$(get_remote_user $host)
pr_vars host
scp -o port="${ssh_port_list[0]}" \
"${user}@${fqdn_list[0]}:${filename}" ./
@ -1116,6 +1129,25 @@ execute_on_nodes () {
done
}
docker_run_from_data_on_host () {
local host=$1
shift
local dealkeypath="$*"
# env exported here since this is for bootstrapping
export_env
if construct_deal_info $dealkeypath; then
local docker_opts="$(docker_options_string $dealkeypath)"
pr_vars deal_name docker_image docker_opts
if [[ $TESTING_MODE == "TRUE" ]]; then
ssh_tty_to_host $host "echo docker run -d $docker_opts \
--name $deal_name $docker_image"
else
ssh_tty_to_host $host "docker run -d $docker_opts \
--name $deal_name $docker_image"
fi
fi
}
######################################################################
# Local automation
@ -1328,13 +1360,14 @@ remote_node_bootstrap () {
# Prepares nodes for dealing by installing software.
remote_node_init () {
construst_cluster_info $1
local user=$(get_remote_user $host)
execute_on_nodes \
"sudo mkdir -p $ADAMOCOMP_HOME;
sudo mkdir -p $ADAMOCOMP_CONFDIR;
sudo mkdir -p $GITLAB_HOME;
sudo chown -R ${dealer}:${dealer} $ADAMOCOMP_HOME;
sudo chown -R ${dealer}:${dealer} $ADAMOCOMP_CONFDIR;
sudo chown -R ${dealer}:${dealer} $GITLAB_HOME;
sudo chown -R ${user}:${user} $ADAMOCOMP_HOME;
sudo chown -R ${user}:${user} $ADAMOCOMP_CONFDIR;
sudo chown -R ${user}:${user} $GITLAB_HOME;
ls -lhd $ADAMOCOMP_HOME;
ls -lhd $ADAMOCOMP_CONFDIR;
ls -lhd $GITLAB_HOME;"
@ -1480,7 +1513,7 @@ install_on_nodes () {
${datatool} get "$* use_dockerfile"|jq -r '.[0]')
if [[ "$TESTING_MODE" == "TRUE" ]]; then
pr_vars uses_dockerfile maste
pr_vars uses_dockerfile master
fi
# Gating against dockerfile usage due to a bug.

174
data.json
View File

@ -46,13 +46,84 @@
"2222:22"
],
["--restart","always"],
["--hostname","gitlab.adamo.network"]
["--hostname","gitlab.adamo.network"],
[
"-e",
"GITLAB_OMNIBUS_CONFIG=\"external_url 'http://gitlab.adamo.network:45000'; gitlab_rails['gitlab_shell_ssh_port'] = 22\""
]
]
},
"suggest": [
"Running as a bootstrap."
]
},
"asciiflow": {
"repo": "apps/asciiflow.git",
"docker": {
"image": "fraoustin/asciiflow",
"options": [
[
"--publish",
"9000:80"
],
["--restart","always"]
]
}
},
"db-postgres": {
"repo": "sys/db-postgres.git",
"docker" :{
"image": "postgres",
"options": [
["--restart","always"],
["--hostname","postgres.adamo.network"],
["-e","POSTGRES_PASSWORD=giganticmetaphor"]
]
}
},
"adminer": {
"repo": "sys/adminer.git",
"docker": {
"image": "adminer",
"options": [
["--restart","always"],
["--hostname","adminer.adamo.network"],
[
"--publish",
"8080,8080"
]
]
}
},
"adamopad": {
"docker": {
"image": "etherpad/etherpad",
"options": [
["--restart","always"],
["--hostname","adminer.adamo.network"],
[
"--publish",
"9001,9001"
],
[
"-e",
"TITLE=Adamopad",
"DEFAULT_PAD_TEST='Adamopad for tsen-like sharings.'",
"ADMIN_PASSWORD='azxssfa'",
"PAD_OPTIONS_USE_MONOSPACE_FONT='true'",
"PAD_OPTIONS_USER_NAME='true'",
"PAD_OPTIONS_USER_COLOR='true'",
"SKIN_VARIANTS='super-dark-toolbar super-dark-editor super-dark-background'",
"DB_TYPE=postgres",
"DB_HOST=localhost",
"DB_PORT=5432",
"DB_NAME=adamopad",
"DB_USER=postgres",
"DB_PASS=giganticmetaphor"
]
]
}
},
"covid-data": {
"repo": "owid/covid-19-data/tree/master/public/data/ecdc",
"git_src": "https://github.com/",
@ -111,7 +182,7 @@
"remote": {
"host": "internum.adamonet",
"ports": {
"factorio": 49000
"factorio": 50002
}
},
"local": {
@ -127,7 +198,7 @@
"remote": {
"host": "internum.adamonet",
"ports": {
"factorio": 49001
"factorio": 50003
}
},
"local": {
@ -143,8 +214,8 @@
"remote": {
"host": "internum.adamonet",
"ports": {
"ssh": 40000,
"resilio-sync": 40001
"ssh": 22150,
"resilio-sync-panel": 40000
}
},
"local": {
@ -152,53 +223,68 @@
"ipv4": "192.168.6.150"
}
},
"syracusae": {
"remote": {
"host": "internum.adamonet",
"ports": {
"ssh": 46000,
"http": 46005
"sicilia": {
"syracusae": {
"remote": {
"host": "internum.adamonet",
"ports": {
"ssh": 22010,
"http": 8010
}
},
"local": {
"host": "syracusae.internum.adamonet",
"ipv4": "192.168.6.10"
}
},
"local": {
"host": "syracusae.internum.adamonet",
"ipv4": "192.168.6.10"
}
},
"melita": {
"remote": {
"host": "internum.adamonet",
"ports": {
"ssh": 46001
"melita": {
"remote": {
"host": "internum.adamonet",
"ports": {
"ssh": 22020
}
},
"local": {
"ipv4": "192.168.6.20",
"host": "melita.internum.adamonet"
}
},
"local": {
"ipv4": "192.168.6.20",
"host": "melita.internum.adamonet"
}
},
"factorarium": {
"remote": {
"host": "internum.adamonet",
"ports": {
"ssh": 46002
"factorarium": {
"remote": {
"host": "internum.adamonet",
"ports": {
"ssh": 22101
}
},
"local": {
"ipv4": "192.168.6.101",
"host": "factorarium.internum.adamonet"
}
},
"local": {
"ipv4": "192.168.6.101",
"host": "factorarium.internum.adamonet"
}
},
"dockerpad": {
"remote": {
"host": "internum.adamonet",
"ports": {
"ssh": 46003
"dockerpad": {
"remote": {
"host": "internum.adamonet",
"ports": {
"ssh": 22102
}
},
"local": {
"ipv4": "192.168.6.102",
"host": "dockerpad.internum.adamonet"
}
},
"local": {
"ipv4": "192.168.6.102",
"host": "dockerpad.internum.adamonet"
"acragas": {
"remote": {
"host": "internum.adamonet",
"ports": {
"ssh": 22104
},
"user": "rancher"
},
"local": {
"ipv4": "192.168.6.104",
"host": "acragas.internum.adamonet"
}
}
}
}