Fix first time installation issues

This commit is contained in:
Pirate Praveen 2017-12-13 00:51:58 +05:30
parent f2e56e0d18
commit 7c5d6cd0dd
2 changed files with 7 additions and 4 deletions

1
debian/gitlab.links vendored
View file

@ -24,4 +24,5 @@ usr/share/javascript/graphael/g.raphael-min.js usr/share/gitlab/vendor/assets/ja
usr/share/javascript/graphael/g.bar-min.js usr/share/gitlab/vendor/assets/javascripts/g.bar-min.js
usr/share/javascript/fuzzaldrin/fuzzaldrin-plus.js usr/share/gitlab/vendor/assets/javascripts/fuzzaldrin-plus.js
/var/lib/gitlab/.gitlab_workhorse_secret /usr/share/gitlab/.gitlab_workhorse_secret
/var/lib/gitlab/.gitlab_shell_secret /usr/share/gitlab/.gitlab_shell_secret
/var/lib/gitlab/Gemfile.lock /usr/share/gitlab/Gemfile.lock

10
debian/rake-tasks.sh vendored
View file

@ -9,19 +9,21 @@ export DB RAILS_ENV
cd /usr/share/gitlab
# Check if the db is already present
if [ "$(LANG=C runuser -u postgres -- sh -c "psql gitlab_production -c \"\d\"")" = \
"No relations found." ]; then
db_relations="$(LANG=C runuser -u postgres -- sh -c "psql gitlab_production -c \"\d\"" 2>&1)"
if [ "$db_relations" = "No relations found." ] || \
[ "$db_relations" = "Did not find any relations." ]; then
echo "Initializing database..."
test -f ${gitlab_home}/db/schema.rb || \
runuser -u ${gitlab_user} -- sh -c \
"cp ${gitlab_data_dir}/db/schema.rb.template ${gitlab_data_dir}/db/schema.rb"
touch ${gitlab_data_dir}/.gitlab_shell_secret
runuser -u ${gitlab_user} -- sh -c 'bundle exec rake db:schema:load'
runuser -u ${gitlab_user} -- sh -c 'bundle exec rake db:seed_fu'
else
echo "gitlab_production database is not empty, skipping gitlab setup"
runuser -u ${gitlab_user} -- sh -c 'bundle exec rake db:migrate'
fi
runuser -u ${gitlab_user} -- sh -c 'bundle exec rake db:migrate'
# Restrict permissions for secret files
chmod 0700 ${gitlab_data_dir}/.gitlab_shell_secret