[DRE-commits] [gitlab] 03/04: check for empty db before overwriting
Praveen Arimbrathodiyil
praveen at moszumanska.debian.org
Fri Feb 12 12:10:18 UTC 2016
This is an automated email from the git hooks/post-receive script.
praveen pushed a commit to branch master
in repository gitlab.
commit 2734f0a9fc8f6507779f695fa7c68d7e813d6fea
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date: Fri Feb 12 17:32:34 2016 +0530
check for empty db before overwriting
---
debian/rake-tasks.sh | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/debian/rake-tasks.sh b/debian/rake-tasks.sh
index 968652c..aec5ee0 100755
--- a/debian/rake-tasks.sh
+++ b/debian/rake-tasks.sh
@@ -4,10 +4,17 @@
export $(cat /etc/gitlab/gitlab-debian.conf|xargs)
echo "Initializing database..."
-su ${gitlab_user} -s /bin/sh -c 'bundle exec rake gitlab:setup RAILS_ENV=production'
-su ${gitlab_user} -s /bin/sh -c 'bundle exec rake gitlab:shell:install \
-REDIS_URL=redis://localhost:6379 \
-SHELL_ROOT_PATH=/usr/share/gitlab-shell RAILS_ENV=production'
+if [ "$(sudo -u postgres psql gitlab_production -c '\d')" = \
+"No relations found." ]; then
+ su ${gitlab_user} -s /bin/sh -c 'bundle exec rake gitlab:setup \
+ RAILS_ENV=production force=yes'
+ su ${gitlab_user} -s /bin/sh -c 'bundle exec rake gitlab:shell:install \
+ REDIS_URL=redis://localhost:6379 \
+ SHELL_ROOT_PATH=/usr/share/gitlab-shell RAILS_ENV=production'
+else
+ echo "gitlab_production database is not empty, skipping gitlab setup"
+fi
+
echo "Precompiling assets..."
su ${gitlab_user} -s /bin/sh -c 'bundle exec rake assets:precompile RAILS_ENV=production'
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/gitlab.git
More information about the Pkg-ruby-extras-commits
mailing list