diff --git a/debian/rake-tasks.sh b/debian/rake-tasks.sh index 968652cb30..aec5ee08e0 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'