check for empty db before overwriting
This commit is contained in:
parent
651f4d51d5
commit
2734f0a9fc
1 changed files with 11 additions and 4 deletions
15
debian/rake-tasks.sh
vendored
15
debian/rake-tasks.sh
vendored
|
@ -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'
|
||||
|
||||
|
|
Loading…
Reference in a new issue