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