Skip to content

Allow bootsnap to be disabled

Ash McKenzie requested to merge ashmckenzie/allow-bootsnap-to-be-disabled into master

What does this MR do and why?

While diagnosing gitlab-development-kit!2236 (closed), I discovered there was no way to properly disable Bootsnap for gitlab-org/gitlab. This MR fixes that by allowing ENABLE_BOOTSNAP to be set to 0, no or false.

In this MR I also upgraded bootsnap from 1.4.6 to 1.9.1, added require: false given we only 'load' bootsnap if:

require 'bootsnap/setup' if ENV['RAILS_ENV'] != 'production' && !%w(0 no false).include?(ENV['ENABLE_BOOTSNAP'])

Related: gitlab-development-kit!2239 (merged)

How to set up and validate locally

  1. In your GDK_ROOT/gitlab directory, check out the ashmckenzie/allow-bootsnap-to-be-disabled branch for GitLab:

    git fetch && git checkout ashmckenzie/allow-bootsnap-to-be-disabled

  2. In your GDK_ROOT directory, ensure you are up-to-date:

    git fetch && git checkout main && git pull -r

  3. Disable gitlab.rails.bootsnap:

    gdk config set gitlab.rails.bootsnap false

  4. Reconfigure your GDK:

    gdk reconfigure

  5. Stop your GDK:

    gdk stop && gdk kill

  6. Remove any existing bootsnap cache:

    rm -rf gitlab/tmp/cache/bootsnap-*

  7. Start your GDK:

    gdk start

  8. Wait until Rails has fully loaded (check http://localhost:3000)

  9. Confirm that bootsnap has not recreated any cache:

    ls -la gitlab/tmp/cache/bootsnap-*

It's also worth testing with a clean tmp/cache and gdk config set gitlab.rails.bootsnap true to verify that cache is still created by default or when gitlab.rails.bootsnap is explicitly set.

🎗 Once tested, don't forget to run gdk config set gitlab.rails.bootsnap true && gdk reconfigure if you want the default behaviour to return.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Ash McKenzie

Merge request reports