debian-mirror-gitlab/debian/rake-tasks.sh

29 lines
1 KiB
Bash
Raw Normal View History

2015-09-12 15:42:12 +05:30
#! /bin/sh
set -e
# Read and export debian specific configuration
# Only exported variables will be passed on to gitlab app
2016-02-18 17:53:04 +05:30
export $(cat /etc/gitlab/gitlab-debian.conf)
cd /usr/share/gitlab
# Check if the db is already present
2016-04-04 22:39:31 +05:30
if [ "$(LANG=C su postgres -c "psql gitlab_production -c \"\d\"")" = \
"No relations found." ]; then
echo "Initializing database..."
2016-10-01 15:08:03 +05:30
test -f ${gitlab_home}/db/schema.rb || \
su ${gitlab_user} -s /bin/sh -c\
"cp ${gitlab_data_dir}/db/schema.rb.template ${gitlab_data_dir}/db/schema.rb"
2016-04-04 22:39:31 +05:30
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'
else
echo "gitlab_production database is not empty, skipping gitlab setup"
2016-04-05 12:17:23 +05:30
su ${gitlab_user} -s /bin/sh -c 'bundle exec rake db:migrate'
2016-04-04 22:39:31 +05:30
fi
2016-02-12 17:32:34 +05:30
# Restrict permissions for secret files
chmod 0700 ${gitlab_data_dir}/.gitlab_shell_secret
2015-09-12 15:42:12 +05:30
echo "Precompiling assets..."
2016-08-31 13:33:35 +05:30
su ${gitlab_user} -s /bin/sh -c 'bundle exec rake tmp:cache:clear assets:precompile RAILS_ENV=production'