Commit 0f2d0590 authored by Alain Takoudjou's avatar Alain Takoudjou

software/gitlab: gitaly need to be started for backup restoration

See merge request !1707
parents 3ec53860 ffd4c301
......@@ -58,7 +58,7 @@ md5sum = 35bb9f1d8f4fd6675bd768d8a7e1253c
[instance-gitlab-export.cfg.in]
_update_hash_filename_ = instance-gitlab-export.cfg.in
md5sum = c8231583d04bf0d3fe2d26230b94d78d
md5sum = 330e1b13f793303e069ec8b7b8c882ea
[macrolib.cfg.in]
_update_hash_filename_ = macrolib.cfg.in
......@@ -82,7 +82,7 @@ md5sum = b1becd9ec4c2eeefe573af4bb53c9751
[template-gitlab-resiliency-restore.sh.in]
_update_hash_filename_ = template/template-gitlab-resiliency-restore.sh.in
md5sum = 8ce31a27e814e750dfd38c92a278fb9e
md5sum = c1b5f7ab33de40f301fa6931f84999a1
[puma.rb.in]
_update_hash_filename_ = template/puma.rb.in
......
......@@ -76,6 +76,8 @@ context =
raw redis_script ${service-redis:wrapper}
raw puma_script ${service-puma:wrapper-path}
raw sidekiq_script ${service-sidekiq:wrapper-path}
raw gitaly_script ${service-gitaly:wrapper-path}
raw gitaly_pid_file ${gitaly:pid}
raw gitlab_backup_dir ${gitlab-backup-directory:backup-gitlab.git}
raw redis_pid_file ${service-redis:pid-file}
raw postgres_pid_file ${service-postgresql:pgdata-directory}/postmaster.pid
......
......@@ -30,6 +30,8 @@ puma_script="{{ puma_script }}"
puma_pid_file="{{ puma_pid_file }}"
sidekiq_script="{{ sidekiq_script }}"
var_location="{{ var_directory }}"
gitaly_script="{{ gitaly_script }}"
gitaly_pid_file="{{ gitaly_pid_file }}"
# export GIT_EXEC_PATH=$git_location/libexec/git-core/
......@@ -57,6 +59,7 @@ kill_process () {
check_process $postgres_pid_file "Postgres"
check_process $redis_pid_file "Redis"
check_process $puma_pid_file "Puma"
check_process $gitaly_pid_file "Gitaly"
if [ -f "$postgres_pid_file" ]; then
rm $postgres_pid_file
......@@ -66,7 +69,7 @@ fi
# restoration will created them at every run
echo "Cleanup gitlab backup and old repositories folders..."
rm -rf $var_location/backup/*
rm -rf $var_location/repositories*
rm -rf $var_location/repositories.*
echo "Starting Postgres..."
$postgres_executable &
......@@ -77,6 +80,20 @@ echo "Starting Redis server..."
$redis_executable &
redis_pid=$!
trap "kill $postgres_pid $redis_pid" EXIT TERM INT
echo "Starting gitaly service..."
$gitaly_script &
gitaly_pid=$!
trap "kill $gitaly_pid $postgres_pid $redis_pid" EXIT TERM INT
echo "Starting Puma"
$puma_script &
puma_pid=$!
trap "kill $gitaly_pid $postgres_pid $redis_pid $puma_pid" EXIT TERM INT
# wait until Puma is started and pid file exists
sleep 200
if [ -s "$puma_pid_file" ]; then
puma_pid=$(head -n 1 $puma_pid_file) > /dev/null 2>&1
trap "kill $postgres_pid $redis_pid $puma_pid" EXIT TERM INT
fi
echo "[OK]"
echo "Restoring gitlab data..."
......@@ -90,15 +107,7 @@ echo "Checking gitlab promises..."
echo "[info] Not all promises are checked!"
$promise_check/gitlab-app
echo "Starting Puma to check gitlab-shell promise..."
$puma_script &
puma_pid=$!
trap "kill $postgres_pid $redis_pid $puma_pid" EXIT TERM INT
sleep 60
if [ -s "$puma_pid_file" ]; then
puma_pid=$(head -n 1 $puma_pid_file) > /dev/null 2>&1
trap "kill $postgres_pid $redis_pid $puma_pid" EXIT TERM INT
fi
echo "Check gitlab-shell promise..."
$promise_check/gitlab-shell
#echo "starting Sidekiq to check sidekiq promise..."
......@@ -110,6 +119,7 @@ $promise_check/gitlab-shell
kill_process $postgres_pid
kill_process $redis_pid
kill_process $puma_pid
kill_process $gitaly_pid
RESTORE_EXIT_CODE=$?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment