From 32e1a62223130822eaac3ebdef942a44102184b9 Mon Sep 17 00:00:00 2001 From: Ward Vandewege Date: Thu, 22 Jul 2021 09:02:27 -0400 Subject: [PATCH] 17863: further cleanup in our rails postinst scripts and documentation: * replace `bundle exec` calls with the appropriate binstub * update deprecated use of `bundle install --path` to avoid warning Arvados-DCO-1.1-Signed-off-by: Ward Vandewege --- .../arvados-api-server.sh | 2 +- build/rails-package-scripts/postinst.sh | 21 +++++++++++-------- build/run-build-packages.sh | 4 ++-- doc/_includes/_create_superuser_token.liquid | 2 +- doc/_includes/_install_rails_command.liquid | 4 ++-- .../config-migration.html.textile.liquid | 8 +++---- ...oken-expiration-policy.html.textile.liquid | 4 ++-- .../install-arv-git-httpd.html.textile.liquid | 4 ++-- .../install-keep-web.html.textile.liquid | 2 +- 9 files changed, 27 insertions(+), 24 deletions(-) diff --git a/build/rails-package-scripts/arvados-api-server.sh b/build/rails-package-scripts/arvados-api-server.sh index 027383ab4f..a513c3ad09 100644 --- a/build/rails-package-scripts/arvados-api-server.sh +++ b/build/rails-package-scripts/arvados-api-server.sh @@ -21,7 +21,7 @@ setup_before_nginx_restart() { # initialize git_internal_dir # usually /var/lib/arvados/internal.git (set in application.default.yml ) if [ "$APPLICATION_READY" = "1" ]; then - GIT_INTERNAL_DIR=$($COMMAND_PREFIX bundle exec rake config:dump 2>&1 | grep GitInternalDir | awk '{ print $2 }' |tr -d '"') + GIT_INTERNAL_DIR=$($COMMAND_PREFIX bin/rake config:dump 2>&1 | grep GitInternalDir | awk '{ print $2 }' |tr -d '"') if [ ! -e "$GIT_INTERNAL_DIR" ]; then run_and_report "Creating git_internal_dir '$GIT_INTERNAL_DIR'" \ mkdir -p "$GIT_INTERNAL_DIR" diff --git a/build/rails-package-scripts/postinst.sh b/build/rails-package-scripts/postinst.sh index 5eb69d0810..f6ae48c0fc 100644 --- a/build/rails-package-scripts/postinst.sh +++ b/build/rails-package-scripts/postinst.sh @@ -125,17 +125,17 @@ setup_conffile() { } prepare_database() { - DB_MIGRATE_STATUS=`$COMMAND_PREFIX bundle exec rake db:migrate:status 2>&1 || true` + DB_MIGRATE_STATUS=`$COMMAND_PREFIX bin/rake db:migrate:status 2>&1 || true` if echo "$DB_MIGRATE_STATUS" | grep -qF 'Schema migrations table does not exist yet.'; then # The database exists, but the migrations table doesn't. - run_and_report "Setting up database" $COMMAND_PREFIX bundle exec \ - rake "$RAILSPKG_DATABASE_LOAD_TASK" db:seed + run_and_report "Setting up database" $COMMAND_PREFIX bin/rake \ + "$RAILSPKG_DATABASE_LOAD_TASK" db:seed elif echo "$DB_MIGRATE_STATUS" | grep -q '^database: '; then run_and_report "Running db:migrate" \ - $COMMAND_PREFIX bundle exec rake db:migrate + $COMMAND_PREFIX bin/rake db:migrate elif echo "$DB_MIGRATE_STATUS" | grep -q 'database .* does not exist'; then if ! run_and_report "Running db:setup" \ - $COMMAND_PREFIX bundle exec rake db:setup 2>/dev/null; then + $COMMAND_PREFIX bin/rake db:setup 2>/dev/null; then echo "Warning: unable to set up database." >&2 DATABASE_READY=0 fi @@ -198,12 +198,15 @@ configure_version() { cd "$RELEASE_PATH" export RAILS_ENV=production - if ! $COMMAND_PREFIX bundle --version >/dev/null; then - run_and_report "Installing bundler" $COMMAND_PREFIX gem install bundler --version 2.2.19 + if ! $COMMAND_PREFIX bundle --version >/dev/null 2>&1; then + run_and_report "Installing bundler" $COMMAND_PREFIX gem install bundler --version 2.2.19 --no-document fi + run_and_report "Running bundle config set --local path $SHARED_PATH/vendor_bundle" \ + $COMMAND_PREFIX bin/bundle config set --local path $SHARED_PATH/vendor_bundle + run_and_report "Running bundle install" \ - $COMMAND_PREFIX bundle install --path $SHARED_PATH/vendor_bundle --local --quiet + $COMMAND_PREFIX bin/bundle install --local --quiet echo -n "Ensuring directory and file permissions ..." # Ensure correct ownership of a few files @@ -230,7 +233,7 @@ configure_version() { # warn about config errors (deprecated/removed keys from # previous version, etc) run_and_report "Checking configuration for completeness" \ - $COMMAND_PREFIX bundle exec rake config:check || APPLICATION_READY=0 + $COMMAND_PREFIX bin/rake config:check || APPLICATION_READY=0 else APPLICATION_READY=0 fi diff --git a/build/run-build-packages.sh b/build/run-build-packages.sh index e231a83df8..d46c246da7 100755 --- a/build/run-build-packages.sh +++ b/build/run-build-packages.sh @@ -401,8 +401,8 @@ if [[ "$?" == "0" ]] ; then mv /tmp/x /etc/arvados/config.yml perl -p -i -e 'BEGIN{undef $/;} s/WebDAV(.*?):\n( *)ExternalURL: ""/WebDAV$1:\n$2ExternalURL: "example.com"/g' /etc/arvados/config.yml - ARVADOS_CONFIG=none RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake npm:install >"$STDOUT_IF_DEBUG" - ARVADOS_CONFIG=none RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile >"$STDOUT_IF_DEBUG" + ARVADOS_CONFIG=none RAILS_ENV=production RAILS_GROUPS=assets bin/rake npm:install >"$STDOUT_IF_DEBUG" + ARVADOS_CONFIG=none RAILS_ENV=production RAILS_GROUPS=assets bin/rake assets:precompile >"$STDOUT_IF_DEBUG" # Remove generated configuration files so they don't go in the package. rm -rf /etc/arvados/ diff --git a/doc/_includes/_create_superuser_token.liquid b/doc/_includes/_create_superuser_token.liquid index 07d8a4ae40..ed085ea105 100644 --- a/doc/_includes/_create_superuser_token.liquid +++ b/doc/_includes/_create_superuser_token.liquid @@ -8,7 +8,7 @@ On the API server, use the following commands:
~$ cd /var/www/arvados-api/current
-$ sudo -u webserver-user RAILS_ENV=production bundle exec script/create_superuser_token.rb
+$ sudo -u webserver-user RAILS_ENV=production bin/bundle exec script/create_superuser_token.rb
 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
 
diff --git a/doc/_includes/_install_rails_command.liquid b/doc/_includes/_install_rails_command.liquid index 10c17a0c2d..b648e92161 100644 --- a/doc/_includes/_install_rails_command.liquid +++ b/doc/_includes/_install_rails_command.liquid @@ -8,7 +8,7 @@ SPDX-License-Identifier: CC-BY-SA-3.0 This template recognizes four variables: * railshost: The hostname included in the prompt, to let the user know where to run the command. If this is the empty string, no hostname will be displayed. Default "apiserver". * railsdir: The directory included in the prompt, to let the user know where to run the command. Default "/var/www/arvados-api/current". -* railscmd: The full command to run. Default "bundle exec rails console". +* railscmd: The full command to run. Default "bin/rails console". * railsout: The expected output of the command, if any. {% endcomment %} Change *@webserver-user@* to the user that runs your web server process. If you install Phusion Passenger as we recommend, this is *@www-data@* on Debian-based systems, and *@nginx@* on Red Hat-based systems. @@ -25,7 +25,7 @@ This template recognizes four variables: {% endunless %} {% unless railscmd %} - {% assign railscmd = "bundle exec rails console" %} + {% assign railscmd = "bin/rails console" %} {% endunless %} diff --git a/doc/admin/config-migration.html.textile.liquid b/doc/admin/config-migration.html.textile.liquid index a1f7872df4..e36655a0f9 100644 --- a/doc/admin/config-migration.html.textile.liquid +++ b/doc/admin/config-migration.html.textile.liquid @@ -23,7 +23,7 @@ The legacy API server configuration is stored in @config/application.yml@ and @c Change to the API server directory and use the following commands:
-$ RAILS_ENV=production bundle exec rake config:migrate > config.yml
+$ RAILS_ENV=production bin/rake config:migrate > config.yml
 $ cp config.yml /etc/arvados/config.yml
 
@@ -32,7 +32,7 @@ This will print the contents of @config.yml@ after merging the legacy @applicati If you wish to update @config.yml@ configuration by hand, or check that everything has been migrated, use @config:diff@ to print configuration items that differ between @application.yml@ and the system @config.yml@.
-$ RAILS_ENV=production bundle exec rake config:diff
+$ RAILS_ENV=production bin/rake config:diff
 
This command will also report if no migrations are required. @@ -44,7 +44,7 @@ The legacy workbench configuration is stored in @config/application.yml@. After Change to the workbench server directory and use the following commands:
-$ RAILS_ENV=production bundle exec rake config:migrate > config.yml
+$ RAILS_ENV=production bin/rake config:migrate > config.yml
 $ cp config.yml /etc/arvados/config.yml
 
@@ -53,7 +53,7 @@ This will print the contents of @config.yml@ after merging the legacy @applicati If you wish to update @config.yml@ configuration by hand, or check that everything has been migrated, use @config:diff@ to print configuration items that differ between @application.yml@ and the system @config.yml@.
-$ RAILS_ENV=production bundle exec rake config:diff
+$ RAILS_ENV=production bin/rake config:diff
 
This command will also report if no migrations are required. diff --git a/doc/admin/token-expiration-policy.html.textile.liquid b/doc/admin/token-expiration-policy.html.textile.liquid index c71d86c47f..5efbccbc19 100644 --- a/doc/admin/token-expiration-policy.html.textile.liquid +++ b/doc/admin/token-expiration-policy.html.textile.liquid @@ -113,7 +113,7 @@ If you have an existing Arvados installation and want to set a token lifetime po The @db:check_long_lived_tokens@ task will list which users have tokens with no expiration date. -
# bundle exec rake db:check_long_lived_tokens
+
# bin/rake db:check_long_lived_tokens
 Found 6 long-lived tokens from users:
 user2,user2@example.com,zzzzz-tpzed-5vzt5wc62k46p6r
 admin,admin@example.com,zzzzz-tpzed-6drplgwq9nm5cox
@@ -124,7 +124,7 @@ user1,user1@example.com,zzzzz-tpzed-ftz2tfurbpf7xox
 To apply the new policy to existing tokens, use the @db:fix_long_lived_tokens@ task.
 
 
-
# bundle exec rake db:fix_long_lived_tokens
+
# bin/rake db:fix_long_lived_tokens
 Setting token expiration to: 2020-08-25 03:30:50 +0000
 6 tokens updated.
 
diff --git a/doc/install/install-arv-git-httpd.html.textile.liquid b/doc/install/install-arv-git-httpd.html.textile.liquid index 3d70fc4de9..b758903256 100644 --- a/doc/install/install-arv-git-httpd.html.textile.liquid +++ b/doc/install/install-arv-git-httpd.html.textile.liquid @@ -183,7 +183,7 @@ $ sudo chmod og-rwx /var/www/arvados-api/current/config/arvados-clients.yml h3. Test configuration -notextile.
$ sudo -u git -i bash -c 'cd /var/www/arvados-api/current && bundle exec script/arvados-git-sync.rb production'
+notextile.
$ sudo -u git -i bash -c 'cd /var/www/arvados-api/current && bin/bundle exec script/arvados-git-sync.rb production'
h3. Enable the synchronization script @@ -192,7 +192,7 @@ The API server package includes a script that retrieves the current set of repos Create @/etc/cron.d/arvados-git-sync@ with the following content: -
*/5 * * * * git cd /var/www/arvados-api/current && bundle exec script/arvados-git-sync.rb production
+
*/5 * * * * git cd /var/www/arvados-api/current && bin/bundle exec script/arvados-git-sync.rb production
 
diff --git a/doc/install/install-keep-web.html.textile.liquid b/doc/install/install-keep-web.html.textile.liquid index 033efe63f1..5ff9f44194 100644 --- a/doc/install/install-keep-web.html.textile.liquid +++ b/doc/install/install-keep-web.html.textile.liquid @@ -105,7 +105,7 @@ h2. Set InternalURLs h2(#update-config). Configure anonymous user token -{% assign railscmd = "bundle exec ./script/get_anonymous_user_token.rb --get" %} +{% assign railscmd = "bin/bundle exec ./script/get_anonymous_user_token.rb --get" %} {% assign railsout = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" %} If you intend to use Keep-web to serve public data to anonymous clients, configure it with an anonymous token. -- 2.30.2