[DRE-commits] [gitlab] 01/01: use unicode, check db exist
Praveen Arimbrathodiyil
praveen at moszumanska.debian.org
Mon Apr 4 17:10:18 UTC 2016
This is an automated email from the git hooks/post-receive script.
praveen pushed a commit to branch master-8.5
in repository gitlab.
commit 6206489e191dc9139d7c60875fb94428fd91da22
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date: Mon Apr 4 22:39:31 2016 +0530
use unicode, check db exist
---
debian/changelog | 2 ++
debian/postinst | 2 +-
debian/rake-tasks.sh | 17 +++++++++++------
3 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 81a7298..1e31096 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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 at debian.org> Sun, 03 Apr 2016 17:41:28 +0530
diff --git a/debian/postinst b/debian/postinst
index 099e135..f8f9ba2 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -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
diff --git a/debian/rake-tasks.sh b/debian/rake-tasks.sh
index 0f60663..d23e964 100755
--- a/debian/rake-tasks.sh
+++ b/debian/rake-tasks.sh
@@ -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'
--
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