17863: further cleanup in our rails postinst scripts and documentation:
authorWard Vandewege <ward@curii.com>
Thu, 22 Jul 2021 13:02:27 +0000 (09:02 -0400)
committerWard Vandewege <ward@curii.com>
Thu, 22 Jul 2021 14:25:03 +0000 (10:25 -0400)
* 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 <ward@curii.com>

build/rails-package-scripts/arvados-api-server.sh
build/rails-package-scripts/postinst.sh
build/run-build-packages.sh
doc/_includes/_create_superuser_token.liquid
doc/_includes/_install_rails_command.liquid
doc/admin/config-migration.html.textile.liquid
doc/admin/token-expiration-policy.html.textile.liquid
doc/install/install-arv-git-httpd.html.textile.liquid
doc/install/install-keep-web.html.textile.liquid

index 027383ab4f62294aa9661b5e9ce1651457f3bf1a..a513c3ad09f885dc18c7187822418d77e535e201 100644 (file)
@@ -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"
index 5eb69d08105e370cdf6b27a157617c33d47d3194..f6ae48c0fc4e9373be9d3756698016f28f64493d 100644 (file)
@@ -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
index e231a83df8d22e291a7d048bc8fa3d00c136a109..d46c246da7c9fadb0fe96fbe7edce0f4c623c351 100755 (executable)
@@ -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/
index 07d8a4ae40ac7e0caabed2713bda5fb7a139379f..ed085ea105b5fa48009200b59f1bdfd553cf63b4 100644 (file)
@@ -8,7 +8,7 @@ On the <strong>API server</strong>, use the following commands:
 
 <notextile>
 <pre><code>~$ <span class="userinput">cd /var/www/arvados-api/current</span>
-$ <span class="userinput">sudo -u <b>webserver-user</b> RAILS_ENV=production bundle exec script/create_superuser_token.rb</span>
+$ <span class="userinput">sudo -u <b>webserver-user</b> RAILS_ENV=production bin/bundle exec script/create_superuser_token.rb</span>
 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
 </code></pre>
 </notextile>
index 10c17a0c2d4bdbe703b3cf91d7ea434ca5e1e4e5..b648e92161e63ea485f0585242caf7947da3bb78 100644 (file)
@@ -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 %}
 
 <notextile>
index a1f7872df4bff34e520d26c2f33680fdaec031a6..e36655a0f9eaecb4949f47334fa597225c5e57d5 100644 (file)
@@ -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:
 
 <pre>
-$ 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
 </pre>
 
@@ -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@.
 
 <pre>
-$ RAILS_ENV=production bundle exec rake config:diff
+$ RAILS_ENV=production bin/rake config:diff
 </pre>
 
 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:
 
 <pre>
-$ 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
 </pre>
 
@@ -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@.
 
 <pre>
-$ RAILS_ENV=production bundle exec rake config:diff
+$ RAILS_ENV=production bin/rake config:diff
 </pre>
 
 This command will also report if no migrations are required.
index c71d86c47f234b6cd3db8b2580faabcc46eb6a0c..5efbccbc19a0c4289643ba98632c24fda8b6f985 100644 (file)
@@ -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.
 
 <notextile>
-<pre><code># <span class="userinput">bundle exec rake db:check_long_lived_tokens</span>
+<pre><code># <span class="userinput">bin/rake db:check_long_lived_tokens</span>
 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.
 
 <notextile>
-<pre><code># <span class="userinput">bundle exec rake db:fix_long_lived_tokens</span>
+<pre><code># <span class="userinput">bin/rake db:fix_long_lived_tokens</span>
 Setting token expiration to: 2020-08-25 03:30:50 +0000
 6 tokens updated.
 </code></pre>
index 3d70fc4de9497e8bb20b48cec6ecdfa8f62ef2ca..b7589032561cb03046bd597bd973506a665278d9 100644 (file)
@@ -183,7 +183,7 @@ $ sudo chmod og-rwx /var/www/arvados-api/current/config/arvados-clients.yml
 
 h3. Test configuration
 
-notextile. <pre><code>$ <span class="userinput">sudo -u git -i bash -c 'cd /var/www/arvados-api/current && bundle exec script/arvados-git-sync.rb production'</span></code></pre>
+notextile. <pre><code>$ <span class="userinput">sudo -u git -i bash -c 'cd /var/www/arvados-api/current && bin/bundle exec script/arvados-git-sync.rb production'</span></code></pre>
 
 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:
 
 <notextile>
-<pre><code><span class="userinput">*/5 * * * * git cd /var/www/arvados-api/current && bundle exec script/arvados-git-sync.rb production</span>
+<pre><code><span class="userinput">*/5 * * * * git cd /var/www/arvados-api/current && bin/bundle exec script/arvados-git-sync.rb production</span>
 </code></pre>
 </notextile>
 
index 033efe63f1b76786e058ab9adf385f406adbd31b..5ff9f44194fa5996f90de4ab75ebfb55a542dc6f 100644 (file)
@@ -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.