8491: move files from arvados-dev into their new places
[arvados.git] / build / rails-package-scripts / arvados-api-server.sh
1 #!/bin/sh
2 # This file declares variables common to all scripts for one Rails package.
3
4 PACKAGE_NAME=arvados-api-server
5 INSTALL_PATH=/var/www/arvados-api
6 CONFIG_PATH=/etc/arvados/api
7 DOC_URL="http://doc.arvados.org/install/install-api-server.html#configure"
8
9 RAILSPKG_DATABASE_LOAD_TASK=db:structure:load
10 setup_extra_conffiles() {
11     setup_conffile initializers/omniauth.rb
12 }
13
14 setup_before_nginx_restart() {
15   # initialize git_internal_dir
16   # usually /var/lib/arvados/internal.git (set in application.default.yml )
17   if [ "$APPLICATION_READY" = "1" ]; then
18       GIT_INTERNAL_DIR=$($COMMAND_PREFIX bundle exec rake config:check 2>&1 | grep git_internal_dir | awk '{ print $2 }')
19       if [ ! -e "$GIT_INTERNAL_DIR" ]; then
20         run_and_report "Creating git_internal_dir '$GIT_INTERNAL_DIR'" \
21           mkdir -p "$GIT_INTERNAL_DIR"
22         run_and_report "Initializing git_internal_dir '$GIT_INTERNAL_DIR'" \
23           git init --quiet --bare $GIT_INTERNAL_DIR
24       else
25         echo "Initializing git_internal_dir $GIT_INTERNAL_DIR: directory exists, skipped."
26       fi
27       run_and_report "Making sure '$GIT_INTERNAL_DIR' has the right permission" \
28          chown -R "$WWW_OWNER:" "$GIT_INTERNAL_DIR"
29   else
30       echo "Initializing git_internal_dir... skipped."
31   fi
32 }