From 93acbe0dd811334c7da5b93e440886c368338b09 Mon Sep 17 00:00:00 2001 From: Alex Brausewetter Date: Sat, 26 Nov 2016 13:15:57 +0100 Subject: [PATCH] With MySQL run gitlab:setup before db:migrate Fixes an issue where starting a new MySQL based container would failed due to foreign key constraints. --- assets/runtime/functions | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/assets/runtime/functions b/assets/runtime/functions index 2329c307..56be271d 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -1294,6 +1294,13 @@ migrate_database() { ;; esac + if [[ -z ${COUNT} || ${COUNT} -eq 0 ]]; then + echo "Setting up GitLab for firstrun. Please be patient, this could take a while..." + exec_as_git force=yes bundle exec rake gitlab:setup \ + ${GITLAB_ROOT_PASSWORD:+GITLAB_ROOT_PASSWORD=$GITLAB_ROOT_PASSWORD} \ + ${GITLAB_ROOT_EMAIL:+GITLAB_ROOT_EMAIL=$GITLAB_ROOT_EMAIL} >/dev/null + fi + # migrate database if the gitlab version has changed. CACHE_VERSION= [[ -f ${GITLAB_TEMP_DIR}/VERSION ]] && CACHE_VERSION=$(cat ${GITLAB_TEMP_DIR}/VERSION) @@ -1333,13 +1340,6 @@ migrate_database() { rm -rf ${GITLAB_TEMP_DIR}/GITLAB_RELATIVE_URL_ROOT # force cache cleanup fi - if [[ -z ${COUNT} || ${COUNT} -eq 0 ]]; then - echo "Setting up GitLab for firstrun. Please be patient, this could take a while..." - exec_as_git force=yes bundle exec rake gitlab:setup \ - ${GITLAB_ROOT_PASSWORD:+GITLAB_ROOT_PASSWORD=$GITLAB_ROOT_PASSWORD} \ - ${GITLAB_ROOT_EMAIL:+GITLAB_ROOT_EMAIL=$GITLAB_ROOT_EMAIL} >/dev/null - fi - # clear cache if relative_url has changed. [[ -f ${GITLAB_TEMP_DIR}/GITLAB_RELATIVE_URL_ROOT ]] && CACHE_GITLAB_RELATIVE_URL_ROOT=$(cat ${GITLAB_TEMP_DIR}/GITLAB_RELATIVE_URL_ROOT) if [[ ! -f ${GITLAB_TEMP_DIR}/GITLAB_RELATIVE_URL_ROOT || ${GITLAB_RELATIVE_URL_ROOT} != ${CACHE_GITLAB_RELATIVE_URL_ROOT} ]]; then