use unicode, check db exist

This commit is contained in:
Praveen Arimbrathodiyil 2016-04-04 22:39:31 +05:30
parent 2ea8045ece
commit 6206489e19
3 changed files with 14 additions and 7 deletions

2
debian/changelog vendored
View file

@ -4,6 +4,8 @@ gitlab (8.5.8+dfsg-3) UNRELEASED; urgency=medium
* Symlink 'shared' to /var/lib/gitlab instead of 'shared/cache'
- gitlab expects everything inside shared to be in the same file system.
* Use embedded copy of fuzzaldrin-plus (See #814871 for more details)
* Bring back db check in postinst (initialize the db only if it is empty)
* Choose unicode for db encoding (fixes wiki creation error)
-- Pirate Praveen <praveen@debian.org> Sun, 03 Apr 2016 17:41:28 +0530

2
debian/postinst vendored
View file

@ -126,7 +126,7 @@ case "$1" in
echo "Create database if not present"
if ! su postgres -s /bin/sh -c "psql gitlab_production -c ''"; then
su postgres -c 'createdb gitlab_production'
su postgres -c 'createdb -E unicode -T template0 gitlab_production'
fi
# Adjust database privileges

17
debian/rake-tasks.sh vendored
View file

@ -17,12 +17,17 @@ if ! [ -f "${gitlab_app_root}/config/secrets.yml" ]; then
echo ${gitlab_app_root} > ${gitlab_app_root}/.secret
}
fi
echo "Initializing database..."
su ${gitlab_user} -s /bin/sh -c 'bundle exec rake db:schema:load'
su ${gitlab_user} -s /bin/sh -c 'bundle exec rake db:seed_fu'
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 [ "$(LANG=C su postgres -c "psql gitlab_production -c \"\d\"")" = \
"No relations found." ]; then
echo "Initializing database..."
su ${gitlab_user} -s /bin/sh -c 'bundle exec rake db:schema:load'
su ${gitlab_user} -s /bin/sh -c 'bundle exec rake db:seed_fu'
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'