Merge branch '16471-install-using-salt' into master
[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   # Rails 5.2 does not tolerate dangling symlinks in the initializers directory, and this one
16   # can still be there, left over from a previous version of the API server package.
17   rm -f $RELEASE_PATH/config/initializers/omniauth.rb
18 }
19
20 setup_before_nginx_restart() {
21   # initialize git_internal_dir
22   # usually /var/lib/arvados/internal.git (set in application.default.yml )
23   if [ "$APPLICATION_READY" = "1" ]; then
24       GIT_INTERNAL_DIR=$($COMMAND_PREFIX bundle exec rake config:dump 2>&1 | grep GitInternalDir | awk '{ print $2 }' |tr -d '"')
25       if [ ! -e "$GIT_INTERNAL_DIR" ]; then
26         run_and_report "Creating git_internal_dir '$GIT_INTERNAL_DIR'" \
27           mkdir -p "$GIT_INTERNAL_DIR"
28         run_and_report "Initializing git_internal_dir '$GIT_INTERNAL_DIR'" \
29           git init --quiet --bare $GIT_INTERNAL_DIR
30       else
31         echo "Initializing git_internal_dir $GIT_INTERNAL_DIR: directory exists, skipped."
32       fi
33       run_and_report "Making sure '$GIT_INTERNAL_DIR' has the right permission" \
34          chown -R "$WWW_OWNER:" "$GIT_INTERNAL_DIR"
35   else
36       echo "Initializing git_internal_dir... skipped."
37   fi
38 }